Class: Query::PartyScopedOrders
- Inherits:
-
Object
- Object
- Query::PartyScopedOrders
- Defined in:
- app/services/query/party_scoped_orders.rb
Overview
Builds the union of orders related to a party, branching on whether the
party is a Customer or a Contact (mirrors Query::PartyScopedOpportunities).
Returns an Order relation usable in further .where/.order calls.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(party) ⇒ PartyScopedOrders
constructor
A new instance of PartyScopedOrders.
Constructor Details
#initialize(party) ⇒ PartyScopedOrders
Returns a new instance of PartyScopedOrders.
12 13 14 |
# File 'app/services/query/party_scoped_orders.rb', line 12 def initialize(party) @party = party end |
Class Method Details
.call(party) ⇒ Object
8 9 10 |
# File 'app/services/query/party_scoped_orders.rb', line 8 def self.call(party) new(party).call end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/services/query/party_scoped_orders.rb', line 16 def call if @party.is_a?(Customer) customer_scope else contact_scope end end |