Class: Recruitee::Response
- Inherits:
-
Object
- Object
- Recruitee::Response
- Defined in:
- lib/recruitee/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(status_code, body, headers: nil) ⇒ Response
constructor
A new instance of Response.
- #to_s ⇒ Object
Constructor Details
#initialize(status_code, body, headers: nil) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 |
# File 'lib/recruitee/response.rb', line 7 def initialize(status_code, body, headers: nil) body = '{}' if !body || body.empty? @status_code = status_code @headers = headers ? headers.to_hash : {} @body = JSON.parse(body) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/recruitee/response.rb', line 5 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/recruitee/response.rb', line 5 def headers @headers end |
#status_code ⇒ Object
Returns the value of attribute status_code.
5 6 7 |
# File 'lib/recruitee/response.rb', line 5 def status_code @status_code end |
Instance Method Details
#to_s ⇒ Object
15 16 17 |
# File 'lib/recruitee/response.rb', line 15 def to_s "[#{status_code}] #{body}" end |