Class: Inttegro::PurchaseIntent
- Inherits:
-
T::Struct
- Object
- T::Struct
- Inttegro::PurchaseIntent
- Extended by:
- T::Sig
- Defined in:
- lib/inttegro/purchase_intent/purchase_intent.rb,
lib/inttegro/purchase_intent/base.rb,
lib/inttegro/purchase_intent/page.rb,
lib/inttegro/purchase_intent/price.rb,
lib/inttegro/purchase_intent/usage.rb,
lib/inttegro/purchase_intent/status.rb,
lib/inttegro/purchase_intent/product.rb,
lib/inttegro/purchase_intent/variant.rb,
lib/inttegro/purchase_intent/merchant.rb,
lib/inttegro/purchase_intent/quantity.rb,
lib/inttegro/purchase_intent/response.rb,
lib/inttegro/purchase_intent/questions.rb,
lib/inttegro/purchase_intent/usage_order.rb,
lib/inttegro/purchase_intent/variant_set.rb,
lib/inttegro/purchase_intent/page_request.rb,
lib/inttegro/purchase_intent/presentation.rb,
lib/inttegro/purchase_intent/variant_axis.rb,
lib/inttegro/purchase_intent/page_response.rb,
lib/inttegro/purchase_intent/cancel_request.rb,
lib/inttegro/purchase_intent/create_request.rb,
lib/inttegro/purchase_intent/lookup_request.rb,
lib/inttegro/purchase_intent/original_price.rb,
lib/inttegro/purchase_intent/update_request.rb,
lib/inttegro/purchase_intent/create_presentation.rb,
lib/inttegro/purchase_intent/update_presentation.rb,
lib/inttegro/purchase_intent/create_request_price.rb,
lib/inttegro/purchase_intent/create_request_usage.rb,
lib/inttegro/purchase_intent/presentation_buy_page.rb,
lib/inttegro/purchase_intent/create_request_product.rb,
lib/inttegro/purchase_intent/create_request_quantity.rb,
lib/inttegro/purchase_intent/product_attributes_item.rb,
lib/inttegro/purchase_intent/update_request_quantity.rb,
lib/inttegro/purchase_intent/presentation_buy_page_text.rb,
lib/inttegro/purchase_intent/create_presentation_buy_page.rb,
lib/inttegro/purchase_intent/update_presentation_buy_page.rb,
lib/inttegro/purchase_intent/create_request_price_original.rb,
lib/inttegro/purchase_intent/create_presentation_buy_page_text.rb,
lib/inttegro/purchase_intent/update_presentation_buy_page_text.rb
Overview
Typed representation of the purchase intent object in the Inttegro API.
This generated model is immutable. Construct it with .new, or decode a string-keyed API
payload with .from_hash. #serialize produces a string-keyed hash using the original wire
field names and serialized enum values.
Defined Under Namespace
Classes: CancelRequest, CreatePresentation, CreatePresentationBuyPage, CreatePresentationBuyPageText, CreateRequest, CreateRequestPrice, CreateRequestPriceOriginal, CreateRequestProduct, CreateRequestQuantity, CreateRequestUsage, LookupRequest, Merchant, OriginalPrice, Page, PageRequest, PageResponse, Presentation, PresentationBuyPage, PresentationBuyPageText, Price, Product, ProductAttributesItem, Quantity, Response, Status, UpdatePresentation, UpdatePresentationBuyPage, UpdatePresentationBuyPageText, UpdateRequest, UpdateRequestQuantity, Usage, UsageOrder, Variant, VariantAxis, VariantSet
Instance Attribute Summary collapse
-
#allow_variants ⇒ Boolean
readonly
Whether the intent was configured with a variant set.
-
#created_at ⇒ Time
readonly
Creation timestamp.
-
#expires_at ⇒ Time?
readonly
Timestamp at or after which the Buy link is expired.
-
#id ⇒ String
readonly
Unique purchase intent identifier with sale_ prefix.
-
#inactive_at ⇒ Time?
readonly
When the Buy link was explicitly canceled.
-
#merchant ⇒ Inttegro::PurchaseIntent::Merchant?
readonly
Merchant identity captured for the hosted checkout.
-
#presentation ⇒ Inttegro::PurchaseIntent::Presentation?
readonly
Value of the
presentationfield in the Inttegro API payload. -
#price ⇒ Inttegro::PurchaseIntent::Price?
readonly
Value of the
pricefield in the Inttegro API payload. -
#product ⇒ Inttegro::PurchaseIntent::Product?
readonly
Value of the
productfield in the Inttegro API payload. -
#quantity ⇒ Inttegro::PurchaseIntent::Quantity
readonly
Quantity bounds enforced by the hosted checkout.
-
#status ⇒ Inttegro::PurchaseIntent::Status
readonly
Effective lifecycle state derived from expiry, cancellation, and single-use order creation.
-
#updated_at ⇒ Time?
readonly
Last mutation timestamp.
-
#usage ⇒ Inttegro::PurchaseIntent::Usage
readonly
Exactly one of multi_use or single_use is returned as true.
-
#variant_set ⇒ Inttegro::PurchaseIntent::VariantSet?
readonly
Value of the
variant_setfield in the Inttegro API payload.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Determine whether the purchase intent's effective status is
Status::ACTIVE. -
#single_use? ⇒ Boolean
Determine whether the purchase intent is configured for one order only.
-
#used_order_id ⇒ String?
Return the order created from a consumed single-use purchase intent.
Instance Attribute Details
#allow_variants ⇒ Boolean (readonly)
Whether the intent was configured with a variant set
Required in the API payload. Wire name: allow_variants.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#created_at ⇒ Time (readonly)
Creation timestamp
Required in the API payload. Wire name: created_at.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#expires_at ⇒ Time? (readonly)
Timestamp at or after which the Buy link is expired
Optional in the API payload; omitted values default to nil. Wire name: expires_at.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#id ⇒ String (readonly)
Unique purchase intent identifier with sale_ prefix. Append it to https://pages.inttegro.com/buy/ to build the hosted Buy link.
Required in the API payload. Wire name: id.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#inactive_at ⇒ Time? (readonly)
When the Buy link was explicitly canceled
Optional in the API payload; omitted values default to nil. Wire name: inactive_at.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#merchant ⇒ Inttegro::PurchaseIntent::Merchant? (readonly)
Merchant identity captured for the hosted checkout. Individual fields are omitted when unavailable.
Optional in the API payload; omitted values default to nil. Wire name: merchant.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#presentation ⇒ Inttegro::PurchaseIntent::Presentation? (readonly)
Value of the presentation field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: presentation.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#price ⇒ Inttegro::PurchaseIntent::Price? (readonly)
Value of the price field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: price.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#product ⇒ Inttegro::PurchaseIntent::Product? (readonly)
Value of the product field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: product.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#quantity ⇒ Inttegro::PurchaseIntent::Quantity (readonly)
Quantity bounds enforced by the hosted checkout. max is omitted when the offer has no upper bound.
Required in the API payload. Wire name: quantity.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#status ⇒ Inttegro::PurchaseIntent::Status (readonly)
Effective lifecycle state derived from expiry, cancellation, and single-use order creation
Required in the API payload. Wire name: status.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#updated_at ⇒ Time? (readonly)
Last mutation timestamp
Optional in the API payload; omitted values default to nil. Wire name: updated_at.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#usage ⇒ Inttegro::PurchaseIntent::Usage (readonly)
Exactly one of multi_use or single_use is returned as true. Order is present after a single-use intent is consumed.
Required in the API payload. Wire name: usage.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
#variant_set ⇒ Inttegro::PurchaseIntent::VariantSet? (readonly)
Value of the variant_set field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: variant_set.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 112 class PurchaseIntent const :allow_variants, T::Boolean const :created_at, Time const :expires_at, T.nilable(Time), default: nil const :id, String const :inactive_at, T.nilable(Time), default: nil const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil const :price, T.nilable(Inttegro::PurchaseIntent::Price), default: nil const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil const :quantity, Inttegro::PurchaseIntent::Quantity const :status, Inttegro::PurchaseIntent::Status const :updated_at, T.nilable(Time), default: nil const :usage, Inttegro::PurchaseIntent::Usage const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil end |
Instance Method Details
#active? ⇒ Boolean
Determine whether the purchase intent's effective status is Status::ACTIVE.
12 13 14 |
# File 'lib/inttegro/purchase_intent/questions.rb', line 12 def active? status == Inttegro::PurchaseIntent::Status::ACTIVE end |
#single_use? ⇒ Boolean
Determine whether the purchase intent is configured for one order only.
20 21 22 |
# File 'lib/inttegro/purchase_intent/questions.rb', line 20 def single_use? usage.single_use == true end |
#used_order_id ⇒ String?
Return the order created from a consumed single-use purchase intent.
Reusable intents, unused intents, and usage records with an empty order identifier return
nil. This method reads the embedded usage snapshot and performs no lookup request.
31 32 33 34 35 36 |
# File 'lib/inttegro/purchase_intent/questions.rb', line 31 def used_order_id return nil unless single_use? id = usage.order&.id id unless id&.empty? end |