Class: TdTip::Models::Parameters

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/td_tip/models/parameters.rb

Overview

Storing and processing parameters

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  @tip = options[:tip].blank? ? DEFAULT_TIP : options[:tip]
  parse_amount options[:amount]
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



9
10
11
# File 'lib/td_tip/models/parameters.rb', line 9

def amount
  @amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



9
10
11
# File 'lib/td_tip/models/parameters.rb', line 9

def currency
  @currency
end

#tipObject (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_paramsObject

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