class Io::Flow::V0::Models::HarmonizationDocument

Attributes

categories[R]
code[R]
origin[R]

Public Class Methods

new(incoming={}) click to toggle source
Calls superclass method Io::Flow::V0::Models::Document::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 44427
def initialize(incoming={})
  super(:discriminator => Document::Types::HARMONIZATION_DOCUMENT)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:code, :categories], 'HarmonizationDocument')
  @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String)
  @categories = HttpClient::Preconditions.assert_class('categories', opts.delete(:categories), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CategorySummary) ? x : ::Io::Flow::V0::Models::CategorySummary.new(x)) }
  @origin = (x = opts.delete(:origin); x.nil? ? nil : HttpClient::Preconditions.assert_class('origin', x, String))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 44440
def copy(incoming={})
  HarmonizationDocument.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 44444
def subtype_to_hash
  {
    :code => code,
    :categories => categories.map { |o| o.to_hash },
    :origin => origin
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 44436
def to_json
  JSON.dump(to_hash)
end