Class: Pago::V2026_04::Models::DiscountUpdate
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
Schema to update a discount.
Constant Summary collapse
- JSON_KEYS =
{ metadata: "metadata", name: "name", code: "code", starts_at: "starts_at", ends_at: "ends_at", max_redemptions: "max_redemptions", duration: "duration", duration_in_months: "duration_in_months", type: "type", amount: "amount", currency: "currency", amounts: "amounts", basis_points: "basis_points", products: "products" }.freeze
- REQUIRED_KEYS =
[].freeze
Instance Attribute Summary collapse
- #amount ⇒ Integer? readonly deprecated Deprecated.
- #amounts ⇒ Hash{String => Integer}? readonly
- #basis_points ⇒ Integer? readonly
-
#code ⇒ String?
readonly
Code customers can use to apply the discount during checkout.
- #currency ⇒ String? readonly deprecated Deprecated.
- #duration ⇒ String? readonly
- #duration_in_months ⇒ Integer? readonly
-
#ends_at ⇒ String?
readonly
Optional timestamp after which the discount is no longer redeemable.
-
#max_redemptions ⇒ Integer?
readonly
Optional maximum number of times the discount can be redeemed.
-
#metadata ⇒ Hash{String => String, Integer, Float, Boolean}
readonly
Key-value object allowing you to store additional information.
- #name ⇒ String? readonly
- #products ⇒ Array<String>? readonly
-
#starts_at ⇒ String?
readonly
Optional timestamp after which the discount is redeemable.
- #type ⇒ String? readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metadata: ::Pago::UNSET, name: ::Pago::UNSET, code: ::Pago::UNSET, starts_at: ::Pago::UNSET, ends_at: ::Pago::UNSET, max_redemptions: ::Pago::UNSET, duration: ::Pago::UNSET, duration_in_months: ::Pago::UNSET, type: ::Pago::UNSET, amount: ::Pago::UNSET, currency: ::Pago::UNSET, amounts: ::Pago::UNSET, basis_points: ::Pago::UNSET, products: ::Pago::UNSET) ⇒ DiscountUpdate
constructor
A new instance of DiscountUpdate.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(metadata: ::Pago::UNSET, name: ::Pago::UNSET, code: ::Pago::UNSET, starts_at: ::Pago::UNSET, ends_at: ::Pago::UNSET, max_redemptions: ::Pago::UNSET, duration: ::Pago::UNSET, duration_in_months: ::Pago::UNSET, type: ::Pago::UNSET, amount: ::Pago::UNSET, currency: ::Pago::UNSET, amounts: ::Pago::UNSET, basis_points: ::Pago::UNSET, products: ::Pago::UNSET) ⇒ DiscountUpdate
Returns a new instance of DiscountUpdate.
24067 24068 24069 24070 24071 24072 24073 24074 24075 24076 24077 24078 24079 24080 24081 24082 24083 24084 24085 24086 24087 24088 24089 24090 24091 24092 24093 24094 24095 24096 24097 24098 |
# File 'lib/pago/v2026_04/models.rb', line 24067 def initialize( metadata: ::Pago::UNSET, name: ::Pago::UNSET, code: ::Pago::UNSET, starts_at: ::Pago::UNSET, ends_at: ::Pago::UNSET, max_redemptions: ::Pago::UNSET, duration: ::Pago::UNSET, duration_in_months: ::Pago::UNSET, type: ::Pago::UNSET, amount: ::Pago::UNSET, currency: ::Pago::UNSET, amounts: ::Pago::UNSET, basis_points: ::Pago::UNSET, products: ::Pago::UNSET ) super() assign(:metadata, ) assign(:name, name) assign(:code, code) assign(:starts_at, starts_at) assign(:ends_at, ends_at) assign(:max_redemptions, max_redemptions) assign(:duration, duration) assign(:duration_in_months, duration_in_months) assign(:type, type) assign(:amount, amount) assign(:currency, currency) assign(:amounts, amounts) assign(:basis_points, basis_points) assign(:products, products) end |
Instance Attribute Details
#amount ⇒ Integer? (readonly)
24052 24053 24054 |
# File 'lib/pago/v2026_04/models.rb', line 24052 def amount @amount end |
#amounts ⇒ Hash{String => Integer}? (readonly)
24059 24060 24061 |
# File 'lib/pago/v2026_04/models.rb', line 24059 def amounts @amounts end |
#basis_points ⇒ Integer? (readonly)
24062 24063 24064 |
# File 'lib/pago/v2026_04/models.rb', line 24062 def basis_points @basis_points end |
#code ⇒ String? (readonly)
Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API.
24027 24028 24029 |
# File 'lib/pago/v2026_04/models.rb', line 24027 def code @code end |
#currency ⇒ String? (readonly)
24056 24057 24058 |
# File 'lib/pago/v2026_04/models.rb', line 24056 def currency @currency end |
#duration ⇒ String? (readonly)
24042 24043 24044 |
# File 'lib/pago/v2026_04/models.rb', line 24042 def duration @duration end |
#duration_in_months ⇒ Integer? (readonly)
24045 24046 24047 |
# File 'lib/pago/v2026_04/models.rb', line 24045 def duration_in_months @duration_in_months end |
#ends_at ⇒ String? (readonly)
Optional timestamp after which the discount is no longer redeemable.
24035 24036 24037 |
# File 'lib/pago/v2026_04/models.rb', line 24035 def ends_at @ends_at end |
#max_redemptions ⇒ Integer? (readonly)
Optional maximum number of times the discount can be redeemed.
24039 24040 24041 |
# File 'lib/pago/v2026_04/models.rb', line 24039 def max_redemptions @max_redemptions end |
#metadata ⇒ Hash{String => String, Integer, Float, Boolean} (readonly)
Key-value object allowing you to store additional information.
The key must be a string with a maximum length of 40 characters. The value must be either:
- A string with a maximum length of 500 characters
- An integer
- A floating-point number
- A boolean
You can store up to 50 key-value pairs.
24020 24021 24022 |
# File 'lib/pago/v2026_04/models.rb', line 24020 def @metadata end |
#name ⇒ String? (readonly)
24023 24024 24025 |
# File 'lib/pago/v2026_04/models.rb', line 24023 def name @name end |
#products ⇒ Array<String>? (readonly)
24065 24066 24067 |
# File 'lib/pago/v2026_04/models.rb', line 24065 def products @products end |
#starts_at ⇒ String? (readonly)
Optional timestamp after which the discount is redeemable.
24031 24032 24033 |
# File 'lib/pago/v2026_04/models.rb', line 24031 def starts_at @starts_at end |
#type ⇒ String? (readonly)
24048 24049 24050 |
# File 'lib/pago/v2026_04/models.rb', line 24048 def type @type end |
Class Method Details
.from_json(data) ⇒ DiscountUpdate?
24102 24103 24104 24105 24106 24107 24108 24109 24110 24111 24112 24113 24114 24115 24116 24117 24118 24119 24120 24121 24122 24123 24124 24125 24126 |
# File 'lib/pago/v2026_04/models.rb', line 24102 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( 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), 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), basis_points: (data.key?("basis_points") ? data["basis_points"] : ::Pago::UNSET), products: (data.key?("products") ? data["products"] : ::Pago::UNSET) ), data ) end |