Class: Io::Flow::V0::Models::ExclusionRule
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ExclusionRule
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A global exclusion rule allows the user to select 1 or more items by query and to globally exclude those items from sale in one or more regions.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#q ⇒ Object
readonly
Returns the value of attribute q.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#regions ⇒ Object
readonly
Returns the value of attribute regions.
-
#statistics ⇒ Object
readonly
Returns the value of attribute statistics.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ExclusionRule
constructor
A new instance of ExclusionRule.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ExclusionRule
Returns a new instance of ExclusionRule.
30927 30928 30929 30930 30931 30932 30933 30934 30935 30936 30937 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30927 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :q, :query, :regions, :status, :statistics], 'ExclusionRule') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String) @query = (x = opts.delete(:query); x.is_a?(::Io::Flow::V0::Models::Query) ? x : ::Io::Flow::V0::Models::Query.new(x)) @regions = HttpClient::Preconditions.assert_class('regions', opts.delete(:regions), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Region) ? x : ::Io::Flow::V0::Models::Region.new(x)) } @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x)) @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) @statistics = (x = opts.delete(:statistics); x.is_a?(::Io::Flow::V0::Models::ExclusionRuleStatistic) ? x : ::Io::Flow::V0::Models::ExclusionRuleStatistic.new(x)) end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
30925 30926 30927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30925 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
30925 30926 30927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30925 def id @id end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
30925 30926 30927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30925 def q @q end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
30925 30926 30927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30925 def query @query end |
#regions ⇒ Object (readonly)
Returns the value of attribute regions.
30925 30926 30927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30925 def regions @regions end |
#statistics ⇒ Object (readonly)
Returns the value of attribute statistics.
30925 30926 30927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30925 def statistics @statistics end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
30925 30926 30927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30925 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
30943 30944 30945 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30943 def copy(incoming={}) ExclusionRule.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
30947 30948 30949 30950 30951 30952 30953 30954 30955 30956 30957 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30947 def to_hash { :id => id, :q => q, :query => query.to_hash, :regions => regions.map { |o| o.to_hash }, :status => status.value, :description => description, :statistics => statistics.to_hash } end |
#to_json ⇒ Object
30939 30940 30941 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30939 def to_json JSON.dump(to_hash) end |