Class: HelloextendApiClient::ProductsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/helloextend_api_client/api/products_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProductsApi



19
20
21
# File 'lib/helloextend_api_client/api/products_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/helloextend_api_client/api/products_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#stores_store_id_products_post(store_id, opts = {}) ⇒ Product

Create a product

Options Hash (opts):

  • :batch (Boolean)

    Use the value true if passing a batch of products.

  • :upsert (Boolean)

    If true, will update products that already exist.

  • :product (Product)


29
30
31
32
# File 'lib/helloextend_api_client/api/products_api.rb', line 29

def stores_store_id_products_post(store_id, opts = {})
  data, _status_code, _headers = stores_store_id_products_post_with_http_info(store_id, opts)
  data
end

#stores_store_id_products_post_with_http_info(store_id, opts = {}) ⇒ Array<(Product, Integer, Hash)>

Create a product

Options Hash (opts):

  • :batch (Boolean)

    Use the value true if passing a batch of products.

  • :upsert (Boolean)

    If true, will update products that already exist.

  • :product (Product)


41
42
43
44
45
46
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
85
86
87
88
89
90
# File 'lib/helloextend_api_client/api/products_api.rb', line 41

def stores_store_id_products_post_with_http_info(store_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.stores_store_id_products_post ...'
  end
  # verify the required parameter 'store_id' is set
  if @api_client.config.client_side_validation && store_id.nil?
    fail ArgumentError, "Missing the required parameter 'store_id' when calling ProductsApi.stores_store_id_products_post"
  end
  # resource path
  local_var_path = '/stores/{storeId}/products'.sub('{' + 'storeId' + '}', CGI.escape(store_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'batch'] = opts[:'batch'] if !opts[:'batch'].nil?
  query_params[:'upsert'] = opts[:'upsert'] if !opts[:'upsert'].nil?

  # header parameters
  header_params = opts[: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 = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'product']) 

  # return_type
  return_type = opts[:return_type] || 'Product' 

  # auth_names
  auth_names = opts[:auth_names] || ['ExtendAccessToken']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#stores_store_id_products_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#stores_store_id_products_product_id_delete(store_id, product_id, opts = {}) ⇒ nil

Delete a product



97
98
99
100
# File 'lib/helloextend_api_client/api/products_api.rb', line 97

def stores_store_id_products_product_id_delete(store_id, product_id, opts = {})
  stores_store_id_products_product_id_delete_with_http_info(store_id, product_id, opts)
  nil
end

#stores_store_id_products_product_id_delete_with_http_info(store_id, product_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a product



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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/helloextend_api_client/api/products_api.rb', line 107

def stores_store_id_products_product_id_delete_with_http_info(store_id, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.stores_store_id_products_product_id_delete ...'
  end
  # verify the required parameter 'store_id' is set
  if @api_client.config.client_side_validation && store_id.nil?
    fail ArgumentError, "Missing the required parameter 'store_id' when calling ProductsApi.stores_store_id_products_product_id_delete"
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.stores_store_id_products_product_id_delete"
  end
  # resource path
  local_var_path = '/stores/{storeId}/products/{productId}'.sub('{' + 'storeId' + '}', CGI.escape(store_id.to_s)).sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['ExtendAccessToken']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#stores_store_id_products_product_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#stores_store_id_products_product_id_get(store_id, product_id, opts = {}) ⇒ Product

Get a product Returns information about a product



164
165
166
167
# File 'lib/helloextend_api_client/api/products_api.rb', line 164

def stores_store_id_products_product_id_get(store_id, product_id, opts = {})
  data, _status_code, _headers = stores_store_id_products_product_id_get_with_http_info(store_id, product_id, opts)
  data
end

#stores_store_id_products_product_id_get_with_http_info(store_id, product_id, opts = {}) ⇒ Array<(Product, Integer, Hash)>

Get a product Returns information about a product



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/helloextend_api_client/api/products_api.rb', line 175

def stores_store_id_products_product_id_get_with_http_info(store_id, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.stores_store_id_products_product_id_get ...'
  end
  # verify the required parameter 'store_id' is set
  if @api_client.config.client_side_validation && store_id.nil?
    fail ArgumentError, "Missing the required parameter 'store_id' when calling ProductsApi.stores_store_id_products_product_id_get"
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.stores_store_id_products_product_id_get"
  end
  # resource path
  local_var_path = '/stores/{storeId}/products/{productId}'.sub('{' + 'storeId' + '}', CGI.escape(store_id.to_s)).sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Product' 

  # auth_names
  auth_names = opts[:auth_names] || ['ExtendAccessToken']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#stores_store_id_products_product_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#stores_store_id_products_product_id_put(store_id, product_id, opts = {}) ⇒ Product

Update a product When you update a product, you may not update the referenceId.

Options Hash (opts):

  • :unknown_base_type (UNKNOWN_BASE_TYPE)


233
234
235
236
# File 'lib/helloextend_api_client/api/products_api.rb', line 233

def stores_store_id_products_product_id_put(store_id, product_id, opts = {})
  data, _status_code, _headers = stores_store_id_products_product_id_put_with_http_info(store_id, product_id, opts)
  data
end

#stores_store_id_products_product_id_put_with_http_info(store_id, product_id, opts = {}) ⇒ Array<(Product, Integer, Hash)>

Update a product When you update a product, you may not update the referenceId.

Options Hash (opts):

  • :unknown_base_type (UNKNOWN_BASE_TYPE)


245
246
247
248
249
250
251
252
253
254
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
294
295
296
# File 'lib/helloextend_api_client/api/products_api.rb', line 245

def stores_store_id_products_product_id_put_with_http_info(store_id, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.stores_store_id_products_product_id_put ...'
  end
  # verify the required parameter 'store_id' is set
  if @api_client.config.client_side_validation && store_id.nil?
    fail ArgumentError, "Missing the required parameter 'store_id' when calling ProductsApi.stores_store_id_products_product_id_put"
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.stores_store_id_products_product_id_put"
  end
  # resource path
  local_var_path = '/stores/{storeId}/products/{productId}'.sub('{' + 'storeId' + '}', CGI.escape(store_id.to_s)).sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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 = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'unknown_base_type']) 

  # return_type
  return_type = opts[:return_type] || 'Product' 

  # auth_names
  auth_names = opts[:auth_names] || ['ExtendAccessToken']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#stores_store_id_products_product_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end