Class: Io::Flow::V0::Models::ImportTemplate

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

Overview

An import template provides an organization specific example CSV file of a particular import type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ImportTemplate

Returns a new instance of ImportTemplate.



32571
32572
32573
32574
32575
32576
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32571

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:type, :documentation_url], 'ImportTemplate')
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ImportType) ? x : ::Io::Flow::V0::Models::ImportType.apply(x))
  @documentation_url = HttpClient::Preconditions.assert_class('documentation_url', opts.delete(:documentation_url), String)
end

Instance Attribute Details

#documentation_urlObject (readonly)

Returns the value of attribute documentation_url.



32569
32570
32571
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32569

def documentation_url
  @documentation_url
end

#typeObject (readonly)

Returns the value of attribute type.



32569
32570
32571
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32569

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32582
32583
32584
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32582

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

#to_hashObject



32586
32587
32588
32589
32590
32591
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32586

def to_hash
  {
    :type => type.value,
    :documentation_url => documentation_url
  }
end

#to_jsonObject



32578
32579
32580
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32578

def to_json
  JSON.dump(to_hash)
end