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

Returns a new instance of TargetingQuery.



26847
26848
26849
26850
26851
26852
26853
26854
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26847

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :q, :outcome_id, :position], '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)
  @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



26845
26846
26847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26845

def id
  @id
end

#outcome_idObject (readonly)

Returns the value of attribute outcome_id.



26845
26846
26847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26845

def outcome_id
  @outcome_id
end

#positionObject (readonly)

Returns the value of attribute position.



26845
26846
26847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26845

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



26845
26846
26847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26845

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26860
26861
26862
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26860

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

#to_hashObject



26864
26865
26866
26867
26868
26869
26870
26871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26864

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

#to_jsonObject



26856
26857
26858
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26856

def to_json
  JSON.dump(to_hash)
end