Class: Io::Flow::V0::Models::HarmonizationDocument
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
Attributes inherited from Document
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ HarmonizationDocument
constructor
A new instance of HarmonizationDocument.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Document
Constructor Details
#initialize(incoming = {}) ⇒ HarmonizationDocument
Returns a new instance of HarmonizationDocument.
12853 12854 12855 12856 12857 12858 12859 12860 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12853 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 |
Instance Attribute Details
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
12851 12852 12853 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12851 def categories @categories end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
12851 12852 12853 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12851 def code @code end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
12851 12852 12853 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12851 def origin @origin end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
12866 12867 12868 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12866 def copy(incoming={}) HarmonizationDocument.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
12870 12871 12872 12873 12874 12875 12876 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12870 def subtype_to_hash { :code => code, :categories => categories.map { |o| o.to_hash }, :origin => origin } end |
#to_json ⇒ Object
12862 12863 12864 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12862 def to_json JSON.dump(to_hash) end |