Class: TinyGate::Types::SessionResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/tiny_gate/types/session_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ SessionResponse

Returns a new instance of SessionResponse.



9
10
11
12
# File 'lib/tiny_gate/types/session_response.rb', line 9

def initialize(response)
  @response = response
  @body = JSON.parse(response.body)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



7
8
9
# File 'lib/tiny_gate/types/session_response.rb', line 7

def body
  @body
end

Instance Method Details

#global_userObject



18
19
20
# File 'lib/tiny_gate/types/session_response.rb', line 18

def global_user
  Types::User[body]
end

#success?Boolean

Returns:



14
15
16
# File 'lib/tiny_gate/types/session_response.rb', line 14

def success?
  response.status == 200
end