Class: HighLevel::Resources::Products

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/products.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#bulk_edit(body:, **_opts) ⇒ Object

Bulk Edit Products and Prices

API to bulk edit products and their associated prices (max 30 entities)



24
25
26
27
28
29
30
31
# File 'lib/high_level/resources/products.rb', line 24

def bulk_edit(body:, **_opts)
  request(
    method: :post,
    path: "/products/bulk-update/edit",
    security: [],
    body: body
  )
end

#bulk_update(body:, **_opts) ⇒ Object

Bulk Update Products

API to bulk update products (price, availability, collections, delete)



12
13
14
15
16
17
18
19
# File 'lib/high_level/resources/products.rb', line 12

def bulk_update(body:, **_opts)
  request(
    method: :post,
    path: "/products/bulk-update",
    security: ["Location-Access"],
    body: body
  )
end

#bulk_update_product_review(body:, **_opts) ⇒ Object

Update Product Reviews

Update one or multiple product reviews: status, reply, etc.



262
263
264
265
266
267
268
269
# File 'lib/high_level/resources/products.rb', line 262

def bulk_update_product_review(body:, **_opts)
  request(
    method: :post,
    path: "/products/reviews/bulk-update",
    security: ["Location-Access"],
    body: body
  )
end

#create_price_for_product(product_id:, body:, **_opts) ⇒ Object

Create Price for a Product

The “Create Price for a Product” API allows adding a new price associated with a specific product to the system. Use this endpoint to create a price with the specified details for a particular product. Ensure that the required information is provided in the request payload.



48
49
50
51
52
53
54
55
# File 'lib/high_level/resources/products.rb', line 48

def create_price_for_product(product_id:, body:, **_opts)
  request(
    method: :post,
    path: "/products/#{product_id}/price",
    security: %w[Location-Access Agency-Access],
    body: body
  )
end

#create_product(body:, **_opts) ⇒ Object

Create Product

The “Create Product” API allows adding a new product to the system. Use this endpoint to create a product with the specified details. Ensure that the required information is provided in the request payload.



322
323
324
325
326
327
328
329
# File 'lib/high_level/resources/products.rb', line 322

def create_product(body:, **_opts)
  request(
    method: :post,
    path: "/products/",
    security: %w[Location-Access Agency-Access],
    body: body
  )
end

#create_product_collection(body:, **_opts) ⇒ Object

Create Product Collection

Create a new Product Collection for a specific location



168
169
170
171
172
173
174
175
# File 'lib/high_level/resources/products.rb', line 168

def create_product_collection(body:, **_opts)
  request(
    method: :post,
    path: "/products/collections",
    security: ["Location-Access"],
    body: body
  )
end

#delete_price_by_id_for_product(product_id:, price_id:, location_id: nil, **_opts) ⇒ Object

Delete Price by ID for a Product

The “Delete Price by ID for a Product” API allows deleting a specific price associated with a particular product using its unique identifier. Use this endpoint to remove a price from the system.



108
109
110
111
112
113
114
115
# File 'lib/high_level/resources/products.rb', line 108

def delete_price_by_id_for_product(product_id:, price_id:, location_id: nil, **_opts)
  request(
    method: :delete,
    path: "/products/#{product_id}/price/#{price_id}",
    security: %w[Location-Access Agency-Access],
    params: { "locationId" => location_id }.compact
  )
end

#delete_product_by_id(product_id:, location_id: nil, send_wishlist_status: nil, **_opts) ⇒ Object

Delete Product by ID

The “Delete Product by ID” API allows deleting a specific product using its unique identifier. Use this endpoint to remove a product from the system.



298
299
300
301
302
303
304
305
# File 'lib/high_level/resources/products.rb', line 298

def delete_product_by_id(product_id:, location_id: nil, send_wishlist_status: nil, **_opts)
  request(
    method: :delete,
    path: "/products/#{product_id}",
    security: %w[Location-Access Agency-Access],
    params: { "locationId" => location_id, "sendWishlistStatus" => send_wishlist_status }.compact
  )
end

#delete_product_collection(collection_id:, alt_id: nil, alt_type: nil, **_opts) ⇒ Object

