class VoucherifySdk::ProductCollectionsApi
Attributes
Public Class Methods
# File lib/VoucherifySdk/api/product_collections_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create Product
Collection This method creates a new product collection. @param [Hash] opts the optional parameters @option opts [ProductCollectionsCreateRequestBody] :product_collections_create_request_body @return [ProductCollectionsCreateResponseBody]
# File lib/VoucherifySdk/api/product_collections_api.rb, line 27 def create_product_collection(opts = {}) data, _status_code, _headers = create_product_collection_with_http_info(opts) data end
Delete Product
Collection This method deletes a product collection. @param product_collection_id [String] A unique product collection ID. @param [Hash] opts the optional parameters @return [nil]
# File lib/VoucherifySdk/api/product_collections_api.rb, line 91 def delete_product_collection(product_collection_id, opts = {}) delete_product_collection_with_http_info(product_collection_id, opts) nil end
Get Product
Collection Retrieves the product collection. @param product_collection_id [String] A unique product collection ID. @param [Hash] opts the optional parameters @return [ProductCollectionsGetResponseBody]
# File lib/VoucherifySdk/api/product_collections_api.rb, line 148 def get_product_collection(product_collection_id, opts = {}) data, _status_code, _headers = get_product_collection_with_http_info(product_collection_id, opts) data end
List Product
Collections This method returns a list of product collections. @param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @return [ProductCollectionsListResponseBody]
# File lib/VoucherifySdk/api/product_collections_api.rb, line 209 def list_product_collections(opts = {}) data, _status_code, _headers = list_product_collections_with_http_info(opts) data end
List Products in Collection Retrieves list of products from a product collection; works for both dynamic and static product collections. @param product_collection_id [String] Unique product collection ID. @param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [Time] :starting_after Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. @return [ProductCollectionsProductsListResponseBody]
# File lib/VoucherifySdk/api/product_collections_api.rb, line 277 def list_products_in_collection(product_collection_id, opts = {}) data, _status_code, _headers = list_products_in_collection_with_http_info(product_collection_id, opts) data end
Private Instance Methods
Create Product
Collection This method creates a new product collection. @param [Hash] opts the optional parameters @option opts [ProductCollectionsCreateRequestBody] :product_collections_create_request_body @return [Array<(ProductCollectionsCreateResponseBody
, Integer, Hash)>] ProductCollectionsCreateResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/product_collections_api.rb, line 37 def create_product_collection_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductCollectionsApi.create_product_collection ...' end # resource path local_var_path = '/v1/product-collections' # 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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'product_collections_create_request_body']) # return_type return_type = opts[:debug_return_type] || 'ProductCollectionsCreateResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"ProductCollectionsApi.create_product_collection", :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: ProductCollectionsApi#create_product_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete Product
Collection This method deletes a product collection. @param product_collection_id [String] A unique product collection ID. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/VoucherifySdk/api/product_collections_api.rb, line 101 def delete_product_collection_with_http_info(product_collection_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductCollectionsApi.delete_product_collection ...' end # resource path local_var_path = '/v1/product-collections/{productCollectionId}'.sub('{' + 'productCollectionId' + '}', CGI.escape(product_collection_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"ProductCollectionsApi.delete_product_collection", :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: ProductCollectionsApi#delete_product_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Product
Collection Retrieves the product collection. @param product_collection_id [String] A unique product collection ID. @param [Hash] opts the optional parameters @return [Array<(ProductCollectionsGetResponseBody
, Integer, Hash)>] ProductCollectionsGetResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/product_collections_api.rb, line 158 def get_product_collection_with_http_info(product_collection_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductCollectionsApi.get_product_collection ...' end # resource path local_var_path = '/v1/product-collections/{productCollectionId}'.sub('{' + 'productCollectionId' + '}', CGI.escape(product_collection_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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ProductCollectionsGetResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"ProductCollectionsApi.get_product_collection", :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: ProductCollectionsApi#get_product_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Product
Collections This method returns a list of product collections. @param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @return [Array<(ProductCollectionsListResponseBody
, Integer, Hash)>] ProductCollectionsListResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/product_collections_api.rb, line 221 def list_product_collections_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductCollectionsApi.list_product_collections ...' end # resource path local_var_path = '/v1/product-collections' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? # 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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ProductCollectionsListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"ProductCollectionsApi.list_product_collections", :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: ProductCollectionsApi#list_product_collections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Products in Collection Retrieves list of products from a product collection; works for both dynamic and static product collections. @param product_collection_id [String] Unique product collection ID. @param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [Time] :starting_after Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. @return [Array<(ProductCollectionsProductsListResponseBody
, Integer, Hash)>] ProductCollectionsProductsListResponseBody
data, response status code and response headers
# File lib/VoucherifySdk/api/product_collections_api.rb, line 291 def list_products_in_collection_with_http_info(product_collection_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductCollectionsApi.list_products_in_collection ...' end # resource path local_var_path = '/v1/product-collections/{productCollectionId}/products'.sub('{' + 'productCollectionId' + '}', CGI.escape(product_collection_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil? # 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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ProductCollectionsProductsListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"ProductCollectionsApi.list_products_in_collection", :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: ProductCollectionsApi#list_products_in_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end