Class: Io::Flow::V0::Models::HarmonizedCategory

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Categories optimized for harmonization

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ HarmonizedCategory

Returns a new instance of HarmonizedCategory.



31661
31662
31663
31664
31665
31666
31667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31661

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :name], 'HarmonizedCategory')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @parent = (x = opts.delete(:parent); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::HarmonizedCategoryReference) ? x : ::Io::Flow::V0::Models::HarmonizedCategoryReference.new(x)))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



31659
31660
31661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31659

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



31659
31660
31661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31659

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



31659
31660
31661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31659

def parent
  @parent
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



31673
31674
31675
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31673

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

#to_hashObject



31677
31678
31679
31680
31681
31682
31683
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31677

def to_hash
  {
    :id => id,
    :name => name,
    :parent => parent.nil? ? nil : parent.to_hash
  }
end

#to_jsonObject



31669
31670
31671
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31669

def to_json
  JSON.dump(to_hash)
end