Class: Centaman::Service::Capacity
- Inherits:
-
Centaman::Service
- Object
- Wrapper
- Centaman::Service
- Centaman::Service::Capacity
- Includes:
- JsonWrapper
- Defined in:
- lib/centaman/service/capacity.rb
Constant Summary
Constants inherited from Wrapper
Instance Attribute Summary collapse
-
#booking_time_id ⇒ Object
readonly
Returns the value of attribute booking_time_id.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
Attributes inherited from Wrapper
#api_password, #api_token, #api_url, #api_username, #proxie_host, #proxie_password, #proxie_port, #proxie_user
Instance Method Summary collapse
- #after_init(args) ⇒ Object
- #endpoint ⇒ Object
- #object_class ⇒ Object
- #objects ⇒ Object
- #options ⇒ Object
- #require_args ⇒ Object
Methods included from JsonWrapper
#additional_hash_to_serialize_after_response, #build_object, #build_objects, #final_object_class
Methods inherited from Centaman::Service
#after_post, #fetch_all, #post, #put
Methods inherited from Wrapper
#generate_token, #headers, #initialize, #options_hash, #payload, #payload_key, #proxy_hash, #wrap_request_in_case_of_timeout
Constructor Details
This class inherits a constructor from Centaman::Wrapper
Instance Attribute Details
#booking_time_id ⇒ Object (readonly)
Returns the value of attribute booking_time_id.
4 5 6 |
# File 'lib/centaman/service/capacity.rb', line 4 def booking_time_id @booking_time_id end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date.
4 5 6 |
# File 'lib/centaman/service/capacity.rb', line 4 def start_date @start_date end |
Instance Method Details
#after_init(args) ⇒ Object
6 7 8 9 10 |
# File 'lib/centaman/service/capacity.rb', line 6 def after_init(args) @booking_time_id = args[:booking_time_id] @start_date = args[:start_date] require_args end |
#endpoint ⇒ Object
12 13 14 |
# File 'lib/centaman/service/capacity.rb', line 12 def endpoint '/ticket_services/TimedTicketType' end |
#object_class ⇒ Object
16 17 18 |
# File 'lib/centaman/service/capacity.rb', line 16 def object_class Centaman::Object::Capacity end |
#objects ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/centaman/service/capacity.rb', line 20 def objects capacities = super capacities.each do |capacity| capacity.sold_out = capacity.vacancy <= 0 end capacities end |
#options ⇒ Object
28 29 30 31 32 33 |
# File 'lib/centaman/service/capacity.rb', line 28 def super + [ { key: 'TimedTicketTypeId', value: booking_time_id }, { key: 'StartDate', value: start_date } ] end |
#require_args ⇒ Object
35 36 37 38 |
# File 'lib/centaman/service/capacity.rb', line 35 def require_args raise "booking_time_id is required for #{self.class.name}" if booking_time_id.nil? raise "start_date is required for #{self.class.name}" if start_date.nil? end |