Class: Pago::V2026_04::Models::BenefitDiscordCreate

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",
  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:) ⇒ BenefitDiscordCreate

Returns a new instance of BenefitDiscordCreate.

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


2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
# File 'lib/pago/v2026_04/models.rb', line 2772

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)


2759
2760
2761
# File 'lib/pago/v2026_04/models.rb', line 2759

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


2752
2753
2754
# File 'lib/pago/v2026_04/models.rb', line 2752

def 
  @metadata
end

#organization_idString? (readonly)

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

Returns:

  • (String, nil)


2763
2764
2765
# File 'lib/pago/v2026_04/models.rb', line 2763

def organization_id
  @organization_id
end

#propertiesModels::BenefitDiscordCreateProperties (readonly)



2770
2771
2772
# File 'lib/pago/v2026_04/models.rb', line 2770

def properties
  @properties
end

#typeString (readonly)

Returns:

  • (String)


2755
2756
2757
# File 'lib/pago/v2026_04/models.rb', line 2755

def type
  @type
end

#visibilityString? (readonly)

The visibility of the benefit in the customer portal.

Returns:

  • (String, nil)


2767
2768
2769
# File 'lib/pago/v2026_04/models.rb', line 2767

def visibility
  @visibility
end

Class Method Details

.from_json(data) ⇒ BenefitDiscordCreate?

Parameters:

  • data (Hash, String, nil)

Returns:



2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
# File 'lib/pago/v2026_04/models.rb', line 2791

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