Class: Pago::V2026_04::Models::DiscountFixedRepeatDuration
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
Schema for a fixed amount 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", 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", "duration_in_months", "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
- #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:, amount:, currency:, amounts:, created_at:, modified_at:, id:, metadata:, name:, code:, starts_at:, ends_at:, max_redemptions:, redemptions_count:, organization_id:, products:) ⇒ DiscountFixedRepeatDuration
constructor
A new instance of DiscountFixedRepeatDuration.
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:, amount:, currency:, amounts:, created_at:, modified_at:, id:, metadata:, name:, code:, starts_at:, ends_at:, max_redemptions:, redemptions_count:, organization_id:, products:) ⇒ DiscountFixedRepeatDuration
Returns a new instance of DiscountFixedRepeatDuration.
22901 22902 22903 22904 22905 22906 22907 22908 22909 22910 22911 22912 22913 22914 22915 22916 22917 22918 22919 22920 22921 22922 22923 22924 22925 22926 22927 22928 22929 22930 22931 22932 22933 22934 22935 22936 22937 22938 22939 22940 |
# File 'lib/pago/v2026_04/models.rb', line 22901 def initialize( duration:, duration_in_months:, 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(:duration_in_months, duration_in_months) 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)
22845 22846 22847 |
# File 'lib/pago/v2026_04/models.rb', line 22845 def amount @amount end |
#amounts ⇒ Hash{String => Integer} (readonly)
Map of currency to fixed amount to discount from the total.
22853 22854 22855 |
# File 'lib/pago/v2026_04/models.rb', line 22853 def amounts @amounts end |
#code ⇒ String? (readonly)
Code customers can use to apply the discount during checkout.
22876 22877 22878 |
# File 'lib/pago/v2026_04/models.rb', line 22876 def code @code end |
#created_at ⇒ String (readonly)
Creation timestamp of the object.
22857 22858 22859 |
# File 'lib/pago/v2026_04/models.rb', line 22857 def created_at @created_at end |
#currency ⇒ String (readonly)
22849 22850 22851 |
# File 'lib/pago/v2026_04/models.rb', line 22849 def currency @currency end |
#duration ⇒ String (readonly)
22835 22836 22837 |
# File 'lib/pago/v2026_04/models.rb', line 22835 def duration @duration end |
#duration_in_months ⇒ Integer (readonly)
22838 22839 22840 |
# File 'lib/pago/v2026_04/models.rb', line 22838 def duration_in_months @duration_in_months end |
#ends_at ⇒ String? (readonly)
Timestamp after which the discount is no longer redeemable.
22884 22885 22886 |
# File 'lib/pago/v2026_04/models.rb', line 22884 def ends_at @ends_at end |
#id ⇒ String (readonly)
The ID of the object.
22865 22866 22867 |
# File 'lib/pago/v2026_04/models.rb', line 22865 def id @id end |
#max_redemptions ⇒ Integer? (readonly)
Maximum number of times the discount can be redeemed.
22888 22889 22890 |
# File 'lib/pago/v2026_04/models.rb', line 22888 def max_redemptions @max_redemptions end |
#metadata ⇒ Hash{String => String, Integer, Float, Boolean} (readonly)
22868 22869 22870 |
# File 'lib/pago/v2026_04/models.rb', line 22868 def @metadata end |
#modified_at ⇒ String? (readonly)
Last modification timestamp of the object.
22861 22862 22863 |
# File 'lib/pago/v2026_04/models.rb', line 22861 def modified_at @modified_at end |
#name ⇒ String (readonly)
Name of the discount. Will be displayed to the customer when the discount is applied.
22872 22873 22874 |
# File 'lib/pago/v2026_04/models.rb', line 22872 def name @name end |
#organization_id ⇒ String (readonly)
The organization ID.
22896 22897 22898 |
# File 'lib/pago/v2026_04/models.rb', line 22896 def organization_id @organization_id end |
#products ⇒ Array<Models::DiscountProduct> (readonly)
22899 22900 22901 |
# File 'lib/pago/v2026_04/models.rb', line 22899 def products @products end |
#redemptions_count ⇒ Integer (readonly)
Number of times the discount has been redeemed.
22892 22893 22894 |
# File 'lib/pago/v2026_04/models.rb', line 22892 def redemptions_count @redemptions_count end |
#starts_at ⇒ String? (readonly)
Timestamp after which the discount is redeemable.
22880 22881 22882 |
# File 'lib/pago/v2026_04/models.rb', line 22880 def starts_at @starts_at end |
#type ⇒ String (readonly)
22841 22842 22843 |
# File 'lib/pago/v2026_04/models.rb', line 22841 def type @type end |
Class Method Details
.from_json(data) ⇒ DiscountFixedRepeatDuration?
22944 22945 22946 22947 22948 22949 22950 22951 22952 22953 22954 22955 22956 22957 22958 22959 22960 22961 22962 22963 22964 22965 22966 22967 22968 22969 22970 22971 22972 |
# File 'lib/pago/v2026_04/models.rb', line 22944 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), 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 |