Class: Io::Flow::V0::Models::AvailableService
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AvailableService
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Representation of a service level available at a center and the special pickup times during the week. If pickup schedules are not provided, assumption is once a day during the weekdays.
Instance Attribute Summary collapse
-
#lead_days ⇒ Object
readonly
Returns the value of attribute lead_days.
-
#scheduled_pickups ⇒ Object
readonly
Returns the value of attribute scheduled_pickups.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AvailableService
constructor
A new instance of AvailableService.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AvailableService
Returns a new instance of AvailableService.
31740 31741 31742 31743 31744 31745 31746 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31740 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:service], 'AvailableService') @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String) @scheduled_pickups = (x = opts.delete(:scheduled_pickups); x.nil? ? nil : HttpClient::Preconditions.assert_class('scheduled_pickups', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ScheduledPickup) ? x : ::Io::Flow::V0::Models::ScheduledPickup.new(x)) }) @lead_days = (x = opts.delete(:lead_days); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::NumberRange) ? x : ::Io::Flow::V0::Models::NumberRange.new(x))) end |
Instance Attribute Details
#lead_days ⇒ Object (readonly)
Returns the value of attribute lead_days.
31738 31739 31740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31738 def lead_days @lead_days end |
#scheduled_pickups ⇒ Object (readonly)
Returns the value of attribute scheduled_pickups.
31738 31739 31740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31738 def scheduled_pickups @scheduled_pickups end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
31738 31739 31740 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31738 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
31752 31753 31754 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31752 def copy(incoming={}) AvailableService.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
31756 31757 31758 31759 31760 31761 31762 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31756 def to_hash { :service => service, :scheduled_pickups => scheduled_pickups.nil? ? nil : scheduled_pickups.map { |o| o.to_hash }, :lead_days => lead_days.nil? ? nil : lead_days.to_hash } end |
#to_json ⇒ Object
31748 31749 31750 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31748 def to_json JSON.dump(to_hash) end |