Class: Printful::OrdersAPIClient
- Inherits:
-
Object
- Object
- Printful::OrdersAPIClient
- Defined in:
- lib/printful_client/api/orders_api_client.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#cancel_order_by_id(id, opts = {}) ⇒ CreateOrder200Response
Cancel an order Cancels pending order or draft.
-
#cancel_order_by_id_with_http_info(id, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Cancel an order Cancels pending order or draft.
-
#confirm_order_by_id(id, opts = {}) ⇒ CreateOrder200Response
Confirm draft for fulfillment Approves for fulfillment an order that was saved as a draft.
-
#confirm_order_by_id_with_http_info(id, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Confirm draft for fulfillment Approves for fulfillment an order that was saved as a draft.
-
#create_order(order, opts = {}) ⇒ CreateOrder200Response
Create a new order Creates a new order and optionally submits it for fulfillment ([See examples](#section/Orders-API-examples)).
-
#create_order_with_http_info(order, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Create a new order Creates a new order and optionally submits it for fulfillment ([See examples](#section/Orders-API-examples)).
-
#estimate_order_costs(order, opts = {}) ⇒ EstimateOrderCosts200Response
Estimate order costs Calculates the estimated order costs including item costs, print costs (back prints, inside labels etc.), shipping and taxes.
-
#estimate_order_costs_with_http_info(order, opts = {}) ⇒ Array<(EstimateOrderCosts200Response, Integer, Hash)>
Estimate order costs Calculates the estimated order costs including item costs, print costs (back prints, inside labels etc.), shipping and taxes.
-
#get_order_by_id(id, opts = {}) ⇒ CreateOrder200Response
Get order data Returns order data by ID or External ID.
-
#get_order_by_id_with_http_info(id, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Get order data Returns order data by ID or External ID.
-
#get_orders(opts = {}) ⇒ GetOrders200Response
Get list of orders Returns list of order objects from your store.
-
#get_orders_with_http_info(opts = {}) ⇒ Array<(GetOrders200Response, Integer, Hash)>
Get list of orders Returns list of order objects from your store.
-
#initialize(api_client = ApiClient.default) ⇒ OrdersAPIClient
constructor
A new instance of OrdersAPIClient.
-
#update_order_by_id(id, order, opts = {}) ⇒ CreateOrder200Response
Update order data Updates unsubmitted order and optionally submits it for the fulfillment.
-
#update_order_by_id_with_http_info(id, order, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Update order data Updates unsubmitted order and optionally submits it for the fulfillment.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ OrdersAPIClient
Returns a new instance of OrdersAPIClient.
19 20 21 |
# File 'lib/printful_client/api/orders_api_client.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/printful_client/api/orders_api_client.rb', line 17 def api_client @api_client end |
Instance Method Details
#cancel_order_by_id(id, opts = {}) ⇒ CreateOrder200Response
Cancel an order Cancels pending order or draft. Charged amount is returned to the store owner’s credit card.
28 29 30 31 |
# File 'lib/printful_client/api/orders_api_client.rb', line 28 def cancel_order_by_id(id, opts = {}) data, _status_code, _headers = cancel_order_by_id_with_http_info(id, opts) data end |
#cancel_order_by_id_with_http_info(id, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Cancel an order Cancels pending order or draft. Charged amount is returned to the store owner's credit card.
39 40 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 |
# File 'lib/printful_client/api/orders_api_client.rb', line 39 def cancel_order_by_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersAPIClient.cancel_order_by_id ...' 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 OrdersAPIClient.cancel_order_by_id" end # resource path local_var_path = '/orders/{id}'.sub('{' + 'id' + '}', CGI.escape(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']) header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CreateOrder200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"OrdersAPIClient.cancel_order_by_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(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersAPIClient#cancel_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#confirm_order_by_id(id, opts = {}) ⇒ CreateOrder200Response
Confirm draft for fulfillment Approves for fulfillment an order that was saved as a draft. Store owner’s credit card is charged when the order is submitted for fulfillment.
94 95 96 97 |
# File 'lib/printful_client/api/orders_api_client.rb', line 94 def confirm_order_by_id(id, opts = {}) data, _status_code, _headers = confirm_order_by_id_with_http_info(id, opts) data end |
#confirm_order_by_id_with_http_info(id, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Confirm draft for fulfillment Approves for fulfillment an order that was saved as a draft. Store owner's credit card is charged when the order is submitted for fulfillment.
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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/printful_client/api/orders_api_client.rb', line 105 def confirm_order_by_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersAPIClient.confirm_order_by_id ...' 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 OrdersAPIClient.confirm_order_by_id" end # resource path local_var_path = '/orders/{id}/confirm'.sub('{' + 'id' + '}', CGI.escape(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']) header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CreateOrder200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"OrdersAPIClient.confirm_order_by_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(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersAPIClient#confirm_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_order(order, opts = {}) ⇒ CreateOrder200Response
Create a new order Creates a new order and optionally submits it for fulfillment ([See examples](#section/Orders-API-examples))
162 163 164 165 |
# File 'lib/printful_client/api/orders_api_client.rb', line 162 def create_order(order, opts = {}) data, _status_code, _headers = create_order_with_http_info(order, opts) data end |
#create_order_with_http_info(order, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Create a new order Creates a new order and optionally submits it for fulfillment ([See examples](#section/Orders-API-examples))
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 225 226 227 228 229 |
# File 'lib/printful_client/api/orders_api_client.rb', line 175 def create_order_with_http_info(order, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersAPIClient.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 OrdersAPIClient.create_order" end # resource path local_var_path = '/orders' # query parameters query_params = opts[:query_params] || {} query_params[:'confirm'] = opts[:'confirm'] if !opts[:'confirm'].nil? query_params[:'update_existing'] = opts[:'update_existing'] if !opts[:'update_existing'].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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(order) # return_type return_type = opts[:debug_return_type] || 'CreateOrder200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"OrdersAPIClient.create_order", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersAPIClient#create_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#estimate_order_costs(order, opts = {}) ⇒ EstimateOrderCosts200Response
Estimate order costs Calculates the estimated order costs including item costs, print costs (back prints, inside labels etc.), shipping and taxes
237 238 239 240 |
# File 'lib/printful_client/api/orders_api_client.rb', line 237 def estimate_order_costs(order, opts = {}) data, _status_code, _headers = estimate_order_costs_with_http_info(order, opts) data end |
#estimate_order_costs_with_http_info(order, opts = {}) ⇒ Array<(EstimateOrderCosts200Response, Integer, Hash)>
Estimate order costs Calculates the estimated order costs including item costs, print costs (back prints, inside labels etc.), shipping and taxes
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 297 298 299 300 |
# File 'lib/printful_client/api/orders_api_client.rb', line 248 def estimate_order_costs_with_http_info(order, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersAPIClient.estimate_order_costs ...' 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 OrdersAPIClient.estimate_order_costs" end # resource path local_var_path = '/orders/estimate-costs' # 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 header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(order) # return_type return_type = opts[:debug_return_type] || 'EstimateOrderCosts200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"OrdersAPIClient.estimate_order_costs", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersAPIClient#estimate_order_costs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_order_by_id(id, opts = {}) ⇒ CreateOrder200Response
Get order data Returns order data by ID or External ID.
308 309 310 311 |
# File 'lib/printful_client/api/orders_api_client.rb', line 308 def get_order_by_id(id, opts = {}) data, _status_code, _headers = get_order_by_id_with_http_info(id, opts) data end |
#get_order_by_id_with_http_info(id, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Get order data Returns order data by ID or External ID.
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 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/printful_client/api/orders_api_client.rb', line 319 def get_order_by_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersAPIClient.get_order_by_id ...' 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 OrdersAPIClient.get_order_by_id" end # resource path local_var_path = '/orders/{id}'.sub('{' + 'id' + '}', CGI.escape(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']) header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CreateOrder200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"OrdersAPIClient.get_order_by_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersAPIClient#get_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_orders(opts = {}) ⇒ GetOrders200Response
Get list of orders Returns list of order objects from your store
375 376 377 378 |
# File 'lib/printful_client/api/orders_api_client.rb', line 375 def get_orders(opts = {}) data, _status_code, _headers = get_orders_with_http_info(opts) data end |
#get_orders_with_http_info(opts = {}) ⇒ Array<(GetOrders200Response, Integer, Hash)>
Get list of orders Returns list of order objects from your store
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/printful_client/api/orders_api_client.rb', line 387 def get_orders_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersAPIClient.get_orders ...' end # resource path local_var_path = '/orders' # query parameters query_params = opts[:query_params] || {} query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'GetOrders200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"OrdersAPIClient.get_orders", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersAPIClient#get_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_order_by_id(id, order, opts = {}) ⇒ CreateOrder200Response
Update order data
Updates unsubmitted order and optionally submits it for the fulfillment. Note that you need to post only the fields that need to be changed, not all required fields. If items array is given in the update data, the items will be: a) updated, if the update data contains the item id or external_id parameter that alreay exists b) deleted, if the request doesn't contain the item with previously existing id c) created as new if the id is not given or does not already exist
442 443 444 445 |
# File 'lib/printful_client/api/orders_api_client.rb', line 442 def update_order_by_id(id, order, opts = {}) data, _status_code, _headers = update_order_by_id_with_http_info(id, order, opts) data end |
#update_order_by_id_with_http_info(id, order, opts = {}) ⇒ Array<(CreateOrder200Response, Integer, Hash)>
Update order data
Updates unsubmitted order and optionally submits it for the fulfillment. Note that you need to post only the fields that need to be changed, not all required fields. If items array is given in the update data, the items will be: a) updated, if the update data contains the item id or external_id parameter that alreay exists b) deleted, if the request doesn't contain the item with previously existing id c) created as new if the id is not given or does not already exist
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 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/printful_client/api/orders_api_client.rb', line 455 def update_order_by_id_with_http_info(id, order, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: OrdersAPIClient.update_order_by_id ...' 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 OrdersAPIClient.update_order_by_id" 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 OrdersAPIClient.update_order_by_id" end # resource path local_var_path = '/orders/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'confirm'] = opts[:'confirm'] if !opts[:'confirm'].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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(order) # return_type return_type = opts[:debug_return_type] || 'CreateOrder200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"OrdersAPIClient.update_order_by_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(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersAPIClient#update_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |