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.



34977
34978
34979
34980
34981
34982
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34977

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.



34975
34976
34977
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34975

def documentation_url
  @documentation_url
end

#typeObject (readonly)

Returns the value of attribute type.



34975
34976
34977
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34975

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



34988
34989
34990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34988

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

#to_hashObject



34992
34993
34994
34995
34996
34997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34992

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

#to_jsonObject



34984
34985
34986
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34984

def to_json
  JSON.dump(to_hash)
end