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.



180
181
182
# File 'lib/garage/strategy/auth_server.rb', line 180

def initialize(raw)
  @raw = raw
end

Instance Method Details

#bodyObject



196
197
198
# File 'lib/garage/strategy/auth_server.rb', line 196

def body
  @raw.body
end

#status_codeObject



192
193
194
# File 'lib/garage/strategy/auth_server.rb', line 192

def status_code
  @raw.code.to_i
end

#to_hashObject



188
189
190
# File 'lib/garage/strategy/auth_server.rb', line 188

def to_hash
  parsed_body.symbolize_keys
end

#valid?Boolean

Returns:

  • (Boolean)


184
185
186
# File 'lib/garage/strategy/auth_server.rb', line 184

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