Class: Onesky::Client
- Inherits:
-
Object
- Object
- Onesky::Client
- Includes:
- Helpers::Request, Resources::Locale, Resources::Project, Resources::ProjectGroup, Resources::ProjectType
- Defined in:
- lib/onesky/client.rb
Constant Summary
Constants included from Helpers::Request
Helpers::Request::ENDPOINT, Helpers::Request::VERSION
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
Returns the value of attribute api_secret.
-
#plugin_code ⇒ Object
Returns the value of attribute plugin_code.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
Instance Method Summary collapse
- #auth_hash ⇒ Object
-
#initialize(key, secret) ⇒ Client
constructor
A new instance of Client.
Methods included from Resources::Project
#create_project, #list_project, #project
Methods included from Resources::ProjectGroup
#create_project_group, #delete_project_group, #list_project_group, #list_project_group_languages, #show_project_group
Methods included from Resources::ProjectType
Methods included from Resources::Locale
Constructor Details
#initialize(key, secret) ⇒ Client
Returns a new instance of Client.
20 21 22 23 24 25 26 |
# File 'lib/onesky/client.rb', line 20 def initialize(key, secret) @api_key = key @api_secret = secret # Plugin code for custom header @plugin_code = 'ruby-wrapper' end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
18 19 20 |
# File 'lib/onesky/client.rb', line 18 def api_key @api_key end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
18 19 20 |
# File 'lib/onesky/client.rb', line 18 def api_secret @api_secret end |
#plugin_code ⇒ Object
Returns the value of attribute plugin_code.
18 19 20 |
# File 'lib/onesky/client.rb', line 18 def plugin_code @plugin_code end |
#project_id ⇒ Object
Returns the value of attribute project_id.
18 19 20 |
# File 'lib/onesky/client.rb', line 18 def project_id @project_id end |
Instance Method Details
#auth_hash ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/onesky/client.rb', line 28 def auth_hash now = Time.now.to_i { api_key: @api_key, timestamp: now, dev_hash: Digest::MD5.hexdigest(now.to_s + @api_secret) } end |