Class: Pago::V2026_04::Models::BenefitMeterCreditCreate

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

Overview

Schema to create a benefit of type meter_unit.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  metadata: "metadata",
  type: "type",
  description: "description",
  organization_id: "organization_id",
  visibility: "visibility",
  properties: "properties"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["type", "description", "properties"].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(metadata: ::Pago::UNSET, type:, description:, organization_id: ::Pago::UNSET, visibility: ::Pago::UNSET, properties:) ⇒ BenefitMeterCreditCreate

Returns a new instance of BenefitMeterCreditCreate.

Parameters:

  • metadata: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • type: (String)
  • description: (String)
  • organization_id: (String, nil) (defaults to: ::Pago::UNSET)
  • visibility: (String, nil) (defaults to: ::Pago::UNSET)
  • properties: (Models::BenefitMeterCreditCreateProperties)


7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
# File 'lib/pago/v2026_04/models.rb', line 7480

def initialize(
  metadata: ::Pago::UNSET,
  type:,
  description:,
  organization_id: ::Pago::UNSET,
  visibility: ::Pago::UNSET,
  properties:
)
  super()
  assign(:metadata, )
  assign(:type, type)
  assign(:description, description)
  assign(:organization_id, organization_id)
  assign(:visibility, visibility)
  assign(:properties, properties)
end

Instance Attribute Details

#descriptionString (readonly)

The description of the benefit. Will be displayed on products having this benefit.

Returns:

  • (String)


7467
7468
7469
# File 'lib/pago/v2026_04/models.rb', line 7467

def description
  @description
end

#metadataHash{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.

Returns:

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


7460
7461
7462
# File 'lib/pago/v2026_04/models.rb', line 7460

def 
  @metadata
end

#organization_idString? (readonly)

The ID of the organization owning the benefit. Required unless you use an organization token.

Returns:

  • (String, nil)


7471
7472
7473
# File 'lib/pago/v2026_04/models.rb', line 7471

def organization_id
  @organization_id
end

#propertiesModels::BenefitMeterCreditCreateProperties (readonly)



7478
7479
7480
# File 'lib/pago/v2026_04/models.rb', line 7478

def properties
  @properties
end

#typeString (readonly)

Returns:

  • (String)


7463
7464
7465
# File 'lib/pago/v2026_04/models.rb', line 7463

def type
  @type
end

#visibilityString? (readonly)

The visibility of the benefit in the customer portal.

Returns:

  • (String, nil)


7475
7476
7477
# File 'lib/pago/v2026_04/models.rb', line 7475

def visibility
  @visibility
end

Class Method Details

.from_json(data) ⇒ BenefitMeterCreditCreate?

Parameters:

  • data (Hash, String, nil)

Returns:



7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
# File 'lib/pago/v2026_04/models.rb', line 7499

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),
      type: (data.key?("type") ? data["type"] : ::Pago::UNSET),
      description: (data.key?("description") ? data["description"] : ::Pago::UNSET),
      organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET),
      visibility: (data.key?("visibility") ? data["visibility"] : ::Pago::UNSET),
      properties: (data.key?("properties") ? Models::BenefitMeterCreditCreateProperties.from_json(data["properties"]) : ::Pago::UNSET)
    ),
    data
  )
end