Class: SpreeClient::API::V1::Products
- Defined in:
- lib/spree_client/api/v1/products.rb
Overview
Products
Constant Summary collapse
- ENDPOINT =
'/api/v1/products'
- RESOURCE =
SpreeClient::Models::Product
- NAME =
'product'
Instance Attribute Summary
Attributes inherited from Resources
#api, #default_args, #response
Instance Method Summary collapse
Methods inherited from Resources
#create, #delete, #index, #initialize, #new, #show, #update
Constructor Details
This class inherits a constructor from SpreeClient::API::V1::Resources
Instance Method Details
#variants(**args) ⇒ SpreeClient::API::V1::Variants
12 13 14 15 16 17 18 19 |
# File 'lib/spree_client/api/v1/products.rb', line 12 def variants(**args) product_id = default_args.dig(:id) || args.dig(:product_id) raise ArgumentError, 'Needs a product ID' unless product_id @variants ||= {} @variants[product_id.to_s.to_sym] ||= Variants.new **{ api: api, product_id: product_id }.merge(args) end |