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.



21260
21261
21262
21263
21264
21265
21266
21267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21260

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

#id ⇒ Object (readonly)

Returns the value of attribute id.



21258
21259
21260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21258

def id
  @id
end

#outcome_id ⇒ Object (readonly)

Returns the value of attribute outcome_id.



21258
21259
21260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21258

def outcome_id
  @outcome_id
end

#position ⇒ Object (readonly)

Returns the value of attribute position.



21258
21259
21260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21258

def position
  @position
end

#q ⇒ Object (readonly)

Returns the value of attribute q.



21258
21259
21260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21258

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21273
21274
21275
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21273

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

#to_hash ⇒ Object



21277
21278
21279
21280
21281
21282
21283
21284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21277

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

#to_json ⇒ Object



21269
21270
21271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21269

def to_json
  JSON.dump(to_hash)
end