Class: Io::Flow::V0::Models::TargetingReference

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 = {}) ⇒ TargetingReference

Returns a new instance of TargetingReference.



16870
16871
16872
16873
16874
16875
16876
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16870

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :key], 'TargetingReference')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @subcatalog = (x = opts.delete(:subcatalog); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::SubcatalogReference) ? x : ::Io::Flow::V0::Models::SubcatalogReference.new(x)))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



16868
16869
16870
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16868

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



16868
16869
16870
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16868

def key
  @key
end

#subcatalogObject (readonly)

Returns the value of attribute subcatalog.



16868
16869
16870
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16868

def subcatalog
  @subcatalog
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16882
16883
16884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16882

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

#to_hashObject



16886
16887
16888
16889
16890
16891
16892
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16886

def to_hash
  {
    :id => id,
    :key => key,
    :subcatalog => subcatalog.nil? ? nil : subcatalog.to_hash
  }
end

#to_jsonObject



16878
16879
16880
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16878

def to_json
  JSON.dump(to_hash)
end