Class: BeyondApi::OrderSettings

Inherits:
Base
  • Object
show all
Includes:
Utils
Defined in:
lib/beyond_api/resources/order_settings.rb

Instance Attribute Summary

Attributes inherited from Base

#session

Instance Method Summary collapse

Methods included from Utils

#file_content_type, #handle_all_request, #handle_error, #handle_response, #sanitize_key, #sanitize_response, #to_object_struct

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from BeyondApi::Base

Instance Method Details

#allOpenStruct

A GET request is used to retrieve the order settings.

$ curl 'https://api-shop.beyondshop.cloud/api/order-settings' -i -X GET \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@order_settings = session.payment_methods.all

Returns:

  • (OpenStruct)

Scopes:

  • oset:r



23
24
25
26
27
# File 'lib/beyond_api/resources/order_settings.rb', line 23

def all
  response, status = BeyondApi::Request.get(@session, "/order-settings")

  handle_response(response, status)
end

#update(body) ⇒ OpenStruct

A PUT request is used to update the order settings.

$ curl 'https://api-shop.beyondshop.cloud/api/order-settings' -i -X PUT \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/hal+json' \
  -H 'Authorization: Bearer <Access token>' \
  -d '{
      "invoiceCancelationNote" : "This is an invoice cancelation note",
      "defaultDeliveryDateNote" : "This is the default delivery date note",
      "defaultInvoiceNote" : "This is the default invoice note",
      "orderNumberConfiguration" : {
        "stringPrefix" : "2017-shop-",
        "nextNumericSuffix" : 1000,
        "numericSuffixLength" : 4
      },
      "invoiceNumberConfiguration" : {
        "stringPrefix" : "2017-invoice-",
        "nextNumericSuffix" : 1000,
        "numericSuffixLength" : 4
      },
      "customOrderOpenMailText" : " Your <br /> 1",
      "customOrderCanceledMailText" : " Your <br /> 2",
      "customInvoiceCustomerMailText" : " Your <br /> 3",
      "customInvoiceCanceledMailText" : " Your <br /> 4",
      "customOrderShippedMailText" : " Your <br /> 5",
      "customOrderPendingMailText" : " Your <br /> 6",
      "customOrderReturnedMailText" : " Your <br /> 7"
 }'

Examples:

body = {
  "invoiceCancelationNote" : "This is an invoice cancelation note",
  "defaultDeliveryDateNote" : "This is the default delivery date note",
  "defaultInvoiceNote" : "This is the default invoice note",
  "orderNumberConfiguration" : {
    "stringPrefix" : "2017-shop-",
    "nextNumericSuffix" : 1000,
    "numericSuffixLength" : 4
  },
  "invoiceNumberConfiguration" : {
    "stringPrefix" : "2017-invoice-",
    "nextNumericSuffix" : 1000,
    "numericSuffixLength" : 4
  },
  "customOrderOpenMailText" : " Your <br /> 1",
  "customOrderCanceledMailText" : " Your <br /> 2",
  "customInvoiceCustomerMailText" : " Your <br /> 3",
  "customInvoiceCanceledMailText" : " Your <br /> 4",
  "customOrderShippedMailText" : " Your <br /> 5",
  "customOrderPendingMailText" : " Your <br /> 6",
  "customOrderReturnedMailText" : " Your <br /> 7"
}

@order_settings = session.order_settings.update(body)

Parameters:

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • oset:u



91
92
93
94
95
# File 'lib/beyond_api/resources/order_settings.rb', line 91

def update(body)
  response, status = BeyondApi::Request.put(@session, "/order-settings", body)

  handle_response(response, status)
end