Skip to content

Instantly share code, notes, and snippets.

@msmithstubbs
Created August 13, 2013 14:08
Show Gist options
  • Select an option

  • Save msmithstubbs/6221470 to your computer and use it in GitHub Desktop.

Select an option

Save msmithstubbs/6221470 to your computer and use it in GitHub Desktop.
Snappy API Wrapper
# simple wrapper for the Snappy API
class SnappyTicket
include HTTParty
MAILBOX_ID = 2302
base_uri 'https://app.besnappy.com/api/v1/'
headers 'Content-Type' => 'application/json'
basic_auth ENV['SNAPPY_USERNAME'], ENV['SNAPPY_PASSWORD']
format :json
def find(id)
self.class.get("/ticket/#{id}")
end
def create(attr)
content = { mailbox_id: MAILBOX_ID }.merge(attr).to_json
self.class.post('/note', body: content)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment