Class: Io::Flow::V0::Models::FeeDeduction
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::FeeDeduction
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ FeeDeduction
constructor
A new instance of FeeDeduction.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ FeeDeduction
Returns a new instance of FeeDeduction.
43043 43044 43045 43046 43047 43048 43049 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43043 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type, :amount], 'FeeDeduction') @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::FeeDeductionType) ? x : ::Io::Flow::V0::Models::FeeDeductionType.apply(x)) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
43041 43042 43043 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43041 def amount @amount end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
43041 43042 43043 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43041 def description @description end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
43041 43042 43043 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43041 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
43055 43056 43057 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43055 def copy(incoming={}) FeeDeduction.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
43059 43060 43061 43062 43063 43064 43065 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43059 def to_hash { :type => type.value, :amount => amount.to_f.to_s, :description => description } end |
#to_json ⇒ Object
43051 43052 43053 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43051 def to_json JSON.dump(to_hash) end |