Class: Io::Flow::V0::Models::WithholdingDeduction
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::WithholdingDeduction
- 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 = {}) ⇒ WithholdingDeduction
constructor
A new instance of WithholdingDeduction.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ WithholdingDeduction
Returns a new instance of WithholdingDeduction.
73000 73001 73002 73003 73004 73005 73006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 73000 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type, :amount], 'WithholdingDeduction') @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::WithholdingDeductionType) ? x : ::Io::Flow::V0::Models::WithholdingDeductionType.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.
72998 72999 73000 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72998 def amount @amount end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
72998 72999 73000 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72998 def description @description end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
72998 72999 73000 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72998 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
73012 73013 73014 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 73012 def copy(incoming={}) WithholdingDeduction.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
73016 73017 73018 73019 73020 73021 73022 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 73016 def to_hash { :type => type.value, :amount => amount.to_f.to_s, :description => description } end |
#to_json ⇒ Object
73008 73009 73010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 73008 def to_json JSON.dump(to_hash) end |