Class: UnivapayClientSdk::TokenCreateKonbiniData

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

Overview

Token Create Konbini 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(customer_name:, convenience_store:, phone_number:, expiration_period: SKIP, expiration_time_shift: SKIP, additional_properties: nil) ⇒ TokenCreateKonbiniData

Returns a new instance of TokenCreateKonbiniData.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 56

def initialize(customer_name:, convenience_store:, phone_number:,
               expiration_period: SKIP, expiration_time_shift: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @customer_name = customer_name
  @convenience_store = convenience_store
  @expiration_period = expiration_period unless expiration_period == SKIP
  @phone_number = phone_number
  @expiration_time_shift = expiration_time_shift unless expiration_time_shift == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#convenience_storeBaseKonbiniDataConvenienceStore

Base Konbini Data Convenience Store schema.



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

def convenience_store
  @convenience_store
end

#customer_nameString

Customer name.

Returns:

  • (String)


14
15
16
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 14

def customer_name
  @customer_name
end

#expiration_periodString

ISO-8601 Duration (e.g., 'P7D'). Default is 30 days.

Returns:

  • (String)


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

def expiration_period
  @expiration_period
end

#expiration_time_shiftString

Expiration time shift value.

Returns:

  • (String)


30
31
32
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 30

def expiration_time_shift
  @expiration_time_shift
end

#phone_numberTokenCreatePhoneNumber

Token Create Phone Number schema.



26
27
28
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 26

def phone_number
  @phone_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  customer_name = hash.key?('customer_name') ? hash['customer_name'] : nil
  convenience_store =
    hash.key?('convenience_store') ? hash['convenience_store'] : nil
  phone_number = TokenCreatePhoneNumber.from_hash(hash['phone_number']) if
    hash['phone_number']
  expiration_period =
    hash.key?('expiration_period') ? hash['expiration_period'] : SKIP
  expiration_time_shift =
    hash.key?('expiration_time_shift') ? hash['expiration_time_shift'] : 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.
  TokenCreateKonbiniData.new(customer_name: customer_name,
                             convenience_store: convenience_store,
                             phone_number: phone_number,
                             expiration_period: expiration_period,
                             expiration_time_shift: expiration_time_shift,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['customer_name'] = 'customer_name'
  @_hash['convenience_store'] = 'convenience_store'
  @_hash['expiration_period'] = 'expiration_period'
  @_hash['phone_number'] = 'phone_number'
  @_hash['expiration_time_shift'] = 'expiration_time_shift'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 44

def self.optionals
  %w[
    expiration_period
    expiration_time_shift
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 103

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.customer_name,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.convenience_store,
                              ->(val) { BaseKonbiniDataConvenienceStore.validate(val) }) and
        APIHelper.valid_type?(value.phone_number,
                              ->(val) { TokenCreatePhoneNumber.validate(val) },
                              is_model_hash: true)
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['customer_name'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['convenience_store'],
                            ->(val) { BaseKonbiniDataConvenienceStore.validate(val) }) and
      APIHelper.valid_type?(value['phone_number'],
                            ->(val) { TokenCreatePhoneNumber.validate(val) },
                            is_model_hash: true)
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



139
140
141
142
143
144
145
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 139

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} customer_name: #{@customer_name.inspect}, convenience_store:"\
  " #{@convenience_store.inspect}, expiration_period: #{@expiration_period.inspect},"\
  " phone_number: #{@phone_number.inspect}, expiration_time_shift:"\
  " #{@expiration_time_shift.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



130
131
132
133
134
135
136
# File 'lib/univapay_client_sdk/models/token_create_konbini_data.rb', line 130

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} customer_name: #{@customer_name}, convenience_store: #{@convenience_store},"\
  " expiration_period: #{@expiration_period}, phone_number: #{@phone_number},"\
  " expiration_time_shift: #{@expiration_time_shift}, additional_properties:"\
  " #{@additional_properties}>"
end