Created
August 13, 2013 14:08
-
-
Save msmithstubbs/6221470 to your computer and use it in GitHub Desktop.
Snappy API Wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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