Class: Api::Vendor::V1::Klook::BookingsFilter
- Inherits:
-
Object
- Object
- Api::Vendor::V1::Klook::BookingsFilter
- Defined in:
- app/filters/api/vendor/v1/klook/bookings_filter.rb
Instance Attribute Summary collapse
-
#collections ⇒ Object
Returns the value of attribute collections.
-
#filter_params ⇒ Object
readonly
Returns the value of attribute filter_params.
Instance Method Summary collapse
- #apply_filters ⇒ Object
- #default_collections ⇒ Object
-
#initialize(channel_id, params) ⇒ BookingsFilter
constructor
A new instance of BookingsFilter.
Constructor Details
#initialize(channel_id, params) ⇒ BookingsFilter
Returns a new instance of BookingsFilter.
6 7 8 9 10 11 |
# File 'app/filters/api/vendor/v1/klook/bookings_filter.rb', line 6 def initialize(channel_id, params) @channel_id = channel_id @filter_params = params.slice(:uuid, :productId, :optionId, :resellerReference, :supplierReference, :localDate, :localDateStart, :localDateEnd) @collections = default_collections end |
Instance Attribute Details
#collections ⇒ Object
Returns the value of attribute collections.
3 4 5 |
# File 'app/filters/api/vendor/v1/klook/bookings_filter.rb', line 3 def collections @collections end |
#filter_params ⇒ Object (readonly)
Returns the value of attribute filter_params.
4 5 6 |
# File 'app/filters/api/vendor/v1/klook/bookings_filter.rb', line 4 def filter_params @filter_params end |
Instance Method Details
#apply_filters ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/filters/api/vendor/v1/klook/bookings_filter.rb', line 17 def apply_filters filter_by_uuid filter_by_product_id filter_by_option_id filter_by_reseller_reference filter_by_supplier_reference filter_by_local_date filter_by_date_range sort_by_date limit_collections collections end |
#default_collections ⇒ Object
13 14 15 |
# File 'app/filters/api/vendor/v1/klook/bookings_filter.rb', line 13 def default_collections Reservation.joins(:vendor_reservation).where(channel: @channel_id) end |