Class: Xendit::Response
- Inherits:
-
Object
- Object
- Xendit::Response
- Defined in:
- lib/xendit/response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #created? ⇒ Boolean
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
7 8 9 10 |
# File 'lib/xendit/response.rb', line 7 def initialize(response) @status = response.status @data = JSONSerializer.decode(response.body) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/xendit/response.rb', line 5 def data @data end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/xendit/response.rb', line 5 def status @status end |
Instance Method Details
#created? ⇒ Boolean
16 17 18 |
# File 'lib/xendit/response.rb', line 16 def created? @status == 201 end |
#success? ⇒ Boolean
12 13 14 |
# File 'lib/xendit/response.rb', line 12 def success? [200, 201].include?(@status) end |