Class: Pago::V2026_04::Models::BenefitDiscordUpdate

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])
{
  metadata: "metadata",
  description: "description",
  type: "type",
  properties: "properties"
}.freeze
REQUIRED_KEYS =

Returns:

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

Returns a new instance of BenefitDiscordUpdate.

Parameters:

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


3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
# File 'lib/pago/v2026_04/models.rb', line 3093

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

Instance Attribute Details

#descriptionString? (readonly)

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

Returns:

  • (String, nil)


3085
3086
3087
# File 'lib/pago/v2026_04/models.rb', line 3085

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


3081
3082
3083
# File 'lib/pago/v2026_04/models.rb', line 3081

def 
  @metadata
end

#propertiesModels::BenefitDiscordCreateProperties? (readonly)



3091
3092
3093
# File 'lib/pago/v2026_04/models.rb', line 3091

def properties
  @properties
end

#typeString (readonly)

Returns:

  • (String)


3088
3089
3090
# File 'lib/pago/v2026_04/models.rb', line 3088

def type
  @type
end

Class Method Details

.from_json(data) ⇒ BenefitDiscordUpdate?

Parameters:

  • data (Hash, String, nil)

Returns:



3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
# File 'lib/pago/v2026_04/models.rb', line 3108

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