Class: Clever::Response
- Inherits:
-
Object
- Object
- Clever::Response
- Defined in:
- lib/clever/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#next_uri ⇒ Object
readonly
Returns the value of attribute next_uri.
-
#raw_body ⇒ Object
readonly
Returns the value of attribute raw_body.
-
#self_uri ⇒ Object
readonly
Returns the value of attribute self_uri.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(faraday_response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(faraday_response) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/clever/response.rb', line 9 def initialize(faraday_response) @status = faraday_response.status @raw_body = faraday_response.body return unless faraday_response.body @body = faraday_response.body['data'] @links = faraday_response.body['links'] uri(:self) uri(:next) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/clever/response.rb', line 7 def body @body end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
5 6 7 |
# File 'lib/clever/response.rb', line 5 def links @links end |
#next_uri ⇒ Object (readonly)
Returns the value of attribute next_uri.
5 6 7 |
# File 'lib/clever/response.rb', line 5 def next_uri @next_uri end |
#raw_body ⇒ Object (readonly)
Returns the value of attribute raw_body.
5 6 7 |
# File 'lib/clever/response.rb', line 5 def raw_body @raw_body end |
#self_uri ⇒ Object (readonly)
Returns the value of attribute self_uri.
5 6 7 |
# File 'lib/clever/response.rb', line 5 def self_uri @self_uri end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/clever/response.rb', line 5 def status @status end |
Instance Method Details
#success? ⇒ Boolean
22 23 24 |
# File 'lib/clever/response.rb', line 22 def success? @status == 200 end |