Class: OneRoster::Response
- Inherits:
-
Object
- Object
- OneRoster::Response
- Defined in:
- lib/one_roster/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#raw_body ⇒ Object
readonly
Returns the value of attribute raw_body.
-
#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 21 |
# File 'lib/one_roster/response.rb', line 9 def initialize(faraday_response) @status = faraday_response.status @raw_body = faraday_response.body @type = resource_type(faraday_response) return unless faraday_response.body @body = faraday_response.body[@type] return unless faraday_response.headers @headers = faraday_response.headers end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/one_roster/response.rb', line 7 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
5 6 7 |
# File 'lib/one_roster/response.rb', line 5 def headers @headers end |
#raw_body ⇒ Object (readonly)
Returns the value of attribute raw_body.
5 6 7 |
# File 'lib/one_roster/response.rb', line 5 def raw_body @raw_body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/one_roster/response.rb', line 5 def status @status end |
Instance Method Details
#success? ⇒ Boolean
23 24 25 |
# File 'lib/one_roster/response.rb', line 23 def success? @status == 200 end |