Created
March 4, 2015 06:51
-
-
Save mattfitzgerald/4c90e3fcfde923c79214 to your computer and use it in GitHub Desktop.
Start of basic comms report with API
This file contains 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
require 'HTTParty' | |
class SquawkboxAPI | |
include HTTParty | |
def initialize(username, password) | |
@auth = {:username => username, :password => password} | |
@squawkbox_host = 'app.mysquawkbox.com' | |
self.class.base_uri URI::HTTPS.build(host: @squawkbox_host, path: '/service/v1').to_s | |
end | |
def get_account(options={}) | |
options.merge!({:basic_auth => @auth}) | |
self.class.get("/account", options) | |
end | |
def get_communications(options={}) | |
options.merge!({:basic_auth => @auth}) | |
self.class.get("/communications", options) | |
end | |
end | |
class CommunicationReport | |
def initialize | |
@sb_api = SquawkboxAPI.new('secret', 'secret') | |
puts @sb_api.get_communications | |
end | |
end | |
CommunicationReport.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment