Class: Inttegro::Resources::PurchaseIntents
- Inherits:
-
Object
- Object
- Inttegro::Resources::PurchaseIntents
- Defined in:
- lib/inttegro/resources/purchase_intents.rb
Overview
Client for controlled, shareable purchase intents and hosted Buy links.
Access this resource through Client#purchase_intents.
Instance Method Summary collapse
-
#cancel(id:) ⇒ Inttegro::PurchaseIntent
Stop a purchase intent from creating new orders.
-
#create(payload) ⇒ Inttegro::PurchaseIntent
Create a purchase intent for a catalog product.
-
#initialize(http) ⇒ PurchaseIntents
constructor
A new instance of PurchaseIntents.
-
#lookup(id:) ⇒ Inttegro::PurchaseIntent
Retrieve a purchase intent by its opaque identifier.
-
#page(payload = {}) ⇒ Inttegro::PurchaseIntent::Page
Retrieve purchase intents in newest-first order.
-
#update(payload) ⇒ Inttegro::PurchaseIntent
Change mutable quantity or expiry fields on a purchase intent.
Constructor Details
#initialize(http) ⇒ PurchaseIntents
Returns a new instance of PurchaseIntents.
11 12 13 |
# File 'lib/inttegro/resources/purchase_intents.rb', line 11 def initialize(http) @http = T.let(http, Inttegro::HTTPClient) end |
Instance Method Details
#cancel(id:) ⇒ Inttegro::PurchaseIntent
Stop a purchase intent from creating new orders.
35 36 37 38 39 40 41 |
# File 'lib/inttegro/resources/purchase_intents.rb', line 35 def cancel(id:) @http.post_resource( "/purchase_intents/cancel", Inttegro::PurchaseIntent, :purchase_intent, { id: id } ) end |
#create(payload) ⇒ Inttegro::PurchaseIntent
Create a purchase intent for a catalog product.
19 20 21 |
# File 'lib/inttegro/resources/purchase_intents.rb', line 19 def create(payload) @http.post_resource("/purchase_intents/create", Inttegro::PurchaseIntent, :purchase_intent, payload) end |
#lookup(id:) ⇒ Inttegro::PurchaseIntent
Retrieve a purchase intent by its opaque identifier.
47 48 49 50 51 52 53 |
# File 'lib/inttegro/resources/purchase_intents.rb', line 47 def lookup(id:) @http.post_resource( "/purchase_intents/lookup", Inttegro::PurchaseIntent, :purchase_intent, { id: id } ) end |
#page(payload = {}) ⇒ Inttegro::PurchaseIntent::Page
Retrieve purchase intents in newest-first order.
59 60 61 62 63 64 65 |
# File 'lib/inttegro/resources/purchase_intents.rb', line 59 def page(payload = {}) @http.post_resource( "/purchase_intents/page", Inttegro::PurchaseIntent::Page, :page, payload || {} ) end |
#update(payload) ⇒ Inttegro::PurchaseIntent
Change mutable quantity or expiry fields on a purchase intent.
27 28 29 |
# File 'lib/inttegro/resources/purchase_intents.rb', line 27 def update(payload) @http.post_resource("/purchase_intents/update", Inttegro::PurchaseIntent, :purchase_intent, payload) end |