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.



14588
14589
14590
14591
14592
14593
14594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14588

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.



14586
14587
14588
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14586

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



14586
14587
14588
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14586

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



14586
14587
14588
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14586

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14600
14601
14602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14600

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

#to_hashObject



14604
14605
14606
14607
14608
14609
14610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14604

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

#to_jsonObject



14596
14597
14598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14596

def to_json
  JSON.dump(to_hash)
end