Delete Product Collection

Delete specific product collection with Id :collectionId



202
203
204
205
206
207
208
209
# File 'lib/high_level/resources/products.rb', line 202

def delete_product_collection(collection_id:, alt_id: nil, alt_type: nil, **_opts)
  request(
    method: :delete,
    path: "/products/collections/#{collection_id}",
    security: ["Location-Access"],
    params: { "altId" => alt_id, "altType" => alt_type }.compact
  )
end

#delete_product_review(review_id:, alt_id: nil, alt_type: nil, product_id: nil, **_opts) ⇒ Object

Delete Product Review

Delete specific product review



250
251
252
253
254
255
256
257
# File 'lib/high_level/resources/products.rb', line 250

def delete_product_review(review_id:, alt_id: nil, alt_type: nil, product_id: nil, **_opts)
  request(
    method: :delete,
    path: "/products/reviews/#{review_id}",
    security: ["Location-Access"],
    params: { "altId" => alt_id, "altType" => alt_type, "productId" => product_id }.compact
  )
end

#get_list_inventory(limit: nil, offset: nil, alt_id: nil, alt_type: nil, search: nil, **_opts) ⇒ Object

List Inventory

The “List Inventory API allows the user to retrieve a paginated list of inventory items. Use this endpoint to fetch details for multiple items in the inventory based on the provided query parameters.



60
61
62
63
64
65
66
67
# File 'lib/high_level/resources/products.rb', line 60

def get_list_inventory(limit: nil, offset: nil, alt_id: nil, alt_type: nil, search: nil, **_opts)
  request(
    method: :get,
    path: "/products/inventory",
    security: %w[Location-Access Agency-Access],
    params: { "limit" => limit, "offset" => offset, "altId" => alt_id, "altType" => alt_type, "search" => search }.compact
  )
end

#get_price_by_id_for_product(product_id:, price_id:, location_id: nil, **_opts) ⇒ Object

Get Price by ID for a Product

The “Get Price by ID for a Product” API allows retrieving information for a specific price associated with a particular product using its unique identifier. Use this endpoint to fetch details for a single price based on the provided price ID and product ID.



84
85
86
87
88
89
90
91
# File 'lib/high_level/resources/products.rb', line 84

def get_price_by_id_for_product(product_id:, price_id:, location_id: nil, **_opts)
  request(
    method: :get,
    path: "/products/#{product_id}/price/#{price_id}",
    security: %w[Location-Access Agency-Access],
    params: { "locationId" => location_id }.compact
  )
end

#get_product_by_id(product_id:, location_id: nil, send_wishlist_status: nil, **_opts) ⇒ Object

Get Product by ID

The “Get Product by ID” API allows to retrieve information for a specific product using its unique identifier. Use this endpoint to fetch details for a single product based on the provided product ID.



274
275
276
277
278
279
280
281
# File 'lib/high_level/resources/products.rb', line 274

def get_product_by_id(product_id:, location_id: nil, send_wishlist_status: nil, **_opts)
  request(
    method: :get,
    path: "/products/#{product_id}",
    security: %w[Location-Access Agency-Access],
    params: { "locationId" => location_id, "sendWishlistStatus" => send_wishlist_status }.compact
  )
end

#get_product_collection(limit: nil, offset: nil, alt_id: nil, alt_type: nil, collection_ids: nil, name: nil, **_opts) ⇒ Object

Fetch Product Collections

Internal API to fetch the Product Collections



156
157
158
159
160
161
162
163
# File 'lib/high_level/resources/products.rb', line 156

def get_product_collection(limit: nil, offset: nil, alt_id: nil, alt_type: nil, collection_ids: nil, name: nil, **_opts)
  request(
    method: :get,
    path: "/products/collections",
    security: ["Location-Access"],
    params: { "limit" => limit, "offset" => offset, "altId" => alt_id, "altType" => alt_type, "collectionIds" => collection_ids, "name" => name }.compact
  )
end

#get_product_collection_id(collection_id:, alt_id: nil, **_opts) ⇒ Object

Get Details about individual product collection



178
179
180
181
182
183
184
185
# File 'lib/high_level/resources/products.rb', line 178

