Class: Pago::V2026_04::Models::ProductMediaFileCreate

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

Overview

Schema to create a file to be used as a product media file.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  organization_id: "organization_id",
  name: "name",
  mime_type: "mime_type",
  size: "size",
  checksum_sha256_base64: "checksum_sha256_base64",
  upload: "upload",
  service: "service",
  version: "version"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["name", "mime_type", "size", "upload", "service"].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(organization_id: ::Pago::UNSET, name:, mime_type:, size:, checksum_sha256_base64: ::Pago::UNSET, upload:, service:, version: ::Pago::UNSET) ⇒ ProductMediaFileCreate

Returns a new instance of ProductMediaFileCreate.

Parameters:

  • organization_id: (String, nil) (defaults to: ::Pago::UNSET)
  • name: (String)
  • mime_type: (String)
  • size: (Integer)
  • checksum_sha256_base64: (String, nil) (defaults to: ::Pago::UNSET)
  • upload: (Models::S3FileCreateMultipart)
  • service: (String)
  • version: (String, nil) (defaults to: ::Pago::UNSET)


36510
36511
36512
36513
36514
36515
36516
36517
36518
36519
36520
36521
36522
36523
36524
36525
36526
36527
36528
36529
# File 'lib/pago/v2026_04/models.rb', line 36510

def initialize(
  organization_id: ::Pago::UNSET,
  name:,
  mime_type:,
  size:,
  checksum_sha256_base64: ::Pago::UNSET,
  upload:,
  service:,
  version: ::Pago::UNSET
)
  super()
  assign(:organization_id, organization_id)
  assign(:name, name)
  assign(:mime_type, mime_type)
  assign(:size, size)
  assign(:checksum_sha256_base64, checksum_sha256_base64)
  assign(:upload, upload)
  assign(:service, service)
  assign(:version, version)
end

Instance Attribute Details

#checksum_sha256_base64String? (readonly)

Returns:

  • (String, nil)


36499
36500
36501
# File 'lib/pago/v2026_04/models.rb', line 36499

def checksum_sha256_base64
  @checksum_sha256_base64
end

#mime_typeString (readonly)

MIME type of the file. Only images are supported for this type of file.

Returns:

  • (String)


36492
36493
36494
# File 'lib/pago/v2026_04/models.rb', line 36492

def mime_type
  @mime_type
end

#nameString (readonly)

Returns:

  • (String)


36488
36489
36490
# File 'lib/pago/v2026_04/models.rb', line 36488

def name
  @name
end

#organization_idString? (readonly)

Returns:

  • (String, nil)


36485
36486
36487
# File 'lib/pago/v2026_04/models.rb', line 36485

def organization_id
  @organization_id
end

#serviceString (readonly)

Returns:

  • (String)


36505
36506
36507
# File 'lib/pago/v2026_04/models.rb', line 36505

def service
  @service
end

#sizeInteger (readonly)

Size of the file. A maximum of 10 MB is allowed for this type of file.

Returns:

  • (Integer)


36496
36497
36498
# File 'lib/pago/v2026_04/models.rb', line 36496

def size
  @size
end

#uploadModels::S3FileCreateMultipart (readonly)



36502
36503
36504
# File 'lib/pago/v2026_04/models.rb', line 36502

def upload
  @upload
end

#versionString? (readonly)

Returns:

  • (String, nil)


36508
36509
36510
# File 'lib/pago/v2026_04/models.rb', line 36508

def version
  @version
end

Class Method Details

.from_json(data) ⇒ ProductMediaFileCreate?

Parameters:

  • data (Hash, String, nil)

Returns:



36533
36534
36535
36536
36537
36538
36539
36540
36541
36542
36543
36544
36545
36546
36547
36548
36549
36550
36551
# File 'lib/pago/v2026_04/models.rb', line 36533

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(
      organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET),
      name: (data.key?("name") ? data["name"] : ::Pago::UNSET),
      mime_type: (data.key?("mime_type") ? data["mime_type"] : ::Pago::UNSET),
      size: (data.key?("size") ? data["size"] : ::Pago::UNSET),
      checksum_sha256_base64: (data.key?("checksum_sha256_base64") ? data["checksum_sha256_base64"] : ::Pago::UNSET),
      upload: (data.key?("upload") ? Models::S3FileCreateMultipart.from_json(data["upload"]) : ::Pago::UNSET),
      service: (data.key?("service") ? data["service"] : ::Pago::UNSET),
      version: (data.key?("version") ? data["version"] : ::Pago::UNSET)
    ),
    data
  )
end