Class: Workarea::Affirm::Response
- Inherits:
-
Object
- Object
- Workarea::Affirm::Response
- Defined in:
- lib/workarea/affirm/response.rb
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #status ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
4 5 6 |
# File 'lib/workarea/affirm/response.rb', line 4 def initialize(response) @response = response end |
Instance Method Details
#body ⇒ Object
12 13 14 15 |
# File 'lib/workarea/affirm/response.rb', line 12 def body return {} unless @response.body.present? && @response.body != "null" JSON.parse(@response.body) end |
#status ⇒ Object
17 18 19 |
# File 'lib/workarea/affirm/response.rb', line 17 def status @response.status end |
#success? ⇒ Boolean
8 9 10 |
# File 'lib/workarea/affirm/response.rb', line 8 def success? @response.present? && (@response.status == 201 || @response.status == 200) end |