def get_product_collection_id(collection_id:, alt_id: nil, **_opts)
  request(
    method: :get,
    path: "/products/collections/#{collection_id}",
    security: ["Location-Access"],
    params: { "altId" => alt_id }.compact
  )
end

#get_product_reviews(alt_id: nil, alt_type: nil, limit: nil, offset: nil, sort_field: nil, sort_order: nil, rating: nil, start_date: nil, end_date: nil, product_id: nil, store_id: nil, **_opts) ⇒ Object

Fetch Product Reviews

API to fetch the Product Reviews



214
215
216
217
218
219
220
221
# File 'lib/high_level/resources/products.rb', line 214

def get_product_reviews(alt_id: nil, alt_type: nil, limit: nil, offset: nil, sort_field: nil, sort_order: nil, rating: nil, start_date: nil, end_date: nil, product_id: nil, store_id: nil, **_opts)
  request(
    method: :get,
    path: "/products/reviews",
    security: ["Location-Access"],
    params: { "altId" => alt_id, "altType" => alt_type, "limit" => limit, "offset" => offset, "sortField" => sort_field, "sortOrder" => sort_order, "rating" => rating, "startDate" => start_date, "endDate" => end_date, "productId" => product_id, "storeId" => store_id }.compact
  )
end

#get_product_store_stats(store_id:, alt_id: nil, alt_type: nil, search: nil, collection_ids: nil, **_opts) ⇒ Object

Fetch Product Store Stats

API to fetch the total number of products, included in the store, and excluded from the store and other stats



120
121
122
123
124
125
126
127
# File 'lib/high_level/resources/products.rb', line 120

def get_product_store_stats(store_id:, alt_id: nil, alt_type: nil, search: nil, collection_ids: nil, **_opts)
  request(
    method: :get,
    path: "/products/store/#{store_id}/stats",
    security: ["Location-Access"],
    params: { "altId" => alt_id, "altType" => alt_type, "search" => search, "collectionIds" => collection_ids }.compact
  )
end

#get_reviews_count(alt_id: nil, alt_type: nil, rating: nil, start_date: nil, end_date: nil, product_id: nil, store_id: nil, **_opts) ⇒ Object

Fetch Review Count as per status

API to fetch the Review Count as per status



226
227
228
229
230
231
232
233
# File 'lib/high_level/resources/products.rb', line 226

def get_reviews_count(alt_id: nil, alt_type: nil, rating: nil, start_date: nil, end_date: nil, product_id: nil, store_id: nil, **_opts)
  request(
    method: :get,
    path: "/products/reviews/count",
    security: ["Location-Access"],
    params: { "altId" => alt_id, "altType" => alt_type, "rating" => rating, "startDate" => start_date, "endDate" => end_date, "productId" => product_id, "storeId" => store_id }.compact
  )
end

#list_invoices(limit: nil, offset: nil, location_id: nil, search: nil, collection_ids: nil, collection_slug: nil, expand: nil, product_ids: nil, store_id: nil, included_in_store: nil, available_in_store: nil, sort_order: nil, **_opts) ⇒ Object

List Products

The “List Products” API allows to retrieve a paginated list of products. Customize your results by filtering products based on name or paginate through the list using the provided query parameters. This endpoint provides a straightforward way to explore and retrieve product information.



310
311
312
313
314
315
316
317
# File 'lib/high_level/resources/products.rb', line 310

def list_invoices(limit: nil, offset: nil, location_id: nil, search: nil, collection_ids: nil, collection_slug: nil, expand: nil, product_ids: nil, store_id: nil, included_in_store: nil, available_in_store: nil, sort_order: nil, **_opts)
  request(
    method: :get,
    path: "/products/",
    security: %w[Location-Access Agency-Access],
    params: { "limit" => limit, "offset" => offset, "locationId" => location_id, "search" => search, "collectionIds" => collection_ids, "collectionSlug" => collection_slug, "expand" => expand, "productIds" => product_ids, "storeId" => store_id, "includedInStore" => included_in_store, "availableInStore" => available_in_store, "sortOrder" => sort_order }.compact
  )
