Class: Io::Flow::V0::Models::PercentMargin
- Inherits:
-
TierRuleOutcome
- Object
- TierRuleOutcome
- Io::Flow::V0::Models::PercentMargin
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Rule outcome where shipping surfaced in quote is actual cost plus a predefined margin percentage
Instance Attribute Summary collapse
-
#percentage ⇒ Object
readonly
Returns the value of attribute percentage.
Attributes inherited from TierRuleOutcome
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PercentMargin
constructor
A new instance of PercentMargin.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from TierRuleOutcome
Constructor Details
#initialize(incoming = {}) ⇒ PercentMargin
Returns a new instance of PercentMargin.
44434 44435 44436 44437 44438 44439 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44434 def initialize(incoming={}) super(:discriminator => TierRuleOutcome::Types::PERCENT_MARGIN) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:percentage], 'PercentMargin') @percentage = HttpClient::Preconditions.assert_class('percentage', opts.delete(:percentage), Numeric) end |
Instance Attribute Details
#percentage ⇒ Object (readonly)
Returns the value of attribute percentage.
44432 44433 44434 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44432 def percentage @percentage end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
44445 44446 44447 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44445 def copy(incoming={}) PercentMargin.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
44449 44450 44451 44452 44453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44449 def subtype_to_hash { :percentage => percentage } end |
#to_json ⇒ Object
44441 44442 44443 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44441 def to_json JSON.dump(to_hash) end |