Class: Io::Flow::V0::Models::DeminimusSimple
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#minimum ⇒ Object
readonly
Returns the value of attribute minimum.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DeminimusSimple
constructor
A new instance of DeminimusSimple.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Deminimus
Constructor Details
#initialize(incoming = {}) ⇒ DeminimusSimple
Returns a new instance of DeminimusSimple.
8823 8824 8825 8826 8827 8828 8829 8830 8831 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8823 def initialize(incoming={}) super(:name => Deminimus::Types::DEMINIMUS_SIMPLE) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:value, :currency, :components, :minimum], 'DeminimusSimple') @value = HttpClient::Preconditions.assert_class('value', HttpClient::Helper.to_big_decimal(opts.delete(:value)), BigDecimal) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @components = HttpClient::Preconditions.assert_class('components', opts.delete(:components), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LevyComponent) ? x : ::Io::Flow::V0::Models::LevyComponent.apply(x)) } @minimum = HttpClient::Preconditions.assert_class('minimum', HttpClient::Helper.to_big_decimal(opts.delete(:minimum)), BigDecimal) end |
Instance Attribute Details
#components ⇒ Object (readonly)
Returns the value of attribute components.
8821 8822 8823 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8821 def components @components end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
8821 8822 8823 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8821 def currency @currency end |
#minimum ⇒ Object (readonly)
Returns the value of attribute minimum.
8821 8822 8823 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8821 def minimum @minimum end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8821 8822 8823 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8821 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
8837 8838 8839 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8837 def copy(incoming={}) DeminimusSimple.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
8841 8842 8843 8844 8845 8846 8847 8848 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8841 def subtype_to_hash { :value => value, :currency => currency, :components => components.map { |o| o.value }, :minimum => minimum } end |
#to_json ⇒ Object
8833 8834 8835 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8833 def to_json JSON.dump(to_hash) end |