Class: Io::Flow::V0::Models::TargetingQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ TargetingQuery



16812
16813
16814
16815
16816
16817
16818
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16812

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :q, :outcome_id], 'TargetingQuery')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String)
  @outcome_id = HttpClient::Preconditions.assert_class('outcome_id', opts.delete(:outcome_id), String)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



16810
16811
16812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16810

def id
  @id
end

#outcome_idObject (readonly)

Returns the value of attribute outcome_id.



16810
16811
16812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16810

def outcome_id
  @outcome_id
end

#qObject (readonly)

Returns the value of attribute q.



16810
16811
16812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16810

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16824
16825
16826
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16824

def copy(incoming={})
  TargetingQuery.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



16828
16829
16830
16831
16832
16833
16834
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16828

def to_hash
  {
    :id => id,
    :q => q,
    :outcome_id => outcome_id
  }
end

#to_jsonObject



16820
16821
16822
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16820

def to_json
  JSON.dump(to_hash)
end