Class: NewStoreApi::PricebookExportController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/pricebook_export_controller.rb

Overview

PricebookExportController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from NewStoreApi::BaseController

Instance Method Details

#show_pricebook_export(catalog, pricebook, format: FormatEnum::CSV) ⇒ void

This method returns an undefined value.

Use this resource to export a specific price book. The export can be requested in CSV or SQLite format. The export contains the following fields:

product_id (string) price (float32) currency_code (string)
prod1 16.99 USD

Export API are not immediately scheduling new export. Exports are automatically scheduled daily. Usually at 8:00 UTC. They are usually finished before 9:00 UTC. API can be used to retrieve max 1 day old snapshot of pricing data. Response header Last-Modified can be used to determine when file was updated last time (example value Mon, 18 Dec 2023 08:00:21 GMT). Response header ETag can be used to determine whether version you already downloaded before match current one. (example value "2ad5ba4e24fe1c0d225e9a94049f142d") Please use it with combination with If-None-Match request header to download file only when something changed. user wants to export, belongs to. to export. format, defaults to 'csv'.

Parameters:

  • catalog (String)

    Required parameter: The catalog the pricebook, the

  • pricebook (String)

    Required parameter: The pricebook the user wants

  • format (FormatEnum) (defaults to: FormatEnum::CSV)

    Optional parameter: The desired response



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/new_store_api/controllers/pricebook_export_controller.rb', line 33

def show_pricebook_export(catalog,
                          pricebook,
                          format: FormatEnum::CSV)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/catalog/exports/catalogs/{catalog}/pricebooks/{pricebook}',
                                 Server::API)
               .template_param(new_parameter(catalog, key: 'catalog')
                                .should_encode(true))
               .template_param(new_parameter(pricebook, key: 'pricebook')
                                .should_encode(true))
               .query_param(new_parameter(format, key: 'format'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end