=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 The version of the OpenAPI document: 2.0.0 Contact: support@ultracart.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.0.1-SNAPSHOT =end require 'cgi' module UltracartClient class ItemApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false) api_config = Configuration.new api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key api_config.api_version = '2017-03-01' api_config.verify_ssl = verify_ssl api_client = ApiClient.new(api_config) api_client.config.debugging = debugging UltracartClient::ItemApi.new(api_client) end # Delete a digital item, which is a file within the digital library, not an actual merchant item # Delete a digital item on the UltraCart account. # @param digital_item_oid [Integer] The digital item oid to delete. # @param [Hash] opts the optional parameters # @return [nil] def delete_digital_item(digital_item_oid, opts = {}) delete_digital_item_with_http_info(digital_item_oid, opts) nil end # Delete a digital item, which is a file within the digital library, not an actual merchant item # Delete a digital item on the UltraCart account. # @param digital_item_oid [Integer] The digital item oid to delete. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_digital_item_with_http_info(digital_item_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.delete_digital_item ...' end # verify the required parameter 'digital_item_oid' is set if @api_client.config.client_side_validation && digital_item_oid.nil? fail ArgumentError, "Missing the required parameter 'digital_item_oid' when calling ItemApi.delete_digital_item" end # resource path local_var_path = '/item/digital_library/{digital_item_oid}'.sub('{' + 'digital_item_oid' + '}', CGI.escape(digital_item_oid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.delete_digital_item", :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: ItemApi#delete_digital_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete an item # Delete an item on the UltraCart account. # @param merchant_item_oid [Integer] The item oid to delete. # @param [Hash] opts the optional parameters # @return [nil] def delete_item(merchant_item_oid, opts = {}) delete_item_with_http_info(merchant_item_oid, opts) nil end # Delete an item # Delete an item on the UltraCart account. # @param merchant_item_oid [Integer] The item oid to delete. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_item_with_http_info(merchant_item_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.delete_item ...' end # verify the required parameter 'merchant_item_oid' is set if @api_client.config.client_side_validation && merchant_item_oid.nil? fail ArgumentError, "Missing the required parameter 'merchant_item_oid' when calling ItemApi.delete_item" end # resource path local_var_path = '/item/items/{merchant_item_oid}'.sub('{' + 'merchant_item_oid' + '}', CGI.escape(merchant_item_oid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.delete_item", :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: ItemApi#delete_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a digital item from the digital library, which are digital files that may be attached to normal items # Retrieves a digital item (file information) from the account. Be aware that these are not normal items that can be added to a shopping cart. Rather, they are digital files that may be associated with normal items. # @param digital_item_oid [Integer] The digital item oid to retrieve. # @param [Hash] opts the optional parameters # @return [ItemDigitalItemResponse] def get_digital_item(digital_item_oid, opts = {}) data, _status_code, _headers = get_digital_item_with_http_info(digital_item_oid, opts) data end # Retrieve a digital item from the digital library, which are digital files that may be attached to normal items # Retrieves a digital item (file information) from the account. Be aware that these are not normal items that can be added to a shopping cart. Rather, they are digital files that may be associated with normal items. # @param digital_item_oid [Integer] The digital item oid to retrieve. # @param [Hash] opts the optional parameters # @return [Array<(ItemDigitalItemResponse, Integer, Hash)>] ItemDigitalItemResponse data, response status code and response headers def get_digital_item_with_http_info(digital_item_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.get_digital_item ...' end # verify the required parameter 'digital_item_oid' is set if @api_client.config.client_side_validation && digital_item_oid.nil? fail ArgumentError, "Missing the required parameter 'digital_item_oid' when calling ItemApi.get_digital_item" end # resource path local_var_path = '/item/digital_library/{digital_item_oid}'.sub('{' + 'digital_item_oid' + '}', CGI.escape(digital_item_oid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'ItemDigitalItemResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.get_digital_item", :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: ItemApi#get_digital_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve digital items from the digital library which are digital files that may be attached to normal items # Retrieves a group of digital items (file information) from the account. If no parameters are specified, all digital items will be returned. Be aware that these are not normal items that can be added to a shopping cart. Rather, they are digital files that may be associated with normal items. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param [Hash] opts the optional parameters # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Default 100, Max 2000) (default to 100) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) # @option opts [String] :_since Fetch items that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the items. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [ItemDigitalItemsResponse] def get_digital_items(opts = {}) data, _status_code, _headers = get_digital_items_with_http_info(opts) data end # Retrieve digital items from the digital library which are digital files that may be attached to normal items # Retrieves a group of digital items (file information) from the account. If no parameters are specified, all digital items will be returned. Be aware that these are not normal items that can be added to a shopping cart. Rather, they are digital files that may be associated with normal items. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param [Hash] opts the optional parameters # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Default 100, Max 2000) (default to 100) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) # @option opts [String] :_since Fetch items that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the items. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [Array<(ItemDigitalItemsResponse, Integer, Hash)>] ItemDigitalItemsResponse data, response status code and response headers def get_digital_items_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.get_digital_items ...' end # resource path local_var_path = '/item/digital_library' # query parameters query_params = opts[:query_params] || {} query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil? query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil? query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil? query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil? query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil? # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'ItemDigitalItemsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.get_digital_items", :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: ItemApi#get_digital_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve an item # Retrieves a single item using the specified item oid. # @param merchant_item_oid [Integer] The item oid to retrieve. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [ItemResponse] def get_item(merchant_item_oid, opts = {}) data, _status_code, _headers = get_item_with_http_info(merchant_item_oid, opts) data end # Retrieve an item # Retrieves a single item using the specified item oid. # @param merchant_item_oid [Integer] The item oid to retrieve. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [Array<(ItemResponse, Integer, Hash)>] ItemResponse data, response status code and response headers def get_item_with_http_info(merchant_item_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.get_item ...' end # verify the required parameter 'merchant_item_oid' is set if @api_client.config.client_side_validation && merchant_item_oid.nil? fail ArgumentError, "Missing the required parameter 'merchant_item_oid' when calling ItemApi.get_item" end # resource path local_var_path = '/item/items/{merchant_item_oid}'.sub('{' + 'merchant_item_oid' + '}', CGI.escape(merchant_item_oid.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil? # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'ItemResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.get_item", :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: ItemApi#get_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve an item by item id # Retrieves a single item using the specified item id. # @param merchant_item_id [String] The item id to retrieve. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [ItemResponse] def get_item_by_merchant_item_id(merchant_item_id, opts = {}) data, _status_code, _headers = get_item_by_merchant_item_id_with_http_info(merchant_item_id, opts) data end # Retrieve an item by item id # Retrieves a single item using the specified item id. # @param merchant_item_id [String] The item id to retrieve. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [Array<(ItemResponse, Integer, Hash)>] ItemResponse data, response status code and response headers def get_item_by_merchant_item_id_with_http_info(merchant_item_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.get_item_by_merchant_item_id ...' end # verify the required parameter 'merchant_item_id' is set if @api_client.config.client_side_validation && merchant_item_id.nil? fail ArgumentError, "Missing the required parameter 'merchant_item_id' when calling ItemApi.get_item_by_merchant_item_id" end # resource path local_var_path = '/item/items/merchant_item_id/{merchant_item_id}'.sub('{' + 'merchant_item_id' + '}', CGI.escape(merchant_item_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil? # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'ItemResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.get_item_by_merchant_item_id", :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: ItemApi#get_item_by_merchant_item_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve items # Retrieves a group of items from the account. If no parameters are specified, all items will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param [Hash] opts the optional parameters # @option opts [Integer] :parent_category_id The parent category object id to retrieve items for. Unspecified means all items on the account. 0 = root # @option opts [String] :parent_category_path The parent category path to retrieve items for. Unspecified means all items on the account. / = root # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Default 100, Max 2000) (default to 100) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) # @option opts [String] :_since Fetch items that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the items. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [ItemsResponse] def get_items(opts = {}) data, _status_code, _headers = get_items_with_http_info(opts) data end # Retrieve items # Retrieves a group of items from the account. If no parameters are specified, all items will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param [Hash] opts the optional parameters # @option opts [Integer] :parent_category_id The parent category object id to retrieve items for. Unspecified means all items on the account. 0 = root # @option opts [String] :parent_category_path The parent category path to retrieve items for. Unspecified means all items on the account. / = root # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Default 100, Max 2000) (default to 100) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) # @option opts [String] :_since Fetch items that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the items. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [Array<(ItemsResponse, Integer, Hash)>] ItemsResponse data, response status code and response headers def get_items_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.get_items ...' end # resource path local_var_path = '/item/items' # query parameters query_params = opts[:query_params] || {} query_params[:'parent_category_id'] = opts[:'parent_category_id'] if !opts[:'parent_category_id'].nil? query_params[:'parent_category_path'] = opts[:'parent_category_path'] if !opts[:'parent_category_path'].nil? query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil? query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil? query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil? query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil? query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil? # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'ItemsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.get_items", :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: ItemApi#get_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve pricing tiers # Retrieves the pricing tiers # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [PricingTiersResponse] def get_pricing_tiers(opts = {}) data, _status_code, _headers = get_pricing_tiers_with_http_info(opts) data end # Retrieve pricing tiers # Retrieves the pricing tiers # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(PricingTiersResponse, Integer, Hash)>] PricingTiersResponse data, response status code and response headers def get_pricing_tiers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.get_pricing_tiers ...' end # resource path local_var_path = '/item/pricing_tiers' # query parameters query_params = opts[:query_params] || {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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] || 'PricingTiersResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.get_pricing_tiers", :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: ItemApi#get_pricing_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a file within the digital library # Create a file within the digital library. This does not create an item, but makes this digital file available and selectable as part (or all) of an item. # @param digital_item [ItemDigitalItem] Digital item to create # @param [Hash] opts the optional parameters # @return [ItemDigitalItemResponse] def insert_digital_item(digital_item, opts = {}) data, _status_code, _headers = insert_digital_item_with_http_info(digital_item, opts) data end # Create a file within the digital library # Create a file within the digital library. This does not create an item, but makes this digital file available and selectable as part (or all) of an item. # @param digital_item [ItemDigitalItem] Digital item to create # @param [Hash] opts the optional parameters # @return [Array<(ItemDigitalItemResponse, Integer, Hash)>] ItemDigitalItemResponse data, response status code and response headers def insert_digital_item_with_http_info(digital_item, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.insert_digital_item ...' end # verify the required parameter 'digital_item' is set if @api_client.config.client_side_validation && digital_item.nil? fail ArgumentError, "Missing the required parameter 'digital_item' when calling ItemApi.insert_digital_item" end # resource path local_var_path = '/item/digital_library' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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; charset=UTF-8']) 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(digital_item) # return_type return_type = opts[:debug_return_type] || 'ItemDigitalItemResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.insert_digital_item", :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: ItemApi#insert_digital_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create an item # Create a new item on the UltraCart account. # @param item [Item] Item to create # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [ItemResponse] def insert_item(item, opts = {}) data, _status_code, _headers = insert_item_with_http_info(item, opts) data end # Create an item # Create a new item on the UltraCart account. # @param item [Item] Item to create # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [Array<(ItemResponse, Integer, Hash)>] ItemResponse data, response status code and response headers def insert_item_with_http_info(item, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.insert_item ...' end # verify the required parameter 'item' is set if @api_client.config.client_side_validation && item.nil? fail ArgumentError, "Missing the required parameter 'item' when calling ItemApi.insert_item" end # resource path local_var_path = '/item/items' # query parameters query_params = opts[:query_params] || {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil? # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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; charset=UTF-8']) 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(item) # return_type return_type = opts[:debug_return_type] || 'ItemResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.insert_item", :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: ItemApi#insert_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Updates a file within the digital library # Updates a file within the digital library. This does not update an item, but updates a digital file available and selectable as part (or all) of an item. # @param digital_item_oid [Integer] The digital item oid to update. # @param digital_item [ItemDigitalItem] Digital item to update # @param [Hash] opts the optional parameters # @return [ItemDigitalItemResponse] def update_digital_item(digital_item_oid, digital_item, opts = {}) data, _status_code, _headers = update_digital_item_with_http_info(digital_item_oid, digital_item, opts) data end # Updates a file within the digital library # Updates a file within the digital library. This does not update an item, but updates a digital file available and selectable as part (or all) of an item. # @param digital_item_oid [Integer] The digital item oid to update. # @param digital_item [ItemDigitalItem] Digital item to update # @param [Hash] opts the optional parameters # @return [Array<(ItemDigitalItemResponse, Integer, Hash)>] ItemDigitalItemResponse data, response status code and response headers def update_digital_item_with_http_info(digital_item_oid, digital_item, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.update_digital_item ...' end # verify the required parameter 'digital_item_oid' is set if @api_client.config.client_side_validation && digital_item_oid.nil? fail ArgumentError, "Missing the required parameter 'digital_item_oid' when calling ItemApi.update_digital_item" end # verify the required parameter 'digital_item' is set if @api_client.config.client_side_validation && digital_item.nil? fail ArgumentError, "Missing the required parameter 'digital_item' when calling ItemApi.update_digital_item" end # resource path local_var_path = '/item/digital_library/{digital_item_oid}'.sub('{' + 'digital_item_oid' + '}', CGI.escape(digital_item_oid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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; charset=UTF-8']) 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(digital_item) # return_type return_type = opts[:debug_return_type] || 'ItemDigitalItemResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.update_digital_item", :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: ItemApi#update_digital_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update an item # Update a new item on the UltraCart account. # @param merchant_item_oid [Integer] The item oid to update. # @param item [Item] Item to update # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [ItemResponse] def update_item(merchant_item_oid, item, opts = {}) data, _status_code, _headers = update_item_with_http_info(merchant_item_oid, item, opts) data end # Update an item # Update a new item on the UltraCart account. # @param merchant_item_oid [Integer] The item oid to update. # @param item [Item] Item to update # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @return [Array<(ItemResponse, Integer, Hash)>] ItemResponse data, response status code and response headers def update_item_with_http_info(merchant_item_oid, item, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.update_item ...' end # verify the required parameter 'merchant_item_oid' is set if @api_client.config.client_side_validation && merchant_item_oid.nil? fail ArgumentError, "Missing the required parameter 'merchant_item_oid' when calling ItemApi.update_item" end # verify the required parameter 'item' is set if @api_client.config.client_side_validation && item.nil? fail ArgumentError, "Missing the required parameter 'item' when calling ItemApi.update_item" end # resource path local_var_path = '/item/items/{merchant_item_oid}'.sub('{' + 'merchant_item_oid' + '}', CGI.escape(merchant_item_oid.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil? # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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; charset=UTF-8']) 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(item) # return_type return_type = opts[:debug_return_type] || 'ItemResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.update_item", :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: ItemApi#update_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update multiple items # Update multiple item on the UltraCart account. # @param items_request [ItemsRequest] Items to update (synchronous maximum 20 / asynchronous maximum 100) # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @option opts [Boolean] :_async True if the operation should be run async. No result returned # @return [ItemsResponse] def update_items(items_request, opts = {}) data, _status_code, _headers = update_items_with_http_info(items_request, opts) data end # Update multiple items # Update multiple item on the UltraCart account. # @param items_request [ItemsRequest] Items to update (synchronous maximum 20 / asynchronous maximum 100) # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @option opts [Boolean] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. # @option opts [Boolean] :_async True if the operation should be run async. No result returned # @return [Array<(ItemsResponse, Integer, Hash)>] ItemsResponse data, response status code and response headers def update_items_with_http_info(items_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.update_items ...' end # verify the required parameter 'items_request' is set if @api_client.config.client_side_validation && items_request.nil? fail ArgumentError, "Missing the required parameter 'items_request' when calling ItemApi.update_items" end # resource path local_var_path = '/item/items/batch' # query parameters query_params = opts[:query_params] || {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil? query_params[:'_async'] = opts[:'_async'] if !opts[:'_async'].nil? # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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; charset=UTF-8']) 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(items_request) # return_type return_type = opts[:debug_return_type] || 'ItemsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.update_items", :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: ItemApi#update_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Upload an image to the temporary multimedia. # Uploads an image and returns back meta information about the image as well as the identifier needed for the item update. # @param file [File] File to upload # @param [Hash] opts the optional parameters # @return [TempMultimediaResponse] def upload_temporary_multimedia(file, opts = {}) data, _status_code, _headers = upload_temporary_multimedia_with_http_info(file, opts) data end # Upload an image to the temporary multimedia. # Uploads an image and returns back meta information about the image as well as the identifier needed for the item update. # @param file [File] File to upload # @param [Hash] opts the optional parameters # @return [Array<(TempMultimediaResponse, Integer, Hash)>] TempMultimediaResponse data, response status code and response headers def upload_temporary_multimedia_with_http_info(file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ItemApi.upload_temporary_multimedia ...' end # verify the required parameter 'file' is set if @api_client.config.client_side_validation && file.nil? fail ArgumentError, "Missing the required parameter 'file' when calling ItemApi.upload_temporary_multimedia" end # resource path local_var_path = '/item/temp_multimedia' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['file'] = file # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TempMultimediaResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ItemApi.upload_temporary_multimedia", :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: ItemApi#upload_temporary_multimedia\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end