Class: CTM::Auth

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/ctm/auth.rb

Class Method Summary collapse

Class Method Details

.authenticate(token, secret) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/ctm/auth.rb', line 14

def self.authenticate(token, secret)
  res = self.post("/api/v1/authentication", :body => {:token => token, :secret => secret})
  if res.parsed_response && res.parsed_response['success']
    CTM::Token.new(res.parsed_response)
  else
    raise CTM::Error::Auth.new("Failed to authenticate")
  end
end

.tokenObject



10
11
12
# File 'lib/ctm/auth.rb', line 10

def self.token
  @token
end

.token=(token) ⇒ Object



6
7
8
# File 'lib/ctm/auth.rb', line 6

def self.token=(token)
  @token = token
end