Class: BeyondApi::CheckoutSettings

Inherits:
Base
  • Object
show all
Includes:
Utils
Defined in:
lib/beyond_api/resources/checkout_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 checkout settings.

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

Examples:

@checkout_settiongs = session.checkout_settings.all

Returns:

  • (OpenStruct)

Scopes:

  • cset:r



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

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

  handle_response(response, status)
end

#update(body) ⇒ OpenStruct

A PUT request is used to update the checkout settings.

$ curl 'https://api-shop.beyondshop.cloud/api/checkout-settings' -i -X PUT \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
    "minimumOrderValue" : {
      "currency" : "EUR",
      "amount" : 50
    },
    "mustAcceptTermsAndConditions" : true
}'

Examples:

body = {
    "minimum_order_value" => {
      "currency" => "EUR",
      "amount" => 50
    },
    "must_accept_terms_and_conditions" => true
}
@checkout_settiongs = session.checkout_settings.update(body)

Returns:

  • (OpenStruct)

Scopes:

  • cset:u



57
58
59
60
61
# File 'lib/beyond_api/resources/checkout_settings.rb', line 57

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

  handle_response(response, status)
end