Module: PaymentKit::Resources::Catalog

Included in:
Client
Defined in:
lib/payment_kit/resources/catalog.rb

Overview

Products and prices.

Instance Method Summary collapse

Instance Method Details

#create_price(params = nil) ⇒ Object

POST /prices/ — takes product_id, currency, unit_amount_atom, pricing_type, billing_scheme, recurring_interval and friends.



33
# File 'lib/payment_kit/resources/catalog.rb', line 33

def create_price(params = nil, **) = post("/prices/", params, **)

#create_product(params = nil) ⇒ Object

POST /products/ — takes name, description, is_active, default_price_id, metadata, custom_fields.



15
# File 'lib/payment_kit/resources/catalog.rb', line 15

def create_product(params = nil, **) = post("/products/", params, **)

#list_prices(params = {}) ⇒ Object

GET /prices/ — auto-paginated Array of prices.



26
# File 'lib/payment_kit/resources/catalog.rb', line 26

def list_prices(params = {}) = list("/prices/", params)

#list_product_prices(product_id, params = {}) ⇒ Object

GET /products/id/prices — auto-paginated Array of the product's prices.



21
22
23
# File 'lib/payment_kit/resources/catalog.rb', line 21

def list_product_prices(product_id, params = {})
  list("/products/#{product_id}/prices", params)
end

#list_products(params = {}) ⇒ Object

GET /products/ — auto-paginated Array of products.



8
# File 'lib/payment_kit/resources/catalog.rb', line 8

def list_products(params = {}) = list("/products/", params)

#retrieve_price(id, params = {}) ⇒ Object

GET /prices/id



29
# File 'lib/payment_kit/resources/catalog.rb', line 29

def retrieve_price(id, params = {}) = get("/prices/#{id}", params)

#retrieve_product(id) ⇒ Object

GET /products/id



11
# File 'lib/payment_kit/resources/catalog.rb', line 11

def retrieve_product(id) = get("/products/#{id}")

#update_product(id, params = nil) ⇒ Object

PATCH /products/id — only the fields you send are changed.



18
# File 'lib/payment_kit/resources/catalog.rb', line 18

def update_product(id, params = nil, **) = patch("/products/#{id}", params, **)