class HelloextendApiClient::ProductsApi
Attributes
Public Class Methods
# File lib/helloextend_api_client/api/products_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create a product @param store_id [String] Unique identifier for a Store on Extend @param [Hash] opts the optional parameters @option opts [Boolean] :batch Use the value true if passing a batch of products. @option opts [Boolean] :upsert If true, will update products that already exist. @option opts [Product] :product @return [Product]
# 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
Create a product @param store_id [String] Unique identifier for a Store on Extend @param [Hash] opts the optional parameters @option opts [Boolean] :batch Use the value true if passing a batch of products. @option opts [Boolean] :upsert If true, will update products that already exist. @option opts [Product] :product @return [Array<(Product
, Integer, Hash)>] Product
data, response status code and response headers
# 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
Delete a product @param store_id [String] Unique identifier for a Store on Extend @param product_id [String] The unique referenceId passed to extend when creating a product. @param [Hash] opts the optional parameters @return [nil]
# 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
Delete a product @param store_id [String] Unique identifier for a Store on Extend @param product_id [String] The unique referenceId passed to extend when creating a product. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# 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
Get a product Returns information about a product @param store_id [String] Unique identifier for a Store on Extend @param product_id [String] The unique referenceId passed to extend when creating a product. @param [Hash] opts the optional parameters @return [Product]
# 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
Get a product Returns information about a product @param store_id [String] Unique identifier for a Store on Extend @param product_id [String] The unique referenceId passed to extend when creating a product. @param [Hash] opts the optional parameters @return [Array<(Product
, Integer, Hash)>] Product
data, response status code and response headers
# 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
Update a product When you update a product, you may not update the referenceId. @param store_id [String] Unique identifier for a Store on Extend @param product_id [String] The unique referenceId passed to extend when creating a product. @param [Hash] opts the optional parameters @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type @return [Product]
# 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
Update a product When you update a product, you may not update the referenceId. @param store_id [String] Unique identifier for a Store on Extend @param product_id [String] The unique referenceId passed to extend when creating a product. @param [Hash] opts the optional parameters @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type @return [Array<(Product
, Integer, Hash)>] Product
data, response status code and response headers
# 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