Class: UnivapayClientSdk::GenericMetadata
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::GenericMetadata
- Defined in:
- lib/univapay_client_sdk/models/generic_metadata.rb
Overview
A free-form dictionary for custom metadata.
Instance Attribute Summary collapse
-
#order_id ⇒ String
Example of a custom metadata key.
-
#univapay_name ⇒ String
Consumer name passed to payment processors that require it (e.g., konbini, bank transfer).
-
#univapay_phone_number ⇒ String
Consumer phone number passed to payment processors that require it.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(order_id: SKIP, univapay_name: SKIP, univapay_phone_number: SKIP, additional_properties: nil) ⇒ GenericMetadata
constructor
A new instance of GenericMetadata.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(order_id: SKIP, univapay_name: SKIP, univapay_phone_number: SKIP, additional_properties: nil) ⇒ GenericMetadata
Returns a new instance of GenericMetadata.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 48 def initialize(order_id: SKIP, univapay_name: SKIP, univapay_phone_number: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @order_id = order_id unless order_id == SKIP @univapay_name = univapay_name unless univapay_name == SKIP @univapay_phone_number = univapay_phone_number unless univapay_phone_number == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#order_id ⇒ String
Example of a custom metadata key.
14 15 16 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 14 def order_id @order_id end |
#univapay_name ⇒ String
Consumer name passed to payment processors that require it (e.g., konbini, bank transfer).
19 20 21 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 19 def univapay_name @univapay_name end |
#univapay_phone_number ⇒ String
Consumer phone number passed to payment processors that require it.
23 24 25 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 23 def univapay_phone_number @univapay_phone_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 60 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. order_id = hash.key?('order_id') ? hash['order_id'] : SKIP univapay_name = hash.key?('univapay-name') ? hash['univapay-name'] : SKIP univapay_phone_number = hash.key?('univapay-phone-number') ? hash['univapay-phone-number'] : 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 { |x| APIHelper.deserialize_union_type(UnionTypeLookUp.get(:GenericMetadataValue), x) } ) # Create object from extracted values. GenericMetadata.new(order_id: order_id, univapay_name: univapay_name, univapay_phone_number: univapay_phone_number, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['order_id'] = 'order_id' @_hash['univapay_name'] = 'univapay-name' @_hash['univapay_phone_number'] = 'univapay-phone-number' @_hash end |
.nullables ⇒ Object
An array for nullable fields
44 45 46 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 44 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 40 41 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 35 def self.optionals %w[ order_id univapay_name univapay_phone_number ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
87 88 89 90 91 92 93 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 87 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
104 105 106 107 108 109 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 104 def inspect class_name = self.class.name.split('::').last "<#{class_name} order_id: #{@order_id.inspect}, univapay_name: #{@univapay_name.inspect},"\ " univapay_phone_number: #{@univapay_phone_number.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
96 97 98 99 100 101 |
# File 'lib/univapay_client_sdk/models/generic_metadata.rb', line 96 def to_s class_name = self.class.name.split('::').last "<#{class_name} order_id: #{@order_id}, univapay_name: #{@univapay_name},"\ " univapay_phone_number: #{@univapay_phone_number}, additional_properties:"\ " #{@additional_properties}>" end |