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.



13224
13225
13226
13227
13228
13229
13230
13231
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13224

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

#attributes ⇒ Object (readonly)

Returns the value of attribute attributes.



13222
13223
13224
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13222

def attributes
  @attributes
end

#categories ⇒ Object (readonly)

Returns the value of attribute categories.



13222
13223
13224
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13222

def categories
  @categories
end

#description ⇒ Object (readonly)

Returns the value of attribute description.



13222
13223
13224
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13222

def description
  @description
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



13222
13223
13224
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13222

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13237
13238
13239
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13237

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

#to_hash ⇒ Object



13241
13242
13243
13244
13245
13246
13247
13248
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13241

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

#to_json ⇒ Object



13233
13234
13235
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13233

def to_json
  JSON.dump(to_hash)
end