Class: Pago::V2026_04::Models::DiscountPercentageRepeatDurationBase

Inherits:
Model
  • Object
show all
Defined in:
lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  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"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["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"].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:, created_at:, modified_at:, id:, metadata:, name:, code:, starts_at:, ends_at:, max_redemptions:, redemptions_count:, organization_id:) ⇒ DiscountPercentageRepeatDurationBase

Returns a new instance of DiscountPercentageRepeatDurationBase.

Parameters:

  • duration: (String)
  • duration_in_months: (Integer)
  • type: (String)
  • basis_points: (Integer)
  • created_at: (String)
  • modified_at: (String, nil)
  • id: (String)
  • metadata: (Hash[String, untyped])
  • name: (String)
  • code: (String, nil)
  • starts_at: (String, nil)
  • ends_at: (String, nil)
  • max_redemptions: (Integer, nil)
  • redemptions_count: (Integer)
  • organization_id: (String)


23771
23772
23773
23774
23775
23776
23777
23778
23779
23780
23781
23782
23783
23784
23785
23786
23787
23788
23789
23790
23791
23792
23793
23794
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
# File 'lib/pago/v2026_04/models.rb', line 23771

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:
)
  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)
end

Instance Attribute Details

#basis_pointsInteger (readonly)

Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.

Returns:

  • (Integer)


23726
23727
23728
# File 'lib/pago/v2026_04/models.rb', line 23726

def basis_points
  @basis_points
end

#codeString? (readonly)

Code customers can use to apply the discount during checkout.

Returns:

  • (String, nil)


23749
23750
23751
# File 'lib/pago/v2026_04/models.rb', line 23749

def code
  @code
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


23730
23731
23732
# File 'lib/pago/v2026_04/models.rb', line 23730

def created_at
  @created_at
end

#durationString (readonly)

Returns:

  • (String)


23716
23717
23718
# File 'lib/pago/v2026_04/models.rb', line 23716

def duration
  @duration
end

#duration_in_monthsInteger (readonly)

Returns:

  • (Integer)


23719
23720
23721
# File 'lib/pago/v2026_04/models.rb', line 23719

def duration_in_months
  @duration_in_months
end

#ends_atString? (readonly)

Timestamp after which the discount is no longer redeemable.

Returns:

  • (String, nil)


23757
23758
23759
# File 'lib/pago/v2026_04/models.rb', line 23757

def ends_at
  @ends_at
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


23738
23739
23740
# File 'lib/pago/v2026_04/models.rb', line 23738

def id
  @id
end

#max_redemptionsInteger? (readonly)

Maximum number of times the discount can be redeemed.

Returns:

  • (Integer, nil)


23761
23762
23763
# File 'lib/pago/v2026_04/models.rb', line 23761

def max_redemptions
  @max_redemptions
end

#metadataHash{String => String, Integer, Float, Boolean} (readonly)

Returns:

  • (Hash{String => String, Integer, Float, Boolean})


23741
23742
23743
# File 'lib/pago/v2026_04/models.rb', line 23741

def 
  @metadata
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


23734
23735
23736
# File 'lib/pago/v2026_04/models.rb', line 23734

def modified_at
  @modified_at
end

#nameString (readonly)

Name of the discount. Will be displayed to the customer when the discount is applied.

Returns:

  • (String)


23745
23746
23747
# File 'lib/pago/v2026_04/models.rb', line 23745

def name
  @name
end

#organization_idString (readonly)

The organization ID.

Returns:

  • (String)


23769
23770
23771
# File 'lib/pago/v2026_04/models.rb', line 23769

def organization_id
  @organization_id
end

#redemptions_countInteger (readonly)

Number of times the discount has been redeemed.

Returns:

  • (Integer)


23765
23766
23767
# File 'lib/pago/v2026_04/models.rb', line 23765

def redemptions_count
  @redemptions_count
end

#starts_atString? (readonly)

Timestamp after which the discount is redeemable.

Returns:

  • (String, nil)


23753
23754
23755
# File 'lib/pago/v2026_04/models.rb', line 23753

def starts_at
  @starts_at
end

#typeString (readonly)

Returns:

  • (String)


23722
23723
23724
# File 'lib/pago/v2026_04/models.rb', line 23722

def type
  @type
end

Class Method Details

.from_json(data) ⇒ DiscountPercentageRepeatDurationBase?

Parameters:

  • data (Hash, String, nil)

Returns:



23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829
23830
23831
23832
23833
# File 'lib/pago/v2026_04/models.rb', line 23808

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