Class: Fakturoid::Oauth::TokenResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/fakturoid/oauth/token_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ TokenResponse

Returns a new instance of TokenResponse.



8
9
10
11
12
13
# File 'lib/fakturoid/oauth/token_response.rb', line 8

def initialize(response)
  @response = response
  @body     = MultiJson.load(response.env.body) unless Utils.empty?(response.env.body)

  handle_response
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/fakturoid/oauth/token_response.rb', line 6

def body
  @body
end

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/fakturoid/oauth/token_response.rb', line 6

def client
  @client
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/fakturoid/oauth/token_response.rb', line 6

def response
  @response
end

Instance Method Details

#access_tokenObject



23
24
25
# File 'lib/fakturoid/oauth/token_response.rb', line 23

def access_token
  body["access_token"]
end

#expires_inObject



27
28
29
# File 'lib/fakturoid/oauth/token_response.rb', line 27

def expires_in
  body["expires_in"]
end

#inspectObject



35
36
37
# File 'lib/fakturoid/oauth/token_response.rb', line 35

def inspect
  "#<#{self.class.name}:#{object_id} @body=\"#{body}\" @status_code=\"#{status_code}\">"
end

#refresh_tokenObject



19
20
21
# File 'lib/fakturoid/oauth/token_response.rb', line 19

def refresh_token
  body["refresh_token"]
end

#status_codeObject



15
16
17
# File 'lib/fakturoid/oauth/token_response.rb', line 15

def status_code
  response.env["status"]
end

#token_typeObject



31
32
33
# File 'lib/fakturoid/oauth/token_response.rb', line 31

def token_type
  body["token_type"]
end