Class: Dodopayments::Resources::Products
- Inherits:
-
Object
- Object
- Dodopayments::Resources::Products
- Defined in:
- lib/dodopayments/resources/products.rb,
lib/dodopayments/resources/products/images.rb,
lib/dodopayments/resources/products/short_links.rb
Defined Under Namespace
Classes: Images, ShortLinks
Instance Attribute Summary collapse
- #images ⇒ Dodopayments::Resources::Products::Images readonly
- #short_links ⇒ Dodopayments::Resources::Products::ShortLinks readonly
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, entitlement_ids: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, request_options: {}) ⇒ Dodopayments::Models::Product
Some parameter documentations has been truncated, see Models::ProductCreateParams for more details.
-
#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>
Some parameter documentations has been truncated, see Models::ProductListParams for more details.
- #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, entitlement_ids: 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, tax_category: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ProductUpdateParams for more details.
- #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.
224 225 226 227 228 |
# File 'lib/dodopayments/resources/products.rb', line 224 def initialize(client:) @client = client @images = Dodopayments::Resources::Products::Images.new(client: client) @short_links = Dodopayments::Resources::Products::ShortLinks.new(client: client) end |
Instance Attribute Details
#images ⇒ Dodopayments::Resources::Products::Images (readonly)
7 8 9 |
# File 'lib/dodopayments/resources/products.rb', line 7 def images @images end |
#short_links ⇒ Dodopayments::Resources::Products::ShortLinks (readonly)
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
173 174 175 176 177 178 179 180 |
# File 'lib/dodopayments/resources/products.rb', line 173 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, entitlement_ids: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, request_options: {}) ⇒ Dodopayments::Models::Product
Some parameter documentations has been truncated, see Models::ProductCreateParams for more details.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/dodopayments/resources/products.rb', line 50 def create(params) parsed, = Dodopayments::ProductCreateParams.dump_request(params) @client.request( method: :post, path: "products", body: parsed, model: Dodopayments::Product, options: ) end |
#list(archived: nil, brand_id: nil, page_number: nil, page_size: nil, recurring: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::ProductListResponse>
Some parameter documentations has been truncated, see Models::ProductListParams for more details.
152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/dodopayments/resources/products.rb', line 152 def list(params = {}) parsed, = Dodopayments::ProductListParams.dump_request(params) query = Dodopayments::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "products", query: query, page: Dodopayments::Internal::DefaultPageNumberPagination, model: Dodopayments::Models::ProductListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ Dodopayments::Models::Product
70 71 72 73 74 75 76 77 |
# File 'lib/dodopayments/resources/products.rb', line 70 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
190 191 192 193 194 195 196 197 |
# File 'lib/dodopayments/resources/products.rb', line 190 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, entitlement_ids: 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, tax_category: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ProductUpdateParams for more details.
121 122 123 124 125 126 127 128 129 130 |
# File 'lib/dodopayments/resources/products.rb', line 121 def update(id, params = {}) parsed, = Dodopayments::ProductUpdateParams.dump_request(params) @client.request( method: :patch, path: ["products/%1$s", id], body: parsed, model: NilClass, options: ) end |
#update_files(id, file_name:, request_options: {}) ⇒ Dodopayments::Models::ProductUpdateFilesResponse
210 211 212 213 214 215 216 217 218 219 |
# File 'lib/dodopayments/resources/products.rb', line 210 def update_files(id, params) parsed, = Dodopayments::ProductUpdateFilesParams.dump_request(params) @client.request( method: :put, path: ["products/%1$s/files", id], body: parsed, model: Dodopayments::Models::ProductUpdateFilesResponse, options: ) end |