Class: WooCommerce::ProductVariationsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/woo_commerce/resources/product_variations.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from WooCommerce::Resource

Instance Method Details

#list(product:, **params) ⇒ Object



4
5
6
7
# File 'lib/woo_commerce/resources/product_variations.rb', line 4

def list(product:, **params)
  response = get_request("products/#{product}/variations", params: params)
  Collection.from_response(response, type: ProductVariation)
end

#retrieve(product:, id:) ⇒ Object



9
10
11
# File 'lib/woo_commerce/resources/product_variations.rb', line 9

def retrieve(product:, id:)
  ProductVariation.new get_request("products/#{product}/variations/#{id}").body
end