Class: Instapaper::HTTP::Response
- Inherits:
-
Object
- Object
- Instapaper::HTTP::Response
- Defined in:
- lib/instapaper/http/response.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#raw_format ⇒ Object
readonly
Returns the value of attribute raw_format.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #body ⇒ Object
- #error? ⇒ Boolean
-
#initialize(response, path, raw_format = false) ⇒ Response
constructor
TODO: Change this to a keyword argument (needs a major version bump).
- #valid? ⇒ Boolean
Constructor Details
#initialize(response, path, raw_format = false) ⇒ Response
TODO: Change this to a keyword argument (needs a major version bump)
10 11 12 13 14 |
# File 'lib/instapaper/http/response.rb', line 10 def initialize(response, path, raw_format = false) # rubocop:disable Style/OptionalBooleanParameter @response = response @path = path @raw_format = raw_format end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/instapaper/http/response.rb', line 7 def path @path end |
#raw_format ⇒ Object (readonly)
Returns the value of attribute raw_format.
7 8 9 |
# File 'lib/instapaper/http/response.rb', line 7 def raw_format @raw_format end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/instapaper/http/response.rb', line 7 def response @response end |
Instance Method Details
#body ⇒ Object
16 17 18 |
# File 'lib/instapaper/http/response.rb', line 16 def body raw_format ? response.to_s : parsed end |
#error? ⇒ Boolean
24 25 26 27 28 |
# File 'lib/instapaper/http/response.rb', line 24 def error? fail_if_body_unparseable unless raw_format fail_if_body_contains_error fail_if_http_error end |
#valid? ⇒ Boolean
20 21 22 |
# File 'lib/instapaper/http/response.rb', line 20 def valid? !error? end |