Module: One45

Defined in:
lib/one45.rb,
lib/one45/base.rb,
lib/one45/forms.rb,
lib/one45/users.rb,
lib/one45/events.rb,
lib/one45/groups.rb,
lib/one45/version.rb,
lib/one45/questions.rb,
lib/one45/rotations.rb,
lib/one45/evaluations.rb,
lib/one45/errors/one45_error.rb

Defined Under Namespace

Classes: Base, Evaluations, Events, Forms, Groups, One45Error, Questions, Rotations, Users

Constant Summary collapse

VERBS =
%w(get post put)
VERSION =
"0.2.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.access_tokenObject

Returns the value of attribute access_token.



26
27
28
# File 'lib/one45.rb', line 26

def access_token
  @access_token
end

.api_hostObject

Returns the value of attribute api_host.



26
27
28
# File 'lib/one45.rb', line 26

def api_host
  @api_host
end

.client_keyObject

Returns the value of attribute client_key.



26
27
28
# File 'lib/one45.rb', line 26

def client_key
  @client_key
end

.client_secretObject

Returns the value of attribute client_secret.



26
27
28
# File 'lib/one45.rb', line 26

def client_secret
  @client_secret
end

Class Method Details

.api_urlObject



40
41
42
# File 'lib/one45.rb', line 40

def api_url
  "https://#{One45.api_host}/web/one45_stage.php/api/v1"
end

.generate_token(client_key, client_secret) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/one45.rb', line 28

def generate_token(client_key, client_secret)
  params = { params: { client_key: client_key, client_secret: client_secret} }
  begin
    response = RestClient.get(token_url, params)
    @access_token = JSON.parse(response)['access_token']
    # puts "generated access_token: #{@access_token}"
    @access_token
  rescue => e
    One45Error.new("#{e.class} - #{e.response}")
  end
end

.token_urlObject



44
45
46
# File 'lib/one45.rb', line 44

def token_url
  "https://#{One45.api_host}/web/one45_stage.php/api/token/generate"
end