Class: Garage::Strategy::AuthServer::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/garage/strategy/auth_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Response

Returns a new instance of Response.



159
160
161
# File 'lib/garage/strategy/auth_server.rb', line 159

def initialize(raw)
  @raw = raw
end

Instance Method Details

#bodyObject



175
176
177
# File 'lib/garage/strategy/auth_server.rb', line 175

def body
  @raw.body
end

#status_codeObject



171
172
173
# File 'lib/garage/strategy/auth_server.rb', line 171

def status_code
  @raw.code.to_i
end

#to_hashObject



167
168
169
# File 'lib/garage/strategy/auth_server.rb', line 167

def to_hash
  parsed_body.symbolize_keys
end

#valid?Boolean

Returns:

  • (Boolean)


163
164
165
# File 'lib/garage/strategy/auth_server.rb', line 163

def valid?
  status_code == 200 && json? && parsed_body.is_a?(Hash)
end