Class: Io::Flow::V0::Models::AvailableService

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AvailableService

Returns a new instance of AvailableService.



10027
10028
10029
10030
10031
10032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10027

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)) })
end

Instance Attribute Details

#scheduled_pickups ⇒ Object (readonly)

Returns the value of attribute scheduled_pickups.



10025
10026
10027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10025

def scheduled_pickups
  @scheduled_pickups
end

#service ⇒ Object (readonly)

Returns the value of attribute service.



10025
10026
10027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10025

def service
  @service
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



10038
10039
10040
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10038

def copy(incoming={})
  AvailableService.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hash ⇒ Object



10042
10043
10044
10045
10046
10047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10042

def to_hash
  {
    :service => service,
    :scheduled_pickups => scheduled_pickups.nil? ? nil : scheduled_pickups.map { |o| o.to_hash }
  }
end

#to_json ⇒ Object



10034
10035
10036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10034

def to_json
  JSON.dump(to_hash)
end