Class: Pago::V2026_04::Models::DiscountPercentageRepeatDuration
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
Schema for a percentage discount that is applied on every invoice for a certain number of months.
Constant Summary collapse
- JSON_KEYS =
{ duration: "duration", duration_in_months: "duration_in_months", type: "type", basis_points: "basis_points", 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", "duration_in_months", "type", "basis_points", "created_at", "modified_at", "id", "metadata", "name", "code", "starts_at", "ends_at", "max_redemptions", "redemptions_count", "organization_id", "products"].freeze
Instance Attribute Summary collapse
-
#basis_points ⇒ Integer
readonly
Discount percentage in basis points.
-
#code ⇒ String?
readonly
Code customers can use to apply the discount during checkout.
-
#created_at ⇒ String
readonly
Creation timestamp of the object.
- #duration ⇒ String readonly
- #duration_in_months ⇒ Integer 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:, duration_in_months:, type:, basis_points:, created_at:, modified_at:, id:, metadata:, name:, code:, starts_at:, ends_at:, max_redemptions:, redemptions_count:, organization_id:, products:) ⇒ DiscountPercentageRepeatDuration
constructor
A new instance of DiscountPercentageRepeatDuration.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(duration:, duration_in_months:, type:, basis_points:, created_at:, modified_at:, id:, metadata:, name:, code:, starts_at:, ends_at:, max_redemptions:, redemptions_count:, organization_id:, products:) ⇒ DiscountPercentageRepeatDuration
Returns a new instance of DiscountPercentageRepeatDuration.
23627 23628 23629 23630 23631 23632 23633 23634 23635 23636 23637 23638 23639 23640 23641 23642 23643 23644 23645 23646 23647 23648 23649 23650 23651 23652 23653 23654 23655 23656 23657 23658 23659 23660 23661 23662 |
# File 'lib/pago/v2026_04/models.rb', line 23627 def initialize( duration:, duration_in_months:, type:, basis_points:, created_at:, modified_at:, id:, metadata:, name:, code:, starts_at:, ends_at:, max_redemptions:, redemptions_count:, organization_id:, products: ) super() assign(:duration, duration) assign(:duration_in_months, duration_in_months) assign(:type, type) assign(:basis_points, basis_points) 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
#basis_points ⇒ Integer (readonly)
Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.
23579 23580 23581 |
# File 'lib/pago/v2026_04/models.rb', line 23579 def basis_points @basis_points end |
#code ⇒ String? (readonly)
Code customers can use to apply the discount during checkout.
23602 23603 23604 |
# File 'lib/pago/v2026_04/models.rb', line 23602 def code @code end |
#created_at ⇒ String (readonly)
Creation timestamp of the object.
23583 23584 23585 |
# File 'lib/pago/v2026_04/models.rb', line 23583 def created_at @created_at end |
#duration ⇒ String (readonly)
23569 23570 23571 |
# File 'lib/pago/v2026_04/models.rb', line 23569 def duration @duration end |
#duration_in_months ⇒ Integer (readonly)
23572 23573 23574 |
# File 'lib/pago/v2026_04/models.rb', line 23572 def duration_in_months @duration_in_months end |
#ends_at ⇒ String? (readonly)
Timestamp after which the discount is no longer redeemable.
23610 23611 23612 |
# File 'lib/pago/v2026_04/models.rb', line 23610 def ends_at @ends_at end |
#id ⇒ String (readonly)
The ID of the object.
23591 23592 23593 |
# File 'lib/pago/v2026_04/models.rb', line 23591 def id @id end |
#max_redemptions ⇒ Integer? (readonly)
Maximum number of times the discount can be redeemed.
23614 23615 23616 |
# File 'lib/pago/v2026_04/models.rb', line 23614 def max_redemptions @max_redemptions end |
#metadata ⇒ Hash{String => String, Integer, Float, Boolean} (readonly)
23594 23595 23596 |
# File 'lib/pago/v2026_04/models.rb', line 23594 def @metadata end |
#modified_at ⇒ String? (readonly)
Last modification timestamp of the object.
23587 23588 23589 |
# File 'lib/pago/v2026_04/models.rb', line 23587 def modified_at @modified_at end |
#name ⇒ String (readonly)
Name of the discount. Will be displayed to the customer when the discount is applied.
23598 23599 23600 |
# File 'lib/pago/v2026_04/models.rb', line 23598 def name @name end |
#organization_id ⇒ String (readonly)
The organization ID.
23622 23623 23624 |
# File 'lib/pago/v2026_04/models.rb', line 23622 def organization_id @organization_id end |
#products ⇒ Array<Models::DiscountProduct> (readonly)
23625 23626 23627 |
# File 'lib/pago/v2026_04/models.rb', line 23625 def products @products end |
#redemptions_count ⇒ Integer (readonly)
Number of times the discount has been redeemed.
23618 23619 23620 |
# File 'lib/pago/v2026_04/models.rb', line 23618 def redemptions_count @redemptions_count end |
#starts_at ⇒ String? (readonly)
Timestamp after which the discount is redeemable.
23606 23607 23608 |
# File 'lib/pago/v2026_04/models.rb', line 23606 def starts_at @starts_at end |
#type ⇒ String (readonly)
23575 23576 23577 |
# File 'lib/pago/v2026_04/models.rb', line 23575 def type @type end |
Class Method Details
.from_json(data) ⇒ DiscountPercentageRepeatDuration?
23666 23667 23668 23669 23670 23671 23672 23673 23674 23675 23676 23677 23678 23679 23680 23681 23682 23683 23684 23685 23686 23687 23688 23689 23690 23691 23692 |
# File 'lib/pago/v2026_04/models.rb', line 23666 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), duration_in_months: (data.key?("duration_in_months") ? data["duration_in_months"] : ::Pago::UNSET), type: (data.key?("type") ? data["type"] : ::Pago::UNSET), basis_points: (data.key?("basis_points") ? data["basis_points"] : ::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 |