Class: Io::Flow::V0::Models::HarmonizedItemForm

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

Returns a new instance of HarmonizedItemForm.



16625
16626
16627
16628
16629
16630
16631
16632
16633
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16625

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name, :number], 'HarmonizedItemForm')
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @categories = (x = opts.delete(:categories); x.nil? ? nil : HttpClient::Preconditions.assert_class('categories', x, Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) })
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, 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.



16623
16624
16625
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16623

def attributes
  @attributes
end

#categoriesObject (readonly)

Returns the value of attribute categories.



16623
16624
16625
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16623

def categories
  @categories
end

#descriptionObject (readonly)

Returns the value of attribute description.



16623
16624
16625
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16623

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



16623
16624
16625
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16623

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



16623
16624
16625
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16623

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16639
16640
16641
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16639

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

#to_hashObject



16643
16644
16645
16646
16647
16648
16649
16650
16651
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16643

def to_hash
  {
    :name => name,
    :number => number,
    :categories => categories.nil? ? nil : categories,
    :description => description,
    :attributes => attributes.nil? ? nil : attributes
  }
end

#to_jsonObject



16635
16636
16637
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16635

def to_json
  JSON.dump(to_hash)
end