Ruby on Rails Thursday, March 26, 2015

Thank you for that, I am still building  the client gem itself, but you did prompt me to look around a bit.   Took a look at active resource, and the Schema and attributes stuff is going along the path I was looking for.  I suspect that I might even be able to make ActiveResource work with the Rakuten RMS API, but at the moment I am content to lift some bits from ActiveResource, which should also give me the info I need to make the errors stuff rails consistent.

I am still not sure how I am going to map from Rails models to my Rakuten client models, but I am getting nearer.

Thanks

On Monday, 23 March 2015 17:07:24 UTC, dasibre wrote:
I'm not completely certain, but I think you might find some insight by looking at ActiveModel

On Tuesday, March 17, 2015 at 10:14:27 AM UTC-4, tonypm wrote:
Hi,

I am working on building an api client for the Rakuten MarketPlace.  I have got some test requests for add delete update etc working and thought I should aim to structure it as a Gem and publish it so that others can use it/enhance it.

I havn't built a Gem before (worked mostly within the rails environment to date).

Have been reading and looking at other api client gems and am making progress on building something (still got a way to go to handle errors etc.)

To make the gem general purpose though, I am trying to figure out the best way to provide the mapping between models in a rails app and  the api client objects (such as product, category, order etc).

I am aiming to make each client api object a class be  (or should i call them models?)
Then I suspect I will use new to build an api instance from a rails instance, and find to return an api instance to a rails instance.

i can build in mapping for my own models to the api objects with no problem, but I can't see how I could generalize this so that other apps with similar models could use the gem.

I suspect there are approaches for doing this, but so far I haven't managed to come up with how to do it.  If anyone has any wisdom on the matter I would be grateful.

Tony Martin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2d67d0c0-a733-439f-9ecc-a4d668bcd049%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment