Class: Io::Flow::V0::Models::HarmonizedItemPutForm

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

Returns a new instance of HarmonizedItemPutForm.



17484
17485
17486
17487
17488
17489
17490
17491
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17484

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name], 'HarmonizedItemPutForm')
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), 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.



17482
17483
17484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17482

def attributes
  @attributes
end

#categoriesObject (readonly)

Returns the value of attribute categories.



17482
17483
17484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17482

def categories
  @categories
end

#descriptionObject (readonly)

Returns the value of attribute description.



17482
17483
17484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17482

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



17482
17483
17484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17482

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17497
17498
17499
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17497

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

#to_hashObject



17501
17502
17503
17504
17505
17506
17507
17508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17501

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

#to_jsonObject



17493
17494
17495
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17493

def to_json
  JSON.dump(to_hash)
end