Class: Pago::V2026_04::Models::DiscountFixedOnceForeverDuration
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
Schema for a fixed amount discount that is applied once or forever.
Constant Summary collapse
- JSON_KEYS =
{ duration: "duration", type: "type", amount: "amount", currency: "currency", amounts: "amounts", created_at: "created_at", modified_at: "modified_at", id: "id", metadata: "metadata", name: "name", code: "code", starts_at: "starts_at", ends_at: "ends_at", max_redemptions: "max_redemptions", redemptions_count: "redemptions_count", organization_id: "organization_id", products: "products" }.freeze
- REQUIRED_KEYS =
["duration", "type", "amount", "currency", "amounts", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id", "products"].freeze
Instance Attribute Summary collapse
- #amount ⇒ Integer readonly deprecated Deprecated.
-
#amounts ⇒ Hash{String => Integer}
readonly
Map of currency to fixed amount to discount from the total.
-
#code ⇒ String?
readonly
Code customers can use to apply the discount during checkout.
-
#created_at ⇒ String
readonly
Creation timestamp of the object.
- #currency ⇒ String readonly deprecated Deprecated.
- #duration ⇒ String readonly
-
#ends_at ⇒ String?
readonly
Timestamp after which the discount is no longer redeemable.
-
#id ⇒ String
readonly
The ID of the object.
-
#max_redemptions ⇒ Integer?
readonly
Maximum number of times the discount can be redeemed.
- #metadata ⇒ Hash{String => String, Integer, Float, Boolean} readonly
-
#modified_at ⇒ String?
readonly
Last modification timestamp of the object.
-
#name ⇒ String
readonly
Name of the discount.
-
#organization_id ⇒ String
readonly
The organization ID.
- #products ⇒ Array<Models::DiscountProduct> readonly
-
#redemptions_count ⇒ Integer
readonly
Number of times the discount has been redeemed.
-
#starts_at ⇒ String?
readonly
Timestamp after which the discount is redeemable.
- #type ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(duration:, type:, amount:, currency:, amounts:, created_at:, modified_at:, id:, metadata:, name:, code:, starts_at:, ends_at:, max_redemptions:, redemptions_count:, organization_id:, products:) ⇒ DiscountFixedOnceForeverDuration
constructor
A new instance of DiscountFixedOnceForeverDuration.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(duration:, type:, amount:, currency:, amounts:, created_at:, modified_at:, id:, metadata:, name:, code:, starts_at:, ends_at:, max_redemptions:, redemptions_count:, organization_id:, products:) ⇒ DiscountFixedOnceForeverDuration
Returns a new instance of DiscountFixedOnceForeverDuration.
22588 22589 22590 22591 22592 22593 22594 22595 22596 22597 22598 22599 22600 22601 22602 22603 22604 22605 22606 22607 22608 22609 22610 22611 22612 22613 22614 22615 22616 22617 22618 22619 22620 22621 22622 22623 22624 22625 |
# File 'lib/pago/v2026_04/models.rb', line 22588 def initialize( duration:, type:, amount:, currency:, amounts:, created_at:, modified_at:, id:, metadata:, name:, code:, starts_at:, ends_at:, max_redemptions:, redemptions_count:, organization_id:, products: ) super() assign(:duration, duration) assign(:type, type) assign(:amount, amount) assign(:currency, currency) assign(:amounts, amounts) assign(:created_at, created_at) assign(:modified_at, modified_at) assign(:id, id) assign(:metadata, ) assign(:name, name) assign(:code, code) assign(:starts_at, starts_at) assign(:ends_at, ends_at) assign(:max_redemptions, max_redemptions) assign(:redemptions_count, redemptions_count) assign(:organization_id, organization_id) assign(:products, products) end |
Instance Attribute Details
#amount ⇒ Integer (readonly)
22532 22533 22534 |
# File 'lib/pago/v2026_04/models.rb', line 22532 def amount @amount end |
#amounts ⇒ Hash{String => Integer} (readonly)
Map of currency to fixed amount to discount from the total.
22540 22541 22542 |
# File 'lib/pago/v2026_04/models.rb', line 22540 def amounts @amounts end |
#code ⇒ String? (readonly)
Code customers can use to apply the discount during checkout.
22563 22564 22565 |
# File 'lib/pago/v2026_04/models.rb', line 22563 def code @code end |
#created_at ⇒ String (readonly)
Creation timestamp of the object.
22544 22545 22546 |
# File 'lib/pago/v2026_04/models.rb', line 22544 def created_at @created_at end |
#currency ⇒ String (readonly)
22536 22537 22538 |
# File 'lib/pago/v2026_04/models.rb', line 22536 def currency @currency end |
#duration ⇒ String (readonly)
22525 22526 22527 |
# File 'lib/pago/v2026_04/models.rb', line 22525 def duration @duration end |
#ends_at ⇒ String? (readonly)
Timestamp after which the discount is no longer redeemable.
22571 22572 22573 |
# File 'lib/pago/v2026_04/models.rb', line 22571 def ends_at @ends_at end |
#id ⇒ String (readonly)
The ID of the object.
22552 22553 22554 |
# File 'lib/pago/v2026_04/models.rb', line 22552 def id @id end |
#max_redemptions ⇒ Integer? (readonly)
Maximum number of times the discount can be redeemed.
22575 22576 22577 |
# File 'lib/pago/v2026_04/models.rb', line 22575 def max_redemptions @max_redemptions end |
#metadata ⇒ Hash{String => String, Integer, Float, Boolean} (readonly)
22555 22556 22557 |
# File 'lib/pago/v2026_04/models.rb', line 22555 def @metadata end |
#modified_at ⇒ String? (readonly)
Last modification timestamp of the object.
22548 22549 22550 |
# File 'lib/pago/v2026_04/models.rb', line 22548 def modified_at @modified_at end |
#name ⇒ String (readonly)
Name of the discount. Will be displayed to the customer when the discount is applied.
22559 22560 22561 |
# File 'lib/pago/v2026_04/models.rb', line 22559 def name @name end |
#organization_id ⇒ String (readonly)
The organization ID.
22583 22584 22585 |
# File 'lib/pago/v2026_04/models.rb', line 22583 def organization_id @organization_id end |
#products ⇒ Array<Models::DiscountProduct> (readonly)
22586 22587 22588 |
# File 'lib/pago/v2026_04/models.rb', line 22586 def products @products end |
#redemptions_count ⇒ Integer (readonly)
Number of times the discount has been redeemed.
22579 22580 22581 |
# File 'lib/pago/v2026_04/models.rb', line 22579 def redemptions_count @redemptions_count end |
#starts_at ⇒ String? (readonly)
Timestamp after which the discount is redeemable.
22567 22568 22569 |
# File 'lib/pago/v2026_04/models.rb', line 22567 def starts_at @starts_at end |
#type ⇒ String (readonly)
22528 22529 22530 |
# File 'lib/pago/v2026_04/models.rb', line 22528 def type @type end |
Class Method Details
.from_json(data) ⇒ DiscountFixedOnceForeverDuration?
22629 22630 22631 22632 22633 22634 22635 22636 22637 22638 22639 22640 22641 22642 22643 22644 22645 22646 22647 22648 22649 22650 22651 22652 22653 22654 22655 22656 |
# File 'lib/pago/v2026_04/models.rb', line 22629 def self.from_json(data) data = ::JSON.parse(data) if data.is_a?(String) data = ::Pago::Serde.object(data) return nil if data.nil? wrap_raw( new( duration: (data.key?("duration") ? data["duration"] : ::Pago::UNSET), type: (data.key?("type") ? data["type"] : ::Pago::UNSET), amount: (data.key?("amount") ? data["amount"] : ::Pago::UNSET), currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET), amounts: (data.key?("amounts") ? data["amounts"] : ::Pago::UNSET), created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET), modified_at: (data.key?("modified_at") ? data["modified_at"] : ::Pago::UNSET), id: (data.key?("id") ? data["id"] : ::Pago::UNSET), metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET), name: (data.key?("name") ? data["name"] : ::Pago::UNSET), code: (data.key?("code") ? data["code"] : ::Pago::UNSET), starts_at: (data.key?("starts_at") ? data["starts_at"] : ::Pago::UNSET), ends_at: (data.key?("ends_at") ? data["ends_at"] : ::Pago::UNSET), max_redemptions: (data.key?("max_redemptions") ? data["max_redemptions"] : ::Pago::UNSET), redemptions_count: (data.key?("redemptions_count") ? data["redemptions_count"] : ::Pago::UNSET), organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET), products: (data.key?("products") ? ::Pago::Serde.array(data["products"]) { |item0| Models::DiscountProduct.from_json(item0) } : ::Pago::UNSET) ), data ) end |