Class: Io::Flow::V0::Models::FlatRate
- Inherits:
-
TierRuleOutcome
- Object
- TierRuleOutcome
- Io::Flow::V0::Models::FlatRate
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Rule outcome where shipping surfaced in quote is pre-defined flat rate
Instance Attribute Summary collapse
-
#price ⇒ Object
readonly
Returns the value of attribute price.
Attributes inherited from TierRuleOutcome
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ FlatRate
constructor
A new instance of FlatRate.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from TierRuleOutcome
Constructor Details
#initialize(incoming = {}) ⇒ FlatRate
Returns a new instance of FlatRate.
16729 16730 16731 16732 16733 16734 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16729 def initialize(incoming={}) super(:discriminator => TierRuleOutcome::Types::FLAT_RATE) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price], 'FlatRate') @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) end |
Instance Attribute Details
#price ⇒ Object (readonly)
Returns the value of attribute price.
16727 16728 16729 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16727 def price @price end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
16740 16741 16742 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16740 def copy(incoming={}) FlatRate.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
16744 16745 16746 16747 16748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16744 def subtype_to_hash { :price => price.to_hash } end |
#to_json ⇒ Object
16736 16737 16738 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16736 def to_json JSON.dump(to_hash) end |