Class: SolidusGraphqlApi::Queries::ProductsQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_graphql_api/queries/products_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user:, pricing_options:) ⇒ ProductsQuery

Returns a new instance of ProductsQuery.



8
9
10
11
# File 'lib/solidus_graphql_api/queries/products_query.rb', line 8

def initialize(user:, pricing_options:)
  @user = user
  @pricing_options = pricing_options
end

Instance Attribute Details

#pricing_optionsObject (readonly)

Returns the value of attribute pricing_options.



6
7
8
# File 'lib/solidus_graphql_api/queries/products_query.rb', line 6

def pricing_options
  @pricing_options
end

#userObject (readonly)

Returns the value of attribute user.



6
7
8
# File 'lib/solidus_graphql_api/queries/products_query.rb', line 6

def user
  @user
end

Instance Method Details

#call(query: {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/solidus_graphql_api/queries/products_query.rb', line 13

def call(query: {})
  Spree::Config.searcher_class.new(build_query(query)).tap do |searcher|
    searcher.current_user = user
    searcher.pricing_options = pricing_options
  end.retrieve_products.except(:limit, :offset)
end