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.



16148
16149
16150
16151
16152
16153
16154
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16148

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.



16146
16147
16148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16146

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



16146
16147
16148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16146

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



16146
16147
16148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16146

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16160
16161
16162
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16160

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

#to_hashObject



16164
16165
16166
16167
16168
16169
16170
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16164

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

#to_jsonObject



16156
16157
16158
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16156

def to_json
  JSON.dump(to_hash)
end