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.



24105
24106
24107
24108
24109
24110
24111
24112
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24105

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.



24103
24104
24105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24103

def id
  @id
end

#outcome_idObject (readonly)

Returns the value of attribute outcome_id.



24103
24104
24105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24103

def outcome_id
  @outcome_id
end

#positionObject (readonly)

Returns the value of attribute position.



24103
24104
24105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24103

def position
  @position
end

#qObject (readonly)

Returns the value of attribute q.



24103
24104
24105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24103

def q
  @q
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



24118
24119
24120
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24118

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

#to_hashObject



24122
24123
24124
24125
24126
24127
24128
24129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24122

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

#to_jsonObject



24114
24115
24116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24114

def to_json
  JSON.dump(to_hash)
end