Class: Io::Flow::V0::Models::Export
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Export
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Exports represent data extraction requests (e.g. download my catalog items to a CSV file)
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.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#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.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Export
constructor
A new instance of Export.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Export
Returns a new instance of Export.
9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9441 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :type, :status, :created_at, :deliveries], 'Export') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ExportType) ? x : ::Io::Flow::V0::Models::ExportType.from_json(x)) @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)) @url = (x = opts.delete(:url); x.nil? ? nil : HttpClient::Preconditions.assert_class('url', x, String)) @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.
9439 9440 9441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9439 def completed_at @completed_at end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
9439 9440 9441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9439 def created_at @created_at end |
#deliveries ⇒ Object (readonly)
Returns the value of attribute deliveries.
9439 9440 9441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9439 def deliveries @deliveries end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9439 9440 9441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9439 def id @id end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
9439 9440 9441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9439 def started_at @started_at end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
9439 9440 9441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9439 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9439 9440 9441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9439 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9439 9440 9441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9439 def url @url end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
9458 9459 9460 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9458 def copy(incoming={}) Export.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9462 def to_hash { :id => id, :type => type.to_hash, :status => status.value, :created_at => created_at, :started_at => started_at, :completed_at => completed_at, :url => url, :deliveries => deliveries.map { |o| o.to_hash } } end |
#to_json ⇒ Object
9454 9455 9456 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9454 def to_json JSON.dump(to_hash) end |