Class: TdTip::Models::Response
- Inherits:
-
Object
- Object
- TdTip::Models::Response
- Includes:
- ActiveModel::Validations, HTTParty
- Defined in:
- lib/td_tip/models/response.rb
Overview
Response - performs request and handle response
Instance Attribute Summary collapse
-
#amount_with_tip ⇒ Object
readonly
Returns the value of attribute amount_with_tip.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#tip ⇒ Object
readonly
Returns the value of attribute tip.
Instance Method Summary collapse
-
#get ⇒ Object
Performs request and handle response.
-
#initialize(parameters) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(parameters) ⇒ Response
Returns a new instance of Response.
20 21 22 |
# File 'lib/td_tip/models/response.rb', line 20 def initialize(parameters) @parameters = parameters end |
Instance Attribute Details
#amount_with_tip ⇒ Object (readonly)
Returns the value of attribute amount_with_tip.
13 14 15 |
# File 'lib/td_tip/models/response.rb', line 13 def amount_with_tip @amount_with_tip end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
13 14 15 |
# File 'lib/td_tip/models/response.rb', line 13 def currency @currency end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
13 14 15 |
# File 'lib/td_tip/models/response.rb', line 13 def error @error end |
#parameters ⇒ Object
Returns the value of attribute parameters.
12 13 14 |
# File 'lib/td_tip/models/response.rb', line 12 def parameters @parameters end |
#tip ⇒ Object (readonly)
Returns the value of attribute tip.
13 14 15 |
# File 'lib/td_tip/models/response.rb', line 13 def tip @tip end |
Instance Method Details
#get ⇒ Object
Performs request and handle response
25 26 27 28 29 30 31 32 |
# File 'lib/td_tip/models/response.rb', line 25 def get result = parse_and_symbolize_json @amount_with_tip = result[:amount_with_tip] @tip = result[:tip] @error = result[:error] @currency = parameters.currency self end |