Class: OneSky::Client
- Inherits:
-
Object
- Object
- OneSky::Client
- Defined in:
- lib/one_sky/client.rb
Overview
Base implemention of an API client based on the one sky api version 2.
http://developer.oneskyapp.com/api/list/v/2
Constant Summary collapse
- API_ROOT_URL =
Api version 2
"https://api.oneskyapp.com/2/".freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
Returns the value of attribute api_secret.
Instance Method Summary collapse
- #get(path, params = {}, options = nil) ⇒ Object
-
#initialize(api_key, api_secret) ⇒ Client
constructor
Provide the name of the project you created on the OneSky website.
- #post(path, params = {}, options = nil) ⇒ Object
-
#project(name) ⇒ Object
Returns an API proxy for the Project Management API.
-
#utility ⇒ Object
Returns an API proxy for the Utility API.
Constructor Details
#initialize(api_key, api_secret) ⇒ Client
Provide the name of the project you created on the OneSky website. Also, the API key and secret shown there.
16 17 18 19 |
# File 'lib/one_sky/client.rb', line 16 def initialize(api_key, api_secret) raise ArgumentError, "api_key, api_secret cannot be nil." unless [api_key, api_secret].all? @api_key, @api_secret = api_key, api_secret end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
13 14 15 |
# File 'lib/one_sky/client.rb', line 13 def api_key @api_key end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
13 14 15 |
# File 'lib/one_sky/client.rb', line 13 def api_secret @api_secret end |
Instance Method Details
#get(path, params = {}, options = nil) ⇒ Object
24 25 26 |
# File 'lib/one_sky/client.rb', line 24 def get(path, params = {}, = nil) fetch_response :get, path, params, end |
#post(path, params = {}, options = nil) ⇒ Object
28 29 30 |
# File 'lib/one_sky/client.rb', line 28 def post(path, params = {}, = nil) fetch_response :post, path, params, end |