Class: NeomodeClient::Auth

Inherits:
Object
  • Object
show all
Includes:
NeomodeClient
Defined in:
lib/neomode_client/auth.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NeomodeClient

#handler, #mount_url

Constructor Details

#initialize(args) ⇒ Auth

Returns a new instance of Auth.



6
7
8
9
10
# File 'lib/neomode_client/auth.rb', line 6

def initialize(args)
  @client_id = args[:client_id]
  @client_secret = args[:client_secret]
  @is_production = args[:is_production]
end

Class Method Details

.generate_token(args) ⇒ Object



12
13
14
# File 'lib/neomode_client/auth.rb', line 12

def self.generate_token(args)
  new(args).generate_token
end

Instance Method Details

#generate_tokenObject



16
17
18
19
20
# File 'lib/neomode_client/auth.rb', line 16

def generate_token
  response = connection.post("/auth/token/anonymous", body.to_json)

  handler.new(response).parse!
end