end

#list_prices_for_product(product_id:, limit: nil, offset: nil, location_id: nil, ids: nil, **_opts) ⇒ Object

List Prices for a Product

The “List Prices for a Product” API allows retrieving a paginated list of prices associated with a specific product. Customize your results by filtering prices or paginate through the list using the provided query parameters.



36
37
38
39
40
41
42
43
# File 'lib/high_level/resources/products.rb', line 36

def list_prices_for_product(product_id:, limit: nil, offset: nil, location_id: nil, ids: nil, **_opts)
  request(
    method: :get,
    path: "/products/#{product_id}/price",
    security: %w[Location-Access Agency-Access],
    params: { "limit" => limit, "offset" => offset, "locationId" => location_id, "ids" => ids }.compact
  )
end

#update_display_priority(store_id:, body:, **_opts) ⇒ Object

Update product display priorities in store

API to set the display priority of products in a store



144
145
146
147
148
149
150
151
# File 'lib/high_level/resources/products.rb', line 144

def update_display_priority(store_id:, body:, **_opts)
  request(
    method: :post,
    path: "/products/store/#{store_id}/priority",
    security: ["Location-Access"],
    body: body
  )
end

#update_inventory(body:, **_opts) ⇒ Object

Update Inventory

The Update Inventory API allows the user to bulk update the inventory for multiple items. Use this endpoint to update the available quantity and out-of-stock purchase settings for multiple items in the inventory.



72
73
74
75
76
77
78
79
# File 'lib/high_level/resources/products.rb', line 72

def update_inventory(body:, **_opts)
  request(
    method: :post,
    path: "/products/inventory",
    security: %w[Location-Access Agency-Access],
    body: body
  )
end

#update_price_by_id_for_product(product_id:, price_id:, body:, **_opts) ⇒ Object

Update Price by ID for a Product

The “Update Price by ID for a Product” API allows modifying information for a specific price associated with a particular product using its unique identifier. Use this endpoint to update details for a single price based on the provided price ID and product ID.



96
97
98
99
100
101
102
103
# File 'lib/high_level/resources/products.rb', line 96

def update_price_by_id_for_product(product_id:, price_id:, body:, **_opts)
  request(
    method: :put,
    path: "/products/#{product_id}/price/#{price_id}",
    security: %w[Location-Access Agency-Access],
    body: body
  )
end

#update_product_by_id(product_id:, body:, **_opts) ⇒ Object

Update Product by ID

The “Update Product by ID” API allows modifying information for a specific product using its unique identifier. Use this endpoint to update details for a single product based on the provided product ID.



286
287
288
289
290
291
292
293
# File 'lib/high_level/resources/products.rb', line 286

def update_product_by_id(product_id:, body:, **_opts)
  request(
    method: :put,
    path: "/products/#{product_id}",
    security: %w[Location-Access Agency-Access],
    body: body
  )
end

#update_product_collection(collection_id:, body:, **_opts) ⇒ Object

Update Product Collection

Update a specific product collection with Id :collectionId



190
191
192
193
194
195
196
197
# File 'lib/high_level/resources/products.rb', line 190

def update_product_collection(collection_id:, body:, **_opts)
  request(
    method: :put,
    path: "/products/collections/#{collection_id}",
    security: ["Location-Access"],
    body: body
  )
end

#update_product_review(review_id:, body:, **_opts) ⇒ Object

Update Product Reviews

Update status, reply, etc of a particular review



238
239
240
241
242
243
244
245
# File 'lib/high_level/resources/products.rb', line 238

def update_product_review(review_id:, body:, **_opts)
  request(
    method: :put,
    path: "/products/reviews/#{review_id}",
    security: ["Location-Access"],
    body: body
  )
end

#update_store_status(store_id:, body:, **_opts) ⇒ Object

Action to include/exclude the product in store

API to update the status of products in a particular store



132
133
134
135
136
137
138
139
# File 'lib/high_level/resources/products.rb', line 132

def update_store_status(store_id:, body:, **_opts)
  request(
    method: :post,
    path: "/products/store/#{store_id}",
    security: ["Location-Access"],
    body: body
  )
end