Class: Pago::V2026_04::Models::SubscriptionUpdateBase

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])
{
  product_id: "product_id",
  proration_behavior: "proration_behavior",
  discount_id: "discount_id",
  trial_end: "trial_end"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
[].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(product_id: ::Pago::UNSET, proration_behavior: ::Pago::UNSET, discount_id: ::Pago::UNSET, trial_end: ::Pago::UNSET) ⇒ SubscriptionUpdateBase

Returns a new instance of SubscriptionUpdateBase.

Parameters:

  • product_id: (String, nil) (defaults to: ::Pago::UNSET)
  • proration_behavior: (String, nil) (defaults to: ::Pago::UNSET)
  • discount_id: (String, nil) (defaults to: ::Pago::UNSET)
  • trial_end: (Object) (defaults to: ::Pago::UNSET)


42674
42675
42676
42677
42678
42679
42680
42681
42682
42683
42684
42685
# File 'lib/pago/v2026_04/models.rb', line 42674

def initialize(
  product_id: ::Pago::UNSET,
  proration_behavior: ::Pago::UNSET,
  discount_id: ::Pago::UNSET,
  trial_end: ::Pago::UNSET
)
  super()
  assign(:product_id, product_id)
  assign(:proration_behavior, proration_behavior)
  assign(:discount_id, discount_id)
  assign(:trial_end, trial_end)
end

Instance Attribute Details

#discount_idString? (readonly)

Update the subscription to apply a new discount. If set to null, the discount will be removed. The change will be applied on the next billing cycle.

Returns:

  • (String, nil)


42668
42669
42670
# File 'lib/pago/v2026_04/models.rb', line 42668

def discount_id
  @discount_id
end

#product_idString? (readonly)

Update subscription to another product.

Returns:

  • (String, nil)


42660
42661
42662
# File 'lib/pago/v2026_04/models.rb', line 42660

def product_id
  @product_id
end

#proration_behaviorString? (readonly)

Determine how to handle the proration billing. If not provided, will use the default organization setting.

Returns:

  • (String, nil)


42664
42665
42666
# File 'lib/pago/v2026_04/models.rb', line 42664

def proration_behavior
  @proration_behavior
end

#trial_endString? (readonly)

Set or extend the trial period of the subscription. If set to now, the trial will end immediately.

Returns:

  • (String, nil)


42672
42673
42674
# File 'lib/pago/v2026_04/models.rb', line 42672

def trial_end
  @trial_end
end

Class Method Details

.from_json(data) ⇒ SubscriptionUpdateBase?

Parameters:

  • data (Hash, String, nil)

Returns:



42689
42690
42691
42692
42693
42694
42695
42696
42697
42698
42699
42700
42701
42702
42703
# File 'lib/pago/v2026_04/models.rb', line 42689

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(
      product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET),
      proration_behavior: (data.key?("proration_behavior") ? data["proration_behavior"] : ::Pago::UNSET),
      discount_id: (data.key?("discount_id") ? data["discount_id"] : ::Pago::UNSET),
      trial_end: (data.key?("trial_end") ? data["trial_end"] : ::Pago::UNSET)
    ),
    data
  )
end