Class: DiscountNetwork::Response
- Inherits:
-
Object
- Object
- DiscountNetwork::Response
- Defined in:
- lib/discountnetwork/response.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #parse ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
7 8 9 |
# File 'lib/discountnetwork/response.rb', line 7 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/discountnetwork/response.rb', line 5 def response @response end |
Instance Method Details
#parse ⇒ Object
11 12 13 14 15 |
# File 'lib/discountnetwork/response.rb', line 11 def parse JSON.parse(response, object_class: ResponseObject) rescue JSON::ParserError => error ResponseObject.new(error: error, content: "") end |