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.
29246 29247 29248 29249 29250 29251 29252 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29246 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.
29244 29245 29246 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29244 def method @method end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
29244 29245 29246 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29244 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
29244 29245 29246 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29244 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
29258 29259 29260 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29258 def copy(incoming={}) Rounding.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
29262 29263 29264 29265 29266 29267 29268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29262 def to_hash { :type => type.value, :method => method.value, :value => value } end |
#to_json ⇒ Object
29254 29255 29256 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29254 def to_json JSON.dump(to_hash) end |