Class: Dodopayments::Resources::ProductCollections
- Inherits:
-
Object
- Object
- Dodopayments::Resources::ProductCollections
- Defined in:
- lib/dodopayments/resources/product_collections.rb,
lib/dodopayments/resources/product_collections/groups.rb,
lib/dodopayments/resources/product_collections/groups/items.rb
Defined Under Namespace
Classes: Groups
Instance Attribute Summary collapse
Instance Method Summary collapse
- #create(groups:, name:, brand_id: nil, description: nil, request_options: {}) ⇒ Dodopayments::Models::ProductCollection
- #delete(id, request_options: {}) ⇒ nil
-
#initialize(client:) ⇒ ProductCollections
constructor
private
A new instance of ProductCollections.
- #list(archived: nil, brand_id: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::ProductCollectionListResponse>
- #retrieve(id, request_options: {}) ⇒ Dodopayments::Models::ProductCollection
- #unarchive(id, request_options: {}) ⇒ Dodopayments::Models::ProductCollectionUnarchiveResponse
- #update(id, brand_id: nil, description: nil, group_order: nil, image_id: nil, name: nil, request_options: {}) ⇒ nil
- #update_images(id, force_update: nil, request_options: {}) ⇒ Dodopayments::Models::ProductCollectionUpdateImagesResponse
Constructor Details
#initialize(client:) ⇒ ProductCollections
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 ProductCollections.
173 174 175 176 |
# File 'lib/dodopayments/resources/product_collections.rb', line 173 def initialize(client:) @client = client @groups = Dodopayments::Resources::ProductCollections::Groups.new(client: client) end |
Instance Attribute Details
#groups ⇒ Dodopayments::Resources::ProductCollections::Groups (readonly)
7 8 9 |
# File 'lib/dodopayments/resources/product_collections.rb', line 7 def groups @groups end |
Instance Method Details
#create(groups:, name:, brand_id: nil, description: nil, request_options: {}) ⇒ Dodopayments::Models::ProductCollection
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dodopayments/resources/product_collections.rb', line 24 def create(params) parsed, = Dodopayments::ProductCollectionCreateParams.dump_request(params) @client.request( method: :post, path: "product-collections", body: parsed, model: Dodopayments::ProductCollection, options: ) end |
#delete(id, request_options: {}) ⇒ nil
120 121 122 123 124 125 126 127 |
# File 'lib/dodopayments/resources/product_collections.rb', line 120 def delete(id, params = {}) @client.request( method: :delete, path: ["product-collections/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#list(archived: nil, brand_id: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::ProductCollectionListResponse>
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/dodopayments/resources/product_collections.rb', line 98 def list(params = {}) parsed, = Dodopayments::ProductCollectionListParams.dump_request(params) query = Dodopayments::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "product-collections", query: query, page: Dodopayments::Internal::DefaultPageNumberPagination, model: Dodopayments::Models::ProductCollectionListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ Dodopayments::Models::ProductCollection
44 45 46 47 48 49 50 51 |
# File 'lib/dodopayments/resources/product_collections.rb', line 44 def retrieve(id, params = {}) @client.request( method: :get, path: ["product-collections/%1$s", id], model: Dodopayments::ProductCollection, options: params[:request_options] ) end |
#unarchive(id, request_options: {}) ⇒ Dodopayments::Models::ProductCollectionUnarchiveResponse
138 139 140 141 142 143 144 145 |
# File 'lib/dodopayments/resources/product_collections.rb', line 138 def unarchive(id, params = {}) @client.request( method: :post, path: ["product-collections/%1$s/unarchive", id], model: Dodopayments::Models::ProductCollectionUnarchiveResponse, options: params[:request_options] ) end |
#update(id, brand_id: nil, description: nil, group_order: nil, image_id: nil, name: nil, request_options: {}) ⇒ nil
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/dodopayments/resources/product_collections.rb', line 72 def update(id, params = {}) parsed, = Dodopayments::ProductCollectionUpdateParams.dump_request(params) @client.request( method: :patch, path: ["product-collections/%1$s", id], body: parsed, model: NilClass, options: ) end |
#update_images(id, force_update: nil, request_options: {}) ⇒ Dodopayments::Models::ProductCollectionUpdateImagesResponse
158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/dodopayments/resources/product_collections.rb', line 158 def update_images(id, params = {}) parsed, = Dodopayments::ProductCollectionUpdateImagesParams.dump_request(params) query = Dodopayments::Internal::Util.encode_query_params(parsed) @client.request( method: :put, path: ["product-collections/%1$s/images", id], query: query, model: Dodopayments::Models::ProductCollectionUpdateImagesResponse, options: ) end |