Class: Pago::V2026_04::Models::CheckoutDiscountPercentageRepeatDuration
- Inherits:
-
Model
- Object
- Model
- Pago::V2026_04::Models::CheckoutDiscountPercentageRepeatDuration
show all
- 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",
id: "id",
name: "name",
code: "code"
}.freeze
- REQUIRED_KEYS =
["duration", "duration_in_months", "type", "basis_points", "id", "name", "code"].freeze
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
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:, id:, name:, code:) ⇒ CheckoutDiscountPercentageRepeatDuration
Returns a new instance of CheckoutDiscountPercentageRepeatDuration.
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
|
# File 'lib/pago/v2026_04/models.rb', line 10523
def initialize(
duration:,
duration_in_months:,
type:,
basis_points:,
id:,
name:,
code:
)
super()
assign(:duration, duration)
assign(:duration_in_months, duration_in_months)
assign(:type, type)
assign(:basis_points, basis_points)
assign(:id, id)
assign(:name, name)
assign(:code, code)
end
|
Instance Attribute Details
#basis_points ⇒ Integer
Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.
10511
10512
10513
|
# File 'lib/pago/v2026_04/models.rb', line 10511
def basis_points
@basis_points
end
|
#code ⇒ String?
10521
10522
10523
|
# File 'lib/pago/v2026_04/models.rb', line 10521
def code
@code
end
|
#duration ⇒ String
10501
10502
10503
|
# File 'lib/pago/v2026_04/models.rb', line 10501
def duration
@duration
end
|
#duration_in_months ⇒ Integer
10504
10505
10506
|
# File 'lib/pago/v2026_04/models.rb', line 10504
def duration_in_months
@duration_in_months
end
|
#id ⇒ String
10515
10516
10517
|
# File 'lib/pago/v2026_04/models.rb', line 10515
def id
@id
end
|
#name ⇒ String
10518
10519
10520
|
# File 'lib/pago/v2026_04/models.rb', line 10518
def name
@name
end
|
#type ⇒ String
10507
10508
10509
|
# File 'lib/pago/v2026_04/models.rb', line 10507
def type
@type
end
|
Class Method Details
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
|
# File 'lib/pago/v2026_04/models.rb', line 10544
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),
id: (data.key?("id") ? data["id"] : ::Pago::UNSET),
name: (data.key?("name") ? data["name"] : ::Pago::UNSET),
code: (data.key?("code") ? data["code"] : ::Pago::UNSET)
),
data
)
end
|