class Garage::Strategy::AuthServer::Response

Public Class Methods

new(raw) click to toggle source
# File lib/garage/strategy/auth_server.rb, line 168
def initialize(raw)
  @raw = raw
end

Public Instance Methods

body() click to toggle source
# File lib/garage/strategy/auth_server.rb, line 184
def body
  @raw.body
end
status_code() click to toggle source
# File lib/garage/strategy/auth_server.rb, line 180
def status_code
  @raw.code.to_i
end
to_hash() click to toggle source
# File lib/garage/strategy/auth_server.rb, line 176
def to_hash
  parsed_body.symbolize_keys
end
valid?() click to toggle source
# File lib/garage/strategy/auth_server.rb, line 172
def valid?
  status_code == 200 && json? && parsed_body.is_a?(Hash)
end

Private Instance Methods

json?() click to toggle source
# File lib/garage/strategy/auth_server.rb, line 190
def json?
  parsed_body
  true
rescue JSON::ParserError
  false
end
parsed_body() click to toggle source
# File lib/garage/strategy/auth_server.rb, line 197
def parsed_body
  @parsed_body ||= JSON.parse(body)
end