Class: Io::Flow::V0::Models::TargetingForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TargetingForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#queries ⇒ Object
readonly
Returns the value of attribute queries.
-
#subcatalog_id ⇒ Object
readonly
Returns the value of attribute subcatalog_id.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TargetingForm
constructor
A new instance of TargetingForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TargetingForm
Returns a new instance of TargetingForm.
31592 31593 31594 31595 31596 31597 31598 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31592 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:key, :queries], 'TargetingForm') @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @queries = HttpClient::Preconditions.assert_class('queries', opts.delete(:queries), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::TargetingQueryForm) ? x : ::Io::Flow::V0::Models::TargetingQueryForm.new(x)) } @subcatalog_id = (x = opts.delete(:subcatalog_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('subcatalog_id', x, String)) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
31590 31591 31592 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31590 def key @key end |
#queries ⇒ Object (readonly)
Returns the value of attribute queries.
31590 31591 31592 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31590 def queries @queries end |
#subcatalog_id ⇒ Object (readonly)
Returns the value of attribute subcatalog_id.
31590 31591 31592 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31590 def subcatalog_id @subcatalog_id end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
31604 31605 31606 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31604 def copy(incoming={}) TargetingForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
31608 31609 31610 31611 31612 31613 31614 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31608 def to_hash { :key => key, :queries => queries.map { |o| o.to_hash }, :subcatalog_id => subcatalog_id } end |
#to_json ⇒ Object
31600 31601 31602 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31600 def to_json JSON.dump(to_hash) end |