I recently wrote ParseResource, which is a Ruby API wrapper for Parse.com's REST api.
Here's a some basic usage:
class Post < ParseResource
fields :title, :author, :body
end
p = Post.create(:title => "Hello world", :author => "Alan", :body => "ipso lorem")
The project is fairly young, and a feature I really want to implement is associations. Something like this:
class Author < ParseResource
has_many :posts
fields :name, :email
end
class Post < ParseResource
belongs_to :author
fields :title, :body
end
a = Author.create(:name => "Alan", :email => "[email protected]")
p = Post.create(:title => "Associated!", :body => "ipso lorem", :author => a)
p.author.class #=> Author
p.author.name #=> "Alan"
a.posts #=> an array of Post objects
I'd love any advice, pointers, and pitfalls from anyone who has implemented something similar as well as from anyone who has a grasp of Parse's REST API.
I've found using DataMapper ( http://datamapper.org ) it's pretty easy to get it working with almost any datastore. You can write an adapter that talks to your datastore and then use all of the power of DataMapper directly as if your data was in SQL. Here's a link that explains a bit about writing one of these adapters. http://www.killswitchcollective.com/articles/55_datamapperabstractadapter_101
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With