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.



10802
10803
10804
10805
10806
10807
10808
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10802

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

#attributes ⇒ Object (readonly)

Returns the value of attribute attributes.



10800
10801
10802
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10800

def attributes
  @attributes
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



10800
10801
10802
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10800

def name
  @name
end

#number ⇒ Object (readonly)

Returns the value of attribute number.



10800
10801
10802
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10800

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



10814
10815
10816
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10814

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

#to_hash ⇒ Object



10818
10819
10820
10821
10822
10823
10824
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10818

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

#to_json ⇒ Object



10810
10811
10812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10810

def to_json
  JSON.dump(to_hash)
end