Class: EasyLabs::Resources::EmbeddedCheckout
- Defined in:
- lib/easylabs/resources/embedded_checkout.rb
Overview
/embedded-checkout — session create/get/crypto-status (api-key auth) plus public validate/confirm/config endpoints.
Instance Method Summary collapse
-
#config ⇒ Object
GET /embedded-checkout/config.
-
#confirm(client_secret:, source:, customer_details:) ⇒ Object
POST /embedded-checkout/confirm — public.
- #create(**body) ⇒ Object
- #crypto_status(id) ⇒ Object
- #retrieve(id) ⇒ Object
-
#update_config(allowed_origins: nil) ⇒ Object
PATCH /embedded-checkout/config { allowed_origins? }.
-
#validate(client_secret:, parent_origin: nil) ⇒ Object
POST /embedded-checkout/validate — public; authenticates via the session’s ‘client_secret` rather than the api key.
Methods inherited from Base
Constructor Details
This class inherits a constructor from EasyLabs::Resources::Base
Instance Method Details
#config ⇒ Object
GET /embedded-checkout/config
38 39 40 |
# File 'lib/easylabs/resources/embedded_checkout.rb', line 38 def config request(:get, "/embedded-checkout/config") end |
#confirm(client_secret:, source:, customer_details:) ⇒ Object
POST /embedded-checkout/confirm — public.
32 33 34 35 |
# File 'lib/easylabs/resources/embedded_checkout.rb', line 32 def confirm(client_secret:, source:, customer_details:) body = { client_secret: client_secret, source: source, customer_details: customer_details } request(:post, "/embedded-checkout/confirm", body: body, skip_auth: true) end |
#create(**body) ⇒ Object
10 11 12 |
# File 'lib/easylabs/resources/embedded_checkout.rb', line 10 def create(**body) request(:post, "/embedded-checkout", body: body) end |
#crypto_status(id) ⇒ Object
18 19 20 |
# File 'lib/easylabs/resources/embedded_checkout.rb', line 18 def crypto_status(id) request(:get, "/embedded-checkout/#{id}/crypto-status") end |
#retrieve(id) ⇒ Object
14 15 16 |
# File 'lib/easylabs/resources/embedded_checkout.rb', line 14 def retrieve(id) request(:get, "/embedded-checkout/#{id}") end |
#update_config(allowed_origins: nil) ⇒ Object
PATCH /embedded-checkout/config { allowed_origins? }
43 44 45 46 |
# File 'lib/easylabs/resources/embedded_checkout.rb', line 43 def update_config(allowed_origins: nil) body = { allowed_origins: allowed_origins }.compact request(:patch, "/embedded-checkout/config", body: body) end |
#validate(client_secret:, parent_origin: nil) ⇒ Object
POST /embedded-checkout/validate — public; authenticates via the session’s ‘client_secret` rather than the api key. Skips the X-Easy-Api-Key header so it’s safe to call from a browser context.
26 27 28 29 |
# File 'lib/easylabs/resources/embedded_checkout.rb', line 26 def validate(client_secret:, parent_origin: nil) body = { client_secret: client_secret, parent_origin: parent_origin }.compact request(:post, "/embedded-checkout/validate", body: body, skip_auth: true) end |