Class: Centaman::Filter
- Inherits:
-
Object
- Object
- Centaman::Filter
- Defined in:
- lib/centaman/filter.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#booking_time_id ⇒ Object
readonly
Returns the value of attribute booking_time_id.
-
#booking_type_id ⇒ Object
readonly
Returns the value of attribute booking_type_id.
-
#end_date ⇒ Object
readonly
Returns the value of attribute end_date.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
Instance Method Summary collapse
- #booking_times ⇒ Object
- #booking_types ⇒ Object
- #capacity ⇒ Object
- #find_booking_time(booking_time_id) ⇒ Object
- #find_booking_type(booking_type_id) ⇒ Object
- #gift_tickets ⇒ Object
-
#initialize(args = {}) ⇒ Filter
constructor
A new instance of Filter.
- #tickets ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Filter
Returns a new instance of Filter.
6 7 8 9 10 11 |
# File 'lib/centaman/filter.rb', line 6 def initialize(args = {}) @booking_type_id = args[:booking_type_id].try(:to_i) @booking_time_id = args[:booking_time_id].try(:to_i) @start_date = args[:start_date] @end_date = args[:end_date] end |
Instance Attribute Details
#booking_time_id ⇒ Object (readonly)
Returns the value of attribute booking_time_id.
4 5 6 |
# File 'lib/centaman/filter.rb', line 4 def booking_time_id @booking_time_id end |
#booking_type_id ⇒ Object (readonly)
Returns the value of attribute booking_type_id.
4 5 6 |
# File 'lib/centaman/filter.rb', line 4 def booking_type_id @booking_type_id end |
#end_date ⇒ Object (readonly)
Returns the value of attribute end_date.
4 5 6 |
# File 'lib/centaman/filter.rb', line 4 def end_date @end_date end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date.
4 5 6 |
# File 'lib/centaman/filter.rb', line 4 def start_date @start_date end |
Instance Method Details
#booking_times ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/centaman/filter.rb', line 30 def booking_times @booking_times ||= Centaman::Service::BookingTime.new( booking_type_id: booking_type_id, start_date: start_date, end_date: end_date ).objects end |
#booking_types ⇒ Object
22 23 24 |
# File 'lib/centaman/filter.rb', line 22 def booking_types @booking_types ||= Centaman::Service::BookingType.new.objects end |
#capacity ⇒ Object
42 43 44 |
# File 'lib/centaman/filter.rb', line 42 def capacity @capacity ||= Centaman::Service::Capacity.new(booking_time_id: booking_time_id, start_date: start_date).objects.first end |
#find_booking_time(booking_time_id) ⇒ Object
17 18 19 20 |
# File 'lib/centaman/filter.rb', line 17 def find_booking_time(booking_time_id) raise "booking_time_id is required for find_booking_time method of #{self.class.name} class" if booking_time_id.nil? booking_times.detect { |c| c.id.to_s == booking_time_id.to_s } end |
#find_booking_type(booking_type_id) ⇒ Object
13 14 15 |
# File 'lib/centaman/filter.rb', line 13 def find_booking_type(booking_type_id) booking_types.detect { |c| c.booking_type_id == booking_type_id } end |
#gift_tickets ⇒ Object
38 39 40 |
# File 'lib/centaman/filter.rb', line 38 def gift_tickets @gift_tickets ||= Centaman::Service::GiftTicket.new.objects end |
#tickets ⇒ Object
26 27 28 |
# File 'lib/centaman/filter.rb', line 26 def tickets @tickets ||= Centaman::Service::TicketType.new(booking_time_id: booking_time_id).objects end |