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.
31478 31479 31480 31481 31482 31483 31484 31485 31486 31487 31488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31478 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.
31476 31477 31478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31476 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
31476 31477 31478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31476 def id @id end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
31476 31477 31478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31476 def q @q end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
31476 31477 31478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31476 def query @query end |
#regions ⇒ Object (readonly)
Returns the value of attribute regions.
31476 31477 31478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31476 def regions @regions end |
#statistics ⇒ Object (readonly)
Returns the value of attribute statistics.
31476 31477 31478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31476 def statistics @statistics end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
31476 31477 31478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31476 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
31494 31495 31496 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31494 def copy(incoming={}) ExclusionRule.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
31498 31499 31500 31501 31502 31503 31504 31505 31506 31507 31508 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31498 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
31490 31491 31492 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31490 def to_json JSON.dump(to_hash) end |