Class: BrevoRuby::EcommerceApi

Inherits:
Object
  • Object
show all
Defined in:
lib/brevo-ruby/api/ecommerce_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EcommerceApi

Returns a new instance of EcommerceApi.



19
20
21
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_batch_order(order_batch, opts = {}) ⇒ nil

Create orders in batch Create multiple orders at one time instead of one order at a time

Parameters:

  • order_batch
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


37
38
39
40
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 37

def create_batch_order(order_batch, opts = {})
  create_batch_order_with_http_info(order_batch, opts)
  nil
end

#create_batch_order_with_http_info(order_batch, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create orders in batch Create multiple orders at one time instead of one order at a time

Parameters:

  • order_batch
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 47

def create_batch_order_with_http_info(order_batch, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.create_batch_order ...'
  end
  # verify the required parameter 'order_batch' is set
  if @api_client.config.client_side_validation && order_batch.nil?
    fail ArgumentError, "Missing the required parameter 'order_batch' when calling EcommerceApi.create_batch_order"
  end
  # resource path
  local_var_path = '/orders/status/batch'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(order_batch)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#create_batch_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_order(order, opts = {}) ⇒ nil

Managing the status of the order Manages the transactional status of the order

Parameters:

  • order
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


90
91
92
93
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 90

def create_order(order, opts = {})
  create_order_with_http_info(order, opts)
  nil
end

#create_order_with_http_info(order, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Managing the status of the order Manages the transactional status of the order

Parameters:

  • order
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 100

def create_order_with_http_info(order, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.create_order ...'
  end
  # verify the required parameter 'order' is set
  if @api_client.config.client_side_validation && order.nil?
    fail ArgumentError, "Missing the required parameter 'order' when calling EcommerceApi.create_order"
  end
  # resource path
  local_var_path = '/orders/status'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(order)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#create_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_update_batch_category(create_update_batch_category, opts = {}) ⇒ CreateUpdateBatchCategoryModel

Create categories in batch

Parameters:

  • create_update_batch_category

    Values to create a batch of categories

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



142
143
144
145
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 142

def create_update_batch_category(create_update_batch_category, opts = {})
  data, _status_code, _headers = create_update_batch_category_with_http_info(create_update_batch_category, opts)
  data
end

#create_update_batch_category_with_http_info(create_update_batch_category, opts = {}) ⇒ Array<(CreateUpdateBatchCategoryModel, Fixnum, Hash)>

Create categories in batch

Parameters:

  • create_update_batch_category

    Values to create a batch of categories

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 151

def create_update_batch_category_with_http_info(create_update_batch_category, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.create_update_batch_category ...'
  end
  # verify the required parameter 'create_update_batch_category' is set
  if @api_client.config.client_side_validation && create_update_batch_category.nil?
    fail ArgumentError, "Missing the required parameter 'create_update_batch_category' when calling EcommerceApi.create_update_batch_category"
  end
  # resource path
  local_var_path = '/categories/batch'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_update_batch_category)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CreateUpdateBatchCategoryModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#create_update_batch_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_update_batch_products(create_update_batch_products, opts = {}) ⇒ CreateUpdateBatchProductsModel

Create products in batch

Parameters:

  • create_update_batch_products

    Values to create a batch of products

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



194
195
196
197
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 194

def create_update_batch_products(create_update_batch_products, opts = {})
  data, _status_code, _headers = create_update_batch_products_with_http_info(create_update_batch_products, opts)
  data
end

#create_update_batch_products_with_http_info(create_update_batch_products, opts = {}) ⇒ Array<(CreateUpdateBatchProductsModel, Fixnum, Hash)>

Create products in batch

Parameters:

  • create_update_batch_products

    Values to create a batch of products

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 203

def create_update_batch_products_with_http_info(create_update_batch_products, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.create_update_batch_products ...'
  end
  # verify the required parameter 'create_update_batch_products' is set
  if @api_client.config.client_side_validation && create_update_batch_products.nil?
    fail ArgumentError, "Missing the required parameter 'create_update_batch_products' when calling EcommerceApi.create_update_batch_products"
  end
  # resource path
  local_var_path = '/products/batch'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_update_batch_products)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CreateUpdateBatchProductsModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#create_update_batch_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_update_category(create_update_category, opts = {}) ⇒ CreateCategoryModel

Create/Update a category

Parameters:

  • create_update_category

    Values to create/update a category

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



246
247
248
249
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 246

def create_update_category(create_update_category, opts = {})
  data, _status_code, _headers = create_update_category_with_http_info(create_update_category, opts)
  data
end

#create_update_category_with_http_info(create_update_category, opts = {}) ⇒ Array<(CreateCategoryModel, Fixnum, Hash)>

Create/Update a category

Parameters:

  • create_update_category

    Values to create/update a category

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CreateCategoryModel, Fixnum, Hash)>)

    CreateCategoryModel data, response status code and response headers



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 255

