Class: Pago::V2026_04::Models::CheckoutDiscountFixedRepeatDuration

Inherits:
Model
  • Object
show all
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 =

Returns:

  • (Hash[Symbol, String])
{
  duration: "duration",
  duration_in_months: "duration_in_months",
  type: "type",
  amount: "amount",
  currency: "currency",
  amounts: "amounts",
  id: "id",
  name: "name",
  code: "code"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["duration", "duration_in_months", "type", "amount", "currency", "amounts", "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:, amount:, currency:, amounts:, id:, name:, code:) ⇒ CheckoutDiscountFixedRepeatDuration

Returns a new instance of CheckoutDiscountFixedRepeatDuration.

Parameters:

  • duration: (String)
  • duration_in_months: (Integer)
  • type: (String)
  • amount: (Integer)
  • currency: (String)
  • amounts: (Hash[String, Integer])
  • id: (String)
  • name: (String)
  • code: (String, nil)


10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
# File 'lib/pago/v2026_04/models.rb', line 10369

def initialize(
  duration:,
  duration_in_months:,
  type:,
  amount:,
  currency:,
  amounts:,
  id:,
  name:,
  code:
)
  super()
  assign(:duration, duration)
  assign(:duration_in_months, duration_in_months)
  assign(:type, type)
  assign(:amount, amount)
  assign(:currency, currency)
  assign(:amounts, amounts)
  assign(:id, id)
  assign(:name, name)
  assign(:code, code)
end

Instance Attribute Details

#amountInteger (readonly)

Deprecated.

Returns:

  • (Integer)


10349
10350
10351
# File 'lib/pago/v2026_04/models.rb', line 10349

def amount
  @amount
end

#amountsHash{String => Integer} (readonly)

Map of currency to fixed amount to discount from the total.

Returns:

  • (Hash{String => Integer})


10357
10358
10359
# File 'lib/pago/v2026_04/models.rb', line 10357

def amounts
  @amounts
end

#codeString? (readonly)

Returns:

  • (String, nil)


10367
10368
10369
# File 'lib/pago/v2026_04/models.rb', line 10367

def code
  @code
end

#currencyString (readonly)

Deprecated.

Returns:

  • (String)


10353
10354
10355
# File 'lib/pago/v2026_04/models.rb', line 10353

def currency
  @currency
end

#durationString (readonly)

Returns:

  • (String)


10339
10340
10341
# File 'lib/pago/v2026_04/models.rb', line 10339

def duration
  @duration
end

#duration_in_monthsInteger (readonly)

Returns:

  • (Integer)


10342
10343
10344
# File 'lib/pago/v2026_04/models.rb', line 10342

def duration_in_months
  @duration_in_months
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


10361
10362
10363
# File 'lib/pago/v2026_04/models.rb', line 10361

def id
  @id
end

#nameString (readonly)

Returns:

  • (String)


10364
10365
10366
# File 'lib/pago/v2026_04/models.rb', line 10364

def name
  @name
end

#typeString (readonly)

Returns:

  • (String)


10345
10346
10347
# File 'lib/pago/v2026_04/models.rb', line 10345

def type
  @type
end

Class Method Details

.from_json(data) ⇒ CheckoutDiscountFixedRepeatDuration?

Parameters:

  • data (Hash, String, nil)

Returns:



10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
# File 'lib/pago/v2026_04/models.rb', line 10394

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),
      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