Class: Api::Partner::RestaurantAddOnsFilter
- Inherits:
-
Object
- Object
- Api::Partner::RestaurantAddOnsFilter
- Includes:
- ElasticAPM::SpanHelpers
- Defined in:
- app/filters/api/partner/restaurant_add_ons_filter.rb
Overview
Responsible to filter restaurant add-ons data
Instance Attribute Summary collapse
-
#collections ⇒ Object
Returns the value of attribute collections.
-
#error_message ⇒ Object
Returns the value of attribute error_message.
-
#time_zone ⇒ Object
Returns the value of attribute time_zone.
Instance Method Summary collapse
- #build_collections ⇒ Object
- #filter(filter_par) ⇒ Object
-
#initialize(add_ons) ⇒ RestaurantAddOnsFilter
constructor
A new instance of RestaurantAddOnsFilter.
- #order_by(order) ⇒ Object
Constructor Details
#initialize(add_ons) ⇒ RestaurantAddOnsFilter
Returns a new instance of RestaurantAddOnsFilter.
9 10 11 12 13 14 15 16 17 18 |
# File 'app/filters/api/partner/restaurant_add_ons_filter.rb', line 9 def initialize(add_ons) @add_ons = add_ons self.collections = default_collections @time_zone = if @add_ons.present? Time.now.in_time_zone(@add_ons.first.restaurant.time_zone).utc_offset / 3600 else 0 # Default to UTC if no add_ons present end @config = {} end |
Instance Attribute Details
#collections ⇒ Object
Returns the value of attribute collections.
7 8 9 |
# File 'app/filters/api/partner/restaurant_add_ons_filter.rb', line 7 def collections @collections end |
#error_message ⇒ Object
Returns the value of attribute error_message.
7 8 9 |
# File 'app/filters/api/partner/restaurant_add_ons_filter.rb', line 7 def @error_message end |
#time_zone ⇒ Object
Returns the value of attribute time_zone.
7 8 9 |
# File 'app/filters/api/partner/restaurant_add_ons_filter.rb', line 7 def time_zone @time_zone end |
Instance Method Details
#build_collections ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/filters/api/partner/restaurant_add_ons_filter.rb', line 30 def build_collections if filter_params _filter_by_add_on_id _filter_by_name _filter_by_status _filter_by_price_type _filter_by_created_date_range _filter_by_updated_date_range _filter_by_created_date _filter_by_updated_date end _order_by collections end |
#filter(filter_par) ⇒ Object
20 21 22 23 24 |
# File 'app/filters/api/partner/restaurant_add_ons_filter.rb', line 20 def filter(filter_par) return if filter_par.blank? config[:filter] = filter_par end |
#order_by(order) ⇒ Object
26 27 28 |
# File 'app/filters/api/partner/restaurant_add_ons_filter.rb', line 26 def order_by(order) config[:order_by] = order end |