Class: Dodopayments::Resources::Products
- Inherits:
-
Object
- Object
- Dodopayments::Resources::Products
show all
- Defined in:
- lib/dodopayments/resources/products.rb,
lib/dodopayments/resources/products/images.rb,
lib/dodopayments/resources/products/short_links.rb,
lib/dodopayments/resources/products/localized_prices.rb
Defined Under Namespace
Classes: Images, LocalizedPrices, ShortLinks
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#archive(id, request_options: {}) ⇒ nil
-
#create(name:, price:, tax_category:, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, entitlements: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, pricing_mode: nil, request_options: {}) ⇒ Dodopayments::Models::Product
-
#initialize(client:) ⇒ Products
constructor
private
A new instance of Products.
-
#list(archived: nil, brand_id: nil, page_number: nil, page_size: nil, recurring: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::ProductListResponse>
-
#retrieve(id, request_options: {}) ⇒ Dodopayments::Models::Product
-
#unarchive(id, request_options: {}) ⇒ nil
-
#update(id, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, entitlements: nil, image_id: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, name: nil, price: nil, pricing_mode: nil, tax_category: nil, request_options: {}) ⇒ nil
-
#update_files(id, file_name:, request_options: {}) ⇒ Dodopayments::Models::ProductUpdateFilesResponse
Constructor Details
#initialize(client:) ⇒ Products
This method is part of a private API.
You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Products.
Instance Attribute Details
7
8
9
|
# File 'lib/dodopayments/resources/products.rb', line 7
def images
@images
end
|
13
14
15
|
# File 'lib/dodopayments/resources/products.rb', line 13
def localized_prices
@localized_prices
end
|
10
11
12
|
# File 'lib/dodopayments/resources/products.rb', line 10
def short_links
@short_links
end
|
Instance Method Details
#archive(id, request_options: {}) ⇒ nil
181
182
183
184
185
186
187
188
|
# File 'lib/dodopayments/resources/products.rb', line 181
def archive(id, params = {})
@client.request(
method: :delete,
path: ["products/%1$s", id],
model: NilClass,
options: params[:request_options]
)
end
|
#create(name:, price:, tax_category:, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, entitlements: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, pricing_mode: nil, request_options: {}) ⇒ Dodopayments::Models::Product
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/dodopayments/resources/products.rb', line 55
def create(params)
parsed, options = Dodopayments::ProductCreateParams.dump_request(params)
@client.request(
method: :post,
path: "products",
body: parsed,
model: Dodopayments::Product,
options: options
)
end
|
75
76
77
78
79
80
81
82
|
# File 'lib/dodopayments/resources/products.rb', line 75
def retrieve(id, params = {})
@client.request(
method: :get,
path: ["products/%1$s", id],
model: Dodopayments::Product,
options: params[:request_options]
)
end
|
#unarchive(id, request_options: {}) ⇒ nil
199
200
201
202
203
204
205
206
|
# File 'lib/dodopayments/resources/products.rb', line 199
def unarchive(id, params = {})
@client.request(
method: :post,
path: ["products/%1$s/unarchive", id],
model: NilClass,
options: params[:request_options]
)
end
|
#update(id, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, entitlements: nil, image_id: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, name: nil, price: nil, pricing_mode: nil, tax_category: nil, request_options: {}) ⇒ nil
128
129
130
131
132
133
134
135
136
137
|
# File 'lib/dodopayments/resources/products.rb', line 128
def update(id, params = {})
parsed, options = Dodopayments::ProductUpdateParams.dump_request(params)
@client.request(
method: :patch,
path: ["products/%1$s", id],
body: parsed,
model: NilClass,
options: options
)
end
|