def create_update_category_with_http_info(create_update_category, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.create_update_category ...'
  end
  # verify the required parameter 'create_update_category' is set
  if @api_client.config.client_side_validation && create_update_category.nil?
    fail ArgumentError, "Missing the required parameter 'create_update_category' when calling EcommerceApi.create_update_category"
  end
  # resource path
  local_var_path = '/categories'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_update_category)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CreateCategoryModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#create_update_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_update_product(create_update_product, opts = {}) ⇒ CreateProductModel

Create/Update a product

Parameters:

  • create_update_product

    Values to create/update a product

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



298
299
300
301
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 298

def create_update_product(create_update_product, opts = {})
  data, _status_code, _headers = create_update_product_with_http_info(create_update_product, opts)
  data
end

#create_update_product_with_http_info(create_update_product, opts = {}) ⇒ Array<(CreateProductModel, Fixnum, Hash)>

Create/Update a product

Parameters:

  • create_update_product

    Values to create/update a product

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CreateProductModel, Fixnum, Hash)>)

    CreateProductModel data, response status code and response headers



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 307

def create_update_product_with_http_info(create_update_product, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.create_update_product ...'
  end
  # verify the required parameter 'create_update_product' is set
  if @api_client.config.client_side_validation && create_update_product.nil?
    fail ArgumentError, "Missing the required parameter 'create_update_product' when calling EcommerceApi.create_update_product"
  end
  # resource path
  local_var_path = '/products'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_update_product)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CreateProductModel')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#create_update_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#ecommerce_activate_post(opts = {}) ⇒ nil

Activate the eCommerce app Getting access to Brevo eCommerce.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


350
351
352
353
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 350

def ecommerce_activate_post(opts = {})
  ecommerce_activate_post_with_http_info(opts)
  nil
end

#ecommerce_activate_post_with_http_info(opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Activate the eCommerce app Getting access to Brevo eCommerce.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 359

def ecommerce_activate_post_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.ecommerce_activate_post ...'
  end
  # resource path
  local_var_path = '/ecommerce/activate'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#ecommerce_activate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_categories(opts = {}) ⇒ GetCategories

Return all your categories

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page (default to 50)

  • :offset (Integer)

    Index of the first document in the page (default to 0)

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc)

  • :ids (Array<String>)

    Filter by category ids

  • :name (String)

    Filter by category name

Returns:



401
402
403
404
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 401

def get_categories(opts = {})
  data, _status_code, _headers = get_categories_with_http_info(opts)
  data
end

#get_categories_with_http_info(opts = {}) ⇒ Array<(GetCategories, Fixnum, Hash)>

Return all your categories

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document in the page

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed

  • :ids (Array<String>)

    Filter by category ids

  • :name (String)

    Filter by category name

Returns:

  • (Array<(GetCategories, Fixnum, Hash)>)

    GetCategories data, response status code and response headers



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 414

def get_categories_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.get_categories ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EcommerceApi.get_categories, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/categories'

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'ids'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetCategories')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#get_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_category_info(id, opts = {}) ⇒ GetCategoryDetails

Get a category details

Parameters:

  • id

    Category ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



465
466
467
468
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 465

def get_category_info(id, opts = {})
  data, _status_code, _headers = get_category_info_with_http_info(id, opts)
  data
end

#get_category_info_with_http_info(id, opts = {}) ⇒ Array<(GetCategoryDetails, Fixnum, Hash)>

Get a category details

Parameters:

  • id

    Category ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetCategoryDetails, Fixnum, Hash)>)

    GetCategoryDetails data, response status code and response headers



