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.



47451
47452
47453
47454
47455
47456
47457
47458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47451

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.



47449
47450
47451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47449

def id
  @id
end

#outcome_idObject (readonly)

Returns the value of attribute outcome_id.



47449
47450
47451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47449

def outcome_id
  @outcome_id
end

#positionObject (readonly)

Returns the value of attribute position.



47449
47450
47451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47449

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



47449
47450
47451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47449

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47464
47465
47466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47464

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

#to_hashObject



47468
47469
47470
47471
47472
47473
47474
47475
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47468

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

#to_jsonObject



47460
47461
47462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47460

def to_json
  JSON.dump(to_hash)
end