Class: TdTip::Models::Parameters
- Inherits:
-
Object
- Object
- TdTip::Models::Parameters
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/td_tip/models/parameters.rb
Overview
Storing and processing parameters
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#tip ⇒ Object
readonly
Returns the value of attribute tip.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Parameters
constructor
A new instance of Parameters.
-
#to_params ⇒ Object
Returns parameters for Web Service.
Constructor Details
#initialize(options = {}) ⇒ Parameters
Returns a new instance of Parameters.
15 16 17 18 |
# File 'lib/td_tip/models/parameters.rb', line 15 def initialize( = {}) @tip = [:tip].blank? ? DEFAULT_TIP : [:tip] parse_amount [:amount] end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
9 10 11 |
# File 'lib/td_tip/models/parameters.rb', line 9 def amount @amount end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
9 10 11 |
# File 'lib/td_tip/models/parameters.rb', line 9 def currency @currency end |
#tip ⇒ Object (readonly)
Returns the value of attribute tip.
9 10 11 |
# File 'lib/td_tip/models/parameters.rb', line 9 def tip @tip end |
Instance Method Details
#to_params ⇒ Object
Returns parameters for Web Service
21 22 23 |
# File 'lib/td_tip/models/parameters.rb', line 21 def to_params { amount: amount, tip: tip } end |