Class: Io::Flow::V0::Models::ScheduledExport
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ScheduledExport
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Allows a user to create a scheduled export that will be delivered on a schedule (currently only support once / day at a set time)
Instance Attribute Summary collapse
-
#hour ⇒ Object
readonly
Returns the value of attribute hour.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_sent_at ⇒ Object
readonly
Returns the value of attribute last_sent_at.
-
#minute ⇒ Object
readonly
Returns the value of attribute minute.
-
#organization_q ⇒ Object
readonly
Returns the value of attribute organization_q.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ScheduledExport
constructor
A new instance of ScheduledExport.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ScheduledExport
Returns a new instance of ScheduledExport.
49502 49503 49504 49505 49506 49507 49508 49509 49510 49511 49512 49513 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49502 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :user, :organization_q, :hour, :minute, :timezone, :types], 'ScheduledExport') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @user = (x = opts.delete(:user); x.is_a?(::Io::Flow::V0::Models::UserReference) ? x : ::Io::Flow::V0::Models::UserReference.new(x)) @organization_q = HttpClient::Preconditions.assert_class('organization_q', opts.delete(:organization_q), String) @hour = HttpClient::Preconditions.assert_class('hour', opts.delete(:hour), Integer) @minute = HttpClient::Preconditions.assert_class('minute', opts.delete(:minute), Integer) @timezone = HttpClient::Preconditions.assert_class('timezone', opts.delete(:timezone), String) @types = HttpClient::Preconditions.assert_class('types', opts.delete(:types), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ExportType) ? x : ::Io::Flow::V0::Models::ExportType.from_json(x)) } @last_sent_at = (x = opts.delete(:last_sent_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('last_sent_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end |
Instance Attribute Details
#hour ⇒ Object (readonly)
Returns the value of attribute hour.
49500 49501 49502 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49500 def hour @hour end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
49500 49501 49502 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49500 def id @id end |
#last_sent_at ⇒ Object (readonly)
Returns the value of attribute last_sent_at.
49500 49501 49502 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49500 def last_sent_at @last_sent_at end |
#minute ⇒ Object (readonly)
Returns the value of attribute minute.
49500 49501 49502 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49500 def minute @minute end |
#organization_q ⇒ Object (readonly)
Returns the value of attribute organization_q.
49500 49501 49502 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49500 def organization_q @organization_q end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
49500 49501 49502 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49500 def timezone @timezone end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
49500 49501 49502 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49500 def types @types end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
49500 49501 49502 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49500 def user @user end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
49519 49520 49521 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49519 def copy(incoming={}) ScheduledExport.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
49523 49524 49525 49526 49527 49528 49529 49530 49531 49532 49533 49534 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49523 def to_hash { :id => id, :user => user.to_hash, :organization_q => organization_q, :hour => hour, :minute => minute, :timezone => timezone, :types => types.map { |o| o.to_hash }, :last_sent_at => last_sent_at } end |
#to_json ⇒ Object
49515 49516 49517 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49515 def to_json JSON.dump(to_hash) end |