Class: UnivapayClientSdk::TokenResponseQrMerchantData

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb

Overview

Token Response Qr Merchant Data schema.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(qr_image_url:, brand: SKIP, additional_properties: nil) ⇒ TokenResponseQrMerchantData

Returns a new instance of TokenResponseQrMerchantData.



47
48
49
50
51
52
53
54
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 47

def initialize(qr_image_url:, brand: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @qr_image_url = qr_image_url
  @brand = brand unless brand == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#brandString

The QR-MPM brand this code was generated for.

Returns:

  • (String)


22
23
24
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 22

def brand
  @brand
end

#qr_image_urlString

QR code payload to be rendered by the consumer (content varies by brand — may be a URL or an opaque code). Some brands return an image URL; others (e.g. convenience-store QR brands) return an opaque numeric code with no URL structure. Populated asynchronously shortly after token/charge creation — null until then.

Returns:

  • (String)


18
19
20
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 18

def qr_image_url
  @qr_image_url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 57

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  qr_image_url = hash.key?('qr_image_url') ? hash['qr_image_url'] : nil
  brand = hash.key?('brand') ? hash['brand'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  TokenResponseQrMerchantData.new(qr_image_url: qr_image_url,
                                  brand: brand,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['qr_image_url'] = 'qr_image_url'
  @_hash['brand'] = 'brand'
  @_hash
end

.nullablesObject

An array for nullable fields



40
41
42
43
44
45
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 40

def self.nullables
  %w[
    qr_image_url
    brand
  ]
end

.optionalsObject

An array for optional fields



33
34
35
36
37
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 33

def self.optionals
  %w[
    brand
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 79

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.qr_image_url,
                                 ->(val) { val.instance_of? String })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['qr_image_url'],
                        ->(val) { val.instance_of? String })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



99
100
101
102
103
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 99

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} qr_image_url: #{@qr_image_url.inspect}, brand: #{@brand.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



92
93
94
95
96
# File 'lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb', line 92

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} qr_image_url: #{@qr_image_url}, brand: #{@brand}, additional_properties:"\
  " #{@additional_properties}>"
end