Class: Io::Flow::V0::Models::Import
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Import
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Imports allow you to upload data to Flow via files in batch. Each import fetches data from a given URL. The type of the import determines which file format to expect and what data to update
Instance Attribute Summary collapse
-
#completed_at ⇒ Object
readonly
Returns the value of attribute completed_at.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#deliveries ⇒ Object
readonly
Returns the value of attribute deliveries.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#source_url ⇒ Object
readonly
Returns the value of attribute source_url.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Import
constructor
A new instance of Import.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Import
Returns a new instance of Import.
34722 34723 34724 34725 34726 34727 34728 34729 34730 34731 34732 34733 34734 34735 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34722 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :type, :source_url, :filename, :status, :created_at, :deliveries], 'Import') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ImportType) ? x : ::Io::Flow::V0::Models::ImportType.apply(x)) @source_url = HttpClient::Preconditions.assert_class('source_url', opts.delete(:source_url), String) @filename = HttpClient::Preconditions.assert_class('filename', opts.delete(:filename), String) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::ExportStatus) ? x : ::Io::Flow::V0::Models::ExportStatus.apply(x)) @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime) @started_at = (x = opts.delete(:started_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('started_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @completed_at = (x = opts.delete(:completed_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('completed_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @results = (x = opts.delete(:results); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ImportResults) ? x : ::Io::Flow::V0::Models::ImportResults.new(x))) @deliveries = HttpClient::Preconditions.assert_class('deliveries', opts.delete(:deliveries), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ExportDelivery) ? x : ::Io::Flow::V0::Models::ExportDelivery.from_json(x)) } end |
Instance Attribute Details
#completed_at ⇒ Object (readonly)
Returns the value of attribute completed_at.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def completed_at @completed_at end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def created_at @created_at end |
#deliveries ⇒ Object (readonly)
Returns the value of attribute deliveries.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def deliveries @deliveries end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def filename @filename end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def id @id end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def results @results end |
#source_url ⇒ Object (readonly)
Returns the value of attribute source_url.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def source_url @source_url end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def started_at @started_at end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
34720 34721 34722 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34720 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
34741 34742 34743 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34741 def copy(incoming={}) Import.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
34745 34746 34747 34748 34749 34750 34751 34752 34753 34754 34755 34756 34757 34758 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34745 def to_hash { :id => id, :type => type.value, :source_url => source_url, :filename => filename, :status => status.value, :created_at => created_at, :started_at => started_at, :completed_at => completed_at, :results => results.nil? ? nil : results.to_hash, :deliveries => deliveries.map { |o| o.to_hash } } end |
#to_json ⇒ Object
34737 34738 34739 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34737 def to_json JSON.dump(to_hash) end |