Class: Io::Flow::V0::Models::Schedule
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Schedule
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents operating calendar and holidays of a center
Instance Attribute Summary collapse
-
#calendar ⇒ Object
readonly
Returns the value of attribute calendar.
-
#cutoff ⇒ Object
readonly
Returns the value of attribute cutoff.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#holiday ⇒ Object
readonly
Returns the value of attribute holiday.
-
#max_lead_time ⇒ Object
readonly
Returns the value of attribute max_lead_time.
-
#min_lead_time ⇒ Object
readonly
Returns the value of attribute min_lead_time.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Schedule
constructor
A new instance of Schedule.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Schedule
Returns a new instance of Schedule.
35757 35758 35759 35760 35761 35762 35763 35764 35765 35766 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35757 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:holiday, :exception], 'Schedule') @calendar = (x = opts.delete(:calendar); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Calendar) ? x : ::Io::Flow::V0::Models::Calendar.apply(x))) @holiday = (x = opts.delete(:holiday); x.is_a?(::Io::Flow::V0::Models::HolidayCalendar) ? x : ::Io::Flow::V0::Models::HolidayCalendar.apply(x)) @exception = HttpClient::Preconditions.assert_class('exception', opts.delete(:exception), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Exception) ? x : ::Io::Flow::V0::Models::Exception.new(x)) } @cutoff = (x = opts.delete(:cutoff); x.nil? ? nil : HttpClient::Preconditions.assert_class('cutoff', x, String)) @min_lead_time = (x = opts.delete(:min_lead_time); x.nil? ? nil : HttpClient::Preconditions.assert_class('min_lead_time', x, Integer)) @max_lead_time = (x = opts.delete(:max_lead_time); x.nil? ? nil : HttpClient::Preconditions.assert_class('max_lead_time', x, Integer)) end |
Instance Attribute Details
#calendar ⇒ Object (readonly)
Returns the value of attribute calendar.
35755 35756 35757 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35755 def calendar @calendar end |
#cutoff ⇒ Object (readonly)
Returns the value of attribute cutoff.
35755 35756 35757 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35755 def cutoff @cutoff end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
35755 35756 35757 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35755 def exception @exception end |
#holiday ⇒ Object (readonly)
Returns the value of attribute holiday.
35755 35756 35757 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35755 def holiday @holiday end |
#max_lead_time ⇒ Object (readonly)
Returns the value of attribute max_lead_time.
35755 35756 35757 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35755 def max_lead_time @max_lead_time end |
#min_lead_time ⇒ Object (readonly)
Returns the value of attribute min_lead_time.
35755 35756 35757 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35755 def min_lead_time @min_lead_time end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35772 35773 35774 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35772 def copy(incoming={}) Schedule.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35776 35777 35778 35779 35780 35781 35782 35783 35784 35785 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35776 def to_hash { :calendar => calendar.nil? ? nil : calendar.value, :holiday => holiday.value, :exception => exception.map { |o| o.to_hash }, :cutoff => cutoff, :min_lead_time => min_lead_time, :max_lead_time => max_lead_time } end |
#to_json ⇒ Object
35768 35769 35770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35768 def to_json JSON.dump(to_hash) end |