Class: Api::Partner::ReviewsFilter
- Inherits:
-
Object
- Object
- Api::Partner::ReviewsFilter
- Defined in:
- app/filters/api/partner/reviews_filter.rb
Overview
Responsible to filter reservations data dashboard
Instance Attribute Summary collapse
-
#collections ⇒ Object
Returns the value of attribute collections.
-
#error_message ⇒ Object
Returns the value of attribute error_message.
Instance Method Summary collapse
-
#build_collections ⇒ Object
get desired reservations from database.
- #filter(filter_par) ⇒ Object
-
#initialize(collections = nil, restaurants) ⇒ ReviewsFilter
constructor
A new instance of ReviewsFilter.
- #to_collections ⇒ Object
Constructor Details
#initialize(collections = nil, restaurants) ⇒ ReviewsFilter
Returns a new instance of ReviewsFilter.
9 10 11 12 13 |
# File 'app/filters/api/partner/reviews_filter.rb', line 9 def initialize(collections = nil, restaurants) self.collections = collections unless collections.nil? @config = {} @restaurant = restaurants.first end |
Instance Attribute Details
#collections ⇒ Object
Returns the value of attribute collections.
6 7 8 |
# File 'app/filters/api/partner/reviews_filter.rb', line 6 def collections @collections end |
#error_message ⇒ Object
Returns the value of attribute error_message.
6 7 8 |
# File 'app/filters/api/partner/reviews_filter.rb', line 6 def @error_message end |
Instance Method Details
#build_collections ⇒ Object
get desired reservations from database
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/filters/api/partner/reviews_filter.rb', line 22 def build_collections if filter_params _filter_by_customer_name _filter_by_booking_id _filter_by_date _filter_by_date_range _filter_by_stars _filter_by_package_type _filter_by_specific_package _filter_by_occasion end collections end |
#filter(filter_par) ⇒ Object
16 17 18 19 |
# File 'app/filters/api/partner/reviews_filter.rb', line 16 def filter(filter_par) return unless filter_par.present? config[:filter] = filter_par end |
#to_collections ⇒ Object
37 38 39 |
# File 'app/filters/api/partner/reviews_filter.rb', line 37 def to_collections build_collections.order(created_at: :desc) end |