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.



12962
12963
12964
12965
12966
12967
12968
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12962

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

#id ⇒ Object (readonly)

Returns the value of attribute id.



12960
12961
12962
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12960

def id
  @id
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



12960
12961
12962
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12960

def name
  @name
end

#parent ⇒ Object (readonly)

Returns the value of attribute parent.



12960
12961
12962
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12960

def parent
  @parent
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



12974
12975
12976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12974

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

#to_hash ⇒ Object



12978
12979
12980
12981
12982
12983
12984
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12978

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

#to_json ⇒ Object



12970
12971
12972
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12970

def to_json
  JSON.dump(to_hash)
end