Class: Garage::Strategy::AuthServer::Response
- Inherits:
-
Object
- Object
- Garage::Strategy::AuthServer::Response
- Defined in:
- lib/garage/strategy/auth_server.rb
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(raw) ⇒ Response
constructor
A new instance of Response.
- #status_code ⇒ Object
- #to_hash ⇒ Object
- #valid? ⇒ Boolean
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
#body ⇒ Object
175 176 177 |
# File 'lib/garage/strategy/auth_server.rb', line 175 def body @raw.body end |
#status_code ⇒ Object
171 172 173 |
# File 'lib/garage/strategy/auth_server.rb', line 171 def status_code @raw.code.to_i end |
#to_hash ⇒ Object
167 168 169 |
# File 'lib/garage/strategy/auth_server.rb', line 167 def to_hash parsed_body.symbolize_keys end |
#valid? ⇒ 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 |