Class: SpreeCmCommissioner::MultiLegTripsQuery
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::MultiLegTripsQuery
- Includes:
- Transit::TripHelper
- Defined in:
- app/queries/spree_cm_commissioner/multi_leg_trips_query.rb
Overview
rubocop:disable Metrics/ClassLength
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#destination_id ⇒ Object
readonly
Returns the value of attribute destination_id.
-
#number_of_guests ⇒ Object
readonly
Returns the value of attribute number_of_guests.
-
#origin_id ⇒ Object
readonly
Returns the value of attribute origin_id.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#route_type ⇒ Object
readonly
Returns the value of attribute route_type.
-
#tenant_id ⇒ Object
readonly
Returns the value of attribute tenant_id.
-
#vendor_id ⇒ Object
readonly
Returns the value of attribute vendor_id.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(origin_id:, destination_id:, date:, route_type: nil, vendor_id: nil, tenant_id: nil, number_of_guests: nil, params: {}) ⇒ MultiLegTripsQuery
constructor
rubocop:disable Metrics/ParameterLists.
Methods included from Transit::TripHelper
#minutes_since_midnight, #normalize_date, #parse_date, #parse_time
Constructor Details
#initialize(origin_id:, destination_id:, date:, route_type: nil, vendor_id: nil, tenant_id: nil, number_of_guests: nil, params: {}) ⇒ MultiLegTripsQuery
rubocop:disable Metrics/ParameterLists
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 14 def initialize( # rubocop:disable Metrics/ParameterLists origin_id:, destination_id:, date:, route_type: nil, vendor_id: nil, tenant_id: nil, number_of_guests: nil, params: {} ) @origin_id = origin_id @destination_id = destination_id @date = normalize_date(date) @vendor_id = vendor_id @tenant_id = tenant_id @number_of_guests = number_of_guests || 1 @route_type = route_type @params = params end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
5 6 7 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 5 def date @date end |
#destination_id ⇒ Object (readonly)
Returns the value of attribute destination_id.
5 6 7 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 5 def destination_id @destination_id end |
#number_of_guests ⇒ Object (readonly)
Returns the value of attribute number_of_guests.
5 6 7 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 5 def number_of_guests @number_of_guests end |
#origin_id ⇒ Object (readonly)
Returns the value of attribute origin_id.
5 6 7 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 5 def origin_id @origin_id end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 5 def params @params end |
#route_type ⇒ Object (readonly)
Returns the value of attribute route_type.
5 6 7 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 5 def route_type @route_type end |
#tenant_id ⇒ Object (readonly)
Returns the value of attribute tenant_id.
5 6 7 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 5 def tenant_id @tenant_id end |
#vendor_id ⇒ Object (readonly)
Returns the value of attribute vendor_id.
5 6 7 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 5 def vendor_id @vendor_id end |
Instance Method Details
#call ⇒ Object
35 36 37 38 39 |
# File 'app/queries/spree_cm_commissioner/multi_leg_trips_query.rb', line 35 def call return [] if date.to_date < Date.current fetch_multi_leg_trip_results.uniq(&:id) end |