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.



26048
26049
26050
26051
26052
26053
26054
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26048

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.



26046
26047
26048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26046

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



26046
26047
26048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26046

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



26046
26047
26048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26046

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26060
26061
26062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26060

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

#to_hashObject



26064
26065
26066
26067
26068
26069
26070
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26064

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

#to_jsonObject



26056
26057
26058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26056

def to_json
  JSON.dump(to_hash)
end