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.



27576
27577
27578
27579
27580
27581
27582
27583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27576

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.



27574
27575
27576
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27574

def id
  @id
end

#outcome_idObject (readonly)

Returns the value of attribute outcome_id.



27574
27575
27576
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27574

def outcome_id
  @outcome_id
end

#positionObject (readonly)

Returns the value of attribute position.



27574
27575
27576
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27574

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



27574
27575
27576
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27574

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27589
27590
27591
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27589

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

#to_hashObject



27593
27594
27595
27596
27597
27598
27599
27600
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27593

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

#to_jsonObject



27585
27586
27587
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27585

def to_json
  JSON.dump(to_hash)
end