Class: Io::Flow::V0::Models::CatalogItemSummary

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

Returns a new instance of CatalogItemSummary.



24455
24456
24457
24458
24459
24460
24461
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24455

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:number, :name, :attributes], 'CatalogItemSummary')
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



24453
24454
24455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24453

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



24453
24454
24455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24453

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



24453
24454
24455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24453

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



24467
24468
24469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24467

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

#to_hashObject



24471
24472
24473
24474
24475
24476
24477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24471

def to_hash
  {
    :number => number,
    :name => name,
    :attributes => attributes
  }
end

#to_jsonObject



24463
24464
24465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24463

def to_json
  JSON.dump(to_hash)
end