Simple Mirror Api client library.
- Robust error handling. You can choose whether to bubble errors or not.
- Snake case(ruby friendly) notation for requests and responses
Add this line to your application's Gemfile:
gem 'mirror-api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mirror-api
##Getting Started ###Require the mirror-api gem.
require "mirror-api"token = Mirror::Api::OAuth.new(client_id, client_secret, refresh_token)
api = Mirror::Api::Client.new(token)##Timeline
items = api.timeline.listitem_1 = api.timeline.insert({text: "What up WORLD?!?!"})item_2 = api.timeline.insert({text: "Do you like tacos?", menu_items:[{action: "REPLY"}]})txt = "Seriously, do you like tacos? This is the second time I had to ask you."
item_2 = api.timeline.update(item_2.id, {text: txt, menu_items:[{action: "REPLY"}]})item_2 = api.timeline.patch(item_2.id, {text: "You realize you are a bad friend right?", menu_items:[{action: "REPLY"}]})api.timeline.get(item_2.id)api.timeline.delete(item_2.id)attachments = api.timeline.list(item_1.id, {attachments:{}})#for the sake of getting an id...
attachment = attachments.items.first
api.timeline.get(item_2.id, {attachments:{id: attachment.id}})api.timeline.delete(item_2.id, {attachments:{id: attachment.id}})subscriptions = api.subscriptions.listsubscription = api.subscriptions.insert({collection: "timeline", userToken:"user_1", operation: ["UPDATE"], callbackUrl: "https://yourawesomewebsite.com/callback"})item_2 = api.subscriptions.update(subscription.id, {collection: "timeline", operation: ["UPDATE", "INSERT", "DELETE"], callbackUrl: "https://yourawesomewebsite.com/callback"})api.subscriptions.delete(item_2.id)locations = api.locations.list#for the sake of getting an id...
location = locations.items.first
api.locations.get(location.id)##Contacts
items = api.contacts.listcontact = api.contacts.insert({id: '1234', displayName: 'Troll', imageUrls: ["http://pixelr3ap3r.com/wp-content/uploads/2012/08/357c6328ee4b11e1bfbf22000a1c91a7_7.jpg"]})contact = api.contacts.update(contact.id, {displayName: 'Unicorn'})contact = api.contacts.patch(contact.id, {displayName: 'Grumpy Cat', imageUrls: ["http://blog.catmoji.com/wp-content/uploads/2012/09/grumpy-cat.jpeg"]})api.contacts.get(contact.id)api.contacts.delete(contact.id)- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request