Class: Onesky::Client

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#list_project_type

Methods included from Resources::Locale

#list_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_keyObject

Returns the value of attribute api_key.



18
19
20
# File 'lib/onesky/client.rb', line 18

def api_key
  @api_key
end

#api_secretObject

Returns the value of attribute api_secret.



18
19
20
# File 'lib/onesky/client.rb', line 18

def api_secret
  @api_secret
end

#plugin_codeObject

Returns the value of attribute plugin_code.



18
19
20
# File 'lib/onesky/client.rb', line 18

def plugin_code
  @plugin_code
end

#project_idObject

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_hashObject



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