Module: LeisureKing::Authentication

Defined in:
lib/leisureking/authentication.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.tokenObject

Returns the value of attribute token.



8
9
10
# File 'lib/leisureking/authentication.rb', line 8

def token
  @token
end

Class Method Details

.get_tokenObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/leisureking/authentication.rb', line 18

def get_token
  body = {
    apikey: LeisureKing::Config.api_key,
    secret: LeisureKing::Config.api_secret
  }
  result = LeisureKing::API.send_request("authenticate", body)
  if result["status"] && result["status"] == "OK"
    self.token = result["data"]["token"]
  end
  return result
end

.init!Hash

Set’s the default value’s to nil and false

Returns:

  • (Hash)

    conguration options



12
13
14
15
16
# File 'lib/leisureking/authentication.rb', line 12

def init!
  @defaults = {
    :@token    => nil,
  }
end