Class: Io::Flow::V0::Models::Rounding
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Rounding
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Rounding
constructor
A new instance of Rounding.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Rounding
Returns a new instance of Rounding.
49337 49338 49339 49340 49341 49342 49343 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49337 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type, :method, :value], 'Rounding') @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::RoundingType) ? x : ::Io::Flow::V0::Models::RoundingType.apply(x)) @method = (x = opts.delete(:method); x.is_a?(::Io::Flow::V0::Models::RoundingMethod) ? x : ::Io::Flow::V0::Models::RoundingMethod.apply(x)) @value = HttpClient::Preconditions.assert_class('value', HttpClient::Helper.to_big_decimal(opts.delete(:value)), BigDecimal) end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
49335 49336 49337 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49335 def method @method end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
49335 49336 49337 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49335 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
49335 49336 49337 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49335 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
49349 49350 49351 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49349 def copy(incoming={}) Rounding.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
49353 49354 49355 49356 49357 49358 49359 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49353 def to_hash { :type => type.value, :method => method.value, :value => value.to_f.to_s } end |
#to_json ⇒ Object
49345 49346 49347 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49345 def to_json JSON.dump(to_hash) end |