474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 474

def get_category_info_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.get_category_info ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling EcommerceApi.get_category_info"
  end
  # resource path
  local_var_path = '/categories/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetCategoryDetails')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#get_category_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_product_info(id, opts = {}) ⇒ GetProductDetails

Get a product’s details

Parameters:

  • id

    Product ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



517
518
519
520
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 517

def get_product_info(id, opts = {})
  data, _status_code, _headers = get_product_info_with_http_info(id, opts)
  data
end

#get_product_info_with_http_info(id, opts = {}) ⇒ Array<(GetProductDetails, Fixnum, Hash)>

Get a product&#39;s details

Parameters:

  • id

    Product ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetProductDetails, Fixnum, Hash)>)

    GetProductDetails data, response status code and response headers



526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 526

def get_product_info_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.get_product_info ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling EcommerceApi.get_product_info"
  end
  # resource path
  local_var_path = '/products/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetProductDetails')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#get_product_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_products(opts = {}) ⇒ GetProducts

Return all your products

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page (default to 50)

  • :offset (Integer)

    Index of the first document in the page (default to 0)

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc)

  • :ids (Array<String>)

    Filter by product ids

  • :name (String)

    Filter by product name, minimum 3 characters should be present for search

  • :price_lte (Float)

    Price filter for products less than and equals to particular amount

  • :price_gte (Float)

    Price filter for products greater than and equals to particular amount

  • :price_lt (Float)

    Price filter for products less than particular amount

  • :price_gt (Float)

    Price filter for products greater than particular amount

  • :price_eq (Float)

    Price filter for products equals to particular amount

  • :price_ne (Float)

    Price filter for products not equals to particular amount

  • :categories (Array<String>)

    Filter by category ids

Returns:



580
581
582
583
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 580

def get_products(opts = {})
  data, _status_code, _headers = get_products_with_http_info(opts)
  data
end

#get_products_with_http_info(opts = {}) ⇒ Array<(GetProducts, Fixnum, Hash)>

Return all your products

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document in the page

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed

  • :ids (Array<String>)

    Filter by product ids

  • :name (String)

    Filter by product name, minimum 3 characters should be present for search

  • :price_lte (Float)

    Price filter for products less than and equals to particular amount

  • :price_gte (Float)

    Price filter for products greater than and equals to particular amount

  • :price_lt (Float)

    Price filter for products less than particular amount

  • :price_gt (Float)

    Price filter for products greater than particular amount

  • :price_eq (Float)

    Price filter for products equals to particular amount

  • :price_ne (Float)

    Price filter for products not equals to particular amount

  • :categories (Array<String>)

    Filter by category ids

Returns:

  • (Array<(GetProducts, Fixnum, Hash)>)

    GetProducts data, response status code and response headers



600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 600

def get_products_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EcommerceApi.get_products ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EcommerceApi.get_products, must be smaller than or equal to 1000.'
  end

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  # resource path
  local_var_path = '/products'

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'ids'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'price[lte]'] = opts[:'price_lte'] if !opts[:'price_lte'].nil?
  query_params[:'price[gte]'] = opts[:'price_gte'] if !opts[:'price_gte'].nil?
  query_params[:'price[lt]'] = opts[:'price_lt'] if !opts[:'price_lt'].nil?
  query_params[:'price[gt]'] = opts[:'price_gt'] if !opts[:'price_gt'].nil?
  query_params[:'price[eq]'] = opts[:'price_eq'] if !opts[:'price_eq'].nil?
  query_params[:'price[ne]'] = opts[:'price_ne'] if !opts[:'price_ne'].nil?
  query_params[:'categories'] = @api_client.build_collection_param(opts[:'categories'], :csv) if !opts[:'categories'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetProducts')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EcommerceApi#get_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#setUserAgent(user_agent) ⇒ Object

Set custom user_agent if explicitly passed in api default will still remain Swagger-Codegen/#VERSION/ruby



25
26
27
28
29
30
# File 'lib/brevo-ruby/api/ecommerce_api.rb', line 25

def setUserAgent(user_agent)
  @user_agent = user_agent
  if user_agent.is_a?(String) && user_agent.downcase.start_with?('brevo_')
    @api_client.default_headers['User-Agent'] = @user_agent
  end
end