Class: PixabayApi::Response
- Inherits:
-
Object
- Object
- PixabayApi::Response
- Defined in:
- lib/pixabay_api/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#response ⇒ Object
Returns the value of attribute response.
-
#status ⇒ Object
Returns the value of attribute status.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
7 8 9 |
# File 'lib/pixabay_api/response.rb', line 7 def initialize(response) self.response = response end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/pixabay_api/response.rb', line 5 def body @body end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/pixabay_api/response.rb', line 5 def response @response end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'lib/pixabay_api/response.rb', line 5 def status @status end |
#status_code ⇒ Object
Returns the value of attribute status_code.
5 6 7 |
# File 'lib/pixabay_api/response.rb', line 5 def status_code @status_code end |
Instance Method Details
#failed? ⇒ Boolean
15 16 17 |
# File 'lib/pixabay_api/response.rb', line 15 def failed? response.code.to_i != 200 end |
#success? ⇒ Boolean
11 12 13 |
# File 'lib/pixabay_api/response.rb', line 11 def success? response.code == 200 end |