Class: Io::Flow::V0::Models::TierRule
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TierRule
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
System to filter incoming quote for a shipment request based on a query and output corresponding outcomes.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#outcome ⇒ Object
readonly
Returns the value of attribute outcome.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TierRule
constructor
A new instance of TierRule.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TierRule
Returns a new instance of TierRule.
25845 25846 25847 25848 25849 25850 25851 25852 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25845 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :position, :query, :outcome], 'TierRule') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer) @query = HttpClient::Preconditions.assert_class('query', opts.delete(:query), String) @outcome = (x = opts.delete(:outcome); x.is_a?(::Io::Flow::V0::Models::TierRuleOutcome) ? x : ::Io::Flow::V0::Models::TierRuleOutcome.from_json(x)) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
25843 25844 25845 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25843 def id @id end |
#outcome ⇒ Object (readonly)
Returns the value of attribute outcome.
25843 25844 25845 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25843 def outcome @outcome end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
25843 25844 25845 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25843 def position @position end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
25843 25844 25845 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25843 def query @query end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
25858 25859 25860 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25858 def copy(incoming={}) TierRule.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
25862 25863 25864 25865 25866 25867 25868 25869 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25862 def to_hash { :id => id, :position => position, :query => query, :outcome => outcome.to_hash } end |
#to_json ⇒ Object
25854 25855 25856 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25854 def to_json JSON.dump(to_hash) end |