Class: Devcenter::Client::Response
- Inherits:
-
Object
- Object
- Devcenter::Client::Response
- Defined in:
- lib/devcenter/client.rb
Instance Method Summary collapse
- #access_denied? ⇒ Boolean
- #body ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #location ⇒ Object
- #not_found? ⇒ Boolean
- #ok? ⇒ Boolean
- #redirect? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
10 11 12 |
# File 'lib/devcenter/client.rb', line 10 def initialize(response) @status, @body, @headers = response.status, response.body, response.headers end |
Instance Method Details
#access_denied? ⇒ Boolean
26 27 28 |
# File 'lib/devcenter/client.rb', line 26 def access_denied? @status == 401 end |
#body ⇒ Object
30 31 32 |
# File 'lib/devcenter/client.rb', line 30 def body JSON.parse(@body) end |
#location ⇒ Object
34 35 36 |
# File 'lib/devcenter/client.rb', line 34 def location @headers['Location'] end |
#not_found? ⇒ Boolean
22 23 24 |
# File 'lib/devcenter/client.rb', line 22 def not_found? @status == 404 end |
#ok? ⇒ Boolean
14 15 16 |
# File 'lib/devcenter/client.rb', line 14 def ok? [200, 201].include?(@status) end |
#redirect? ⇒ Boolean
18 19 20 |
# File 'lib/devcenter/client.rb', line 18 def redirect? [301, 302].include?(@status) end |