Class: SpreeCmCommissioner::VendorStopPlaceQuery
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::VendorStopPlaceQuery
- Defined in:
- app/queries/spree_cm_commissioner/vendor_stop_place_query.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#reference_stop_id ⇒ Object
readonly
Returns the value of attribute reference_stop_id.
-
#stop_type ⇒ Object
readonly
Returns the value of attribute stop_type.
-
#vendor_id ⇒ Object
readonly
Returns the value of attribute vendor_id.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(query:, vendor_id:, stop_type: :boarding, reference_stop_id: nil) ⇒ VendorStopPlaceQuery
constructor
A new instance of VendorStopPlaceQuery.
Constructor Details
#initialize(query:, vendor_id:, stop_type: :boarding, reference_stop_id: nil) ⇒ VendorStopPlaceQuery
Returns a new instance of VendorStopPlaceQuery.
5 6 7 8 9 10 |
# File 'app/queries/spree_cm_commissioner/vendor_stop_place_query.rb', line 5 def initialize(query:, vendor_id:, stop_type: :boarding, reference_stop_id: nil) @query = query.to_s.strip @vendor_id = vendor_id @stop_type = stop_type @reference_stop_id = reference_stop_id end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
3 4 5 |
# File 'app/queries/spree_cm_commissioner/vendor_stop_place_query.rb', line 3 def query @query end |
#reference_stop_id ⇒ Object (readonly)
Returns the value of attribute reference_stop_id.
3 4 5 |
# File 'app/queries/spree_cm_commissioner/vendor_stop_place_query.rb', line 3 def reference_stop_id @reference_stop_id end |
#stop_type ⇒ Object (readonly)
Returns the value of attribute stop_type.
3 4 5 |
# File 'app/queries/spree_cm_commissioner/vendor_stop_place_query.rb', line 3 def stop_type @stop_type end |
#vendor_id ⇒ Object (readonly)
Returns the value of attribute vendor_id.
3 4 5 |
# File 'app/queries/spree_cm_commissioner/vendor_stop_place_query.rb', line 3 def vendor_id @vendor_id end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/queries/spree_cm_commissioner/vendor_stop_place_query.rb', line 12 def call results = vendor_stops return [] if results.empty? places = results.includes(:stop).map(&:stop).compact.uniq format_places(places) end |