Class: LogaltyCertificateIssuanceApiCerty::TransactionRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb

Overview

TransactionRequest Model.

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(id_model:, profile_data:, duration_data: SKIP, support_data: SKIP, external_id: SKIP, duplicate_key_off: false, url_back: SKIP, notice_method: SKIP, time2close: '30d', locale: 'es-ES', additional_properties: nil) ⇒ TransactionRequest

Returns a new instance of TransactionRequest.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 134

def initialize(id_model:, profile_data:, duration_data: SKIP,
               support_data: SKIP, external_id: SKIP,
               duplicate_key_off: false, url_back: SKIP,
               notice_method: SKIP, time2close: '30d', locale: 'es-ES',
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id_model = id_model
  @profile_data = profile_data
  @duration_data = duration_data unless duration_data == SKIP
  @support_data = support_data unless support_data == SKIP
  @external_id = external_id unless external_id == SKIP
  @duplicate_key_off = duplicate_key_off unless duplicate_key_off == SKIP
  @url_back = url_back unless url_back == SKIP
  @notice_method = notice_method unless notice_method == SKIP
  @time2close = time2close unless time2close == SKIP
  @locale = locale unless locale == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#duplicate_key_offTrueClass | FalseClass

When combined with ‘externalId`, allows two transactions with the same external identifier to be registered. By default the external identifier is unique and duplicate use is not allowed.

Returns:

  • (TrueClass | FalseClass)


66
67
68
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 66

def duplicate_key_off
  @duplicate_key_off
end

#duration_dataDuration

Certificate model:

  • ‘personal-hsm-fortress-qes`: Qualified personal certificate (QES) hosted

in the cloud (FirmaCloud).

  • ‘personal-sw`: Qualified personal certificate (AES) in software support.

  • ‘personal-sw-identity`: Qualified personal certificate (AES) hosted in

the cloud (FirmaCloud).

  • ‘personal-sw-identity-sc`: Qualified personal certificate (AES) hosted

in Client System (SC) in cloud. Does not require end-user activation.

Returns:



43
44
45
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 43

def duration_data
  @duration_data
end

#external_idString

Unique identifier in the client system external to Logalty. Can be used to search transactions.

Returns:

  • (String)


59
60
61
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 59

def external_id
  @external_id
end

#id_modelCertificateModel

Certificate model:

  • ‘personal-hsm-fortress-qes`: Qualified personal certificate (QES) hosted

in the cloud (FirmaCloud).

  • ‘personal-sw`: Qualified personal certificate (AES) in software support.

  • ‘personal-sw-identity`: Qualified personal certificate (AES) hosted in

the cloud (FirmaCloud).

  • ‘personal-sw-identity-sc`: Qualified personal certificate (AES) hosted

in Client System (SC) in cloud. Does not require end-user activation.

Returns:



21
22
23
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 21

def id_model
  @id_model
end

#localeString

Language of the transaction in IETF format. Default is ‘es-ES`.

Returns:

  • (String)


97
98
99
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 97

def locale
  @locale
end

#notice_methodNoticeMethod

Notification channel used to give the end-user access to the system:

  • ‘NONE`: No notification is sent; only a synchronous access URL is

returned.

  • ‘EMAIL`: An asynchronous access link is sent by e-mail.

  • ‘SMS`: An asynchronous access link is sent by SMS.

Returns:



85
86
87
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 85

def notice_method
  @notice_method
end

#profile_dataProfile

Certificate model:

  • ‘personal-hsm-fortress-qes`: Qualified personal certificate (QES) hosted

in the cloud (FirmaCloud).

  • ‘personal-sw`: Qualified personal certificate (AES) in software support.

  • ‘personal-sw-identity`: Qualified personal certificate (AES) hosted in

the cloud (FirmaCloud).

  • ‘personal-sw-identity-sc`: Qualified personal certificate (AES) hosted

in Client System (SC) in cloud. Does not require end-user activation.

Returns:



32
33
34
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 32

def profile_data
  @profile_data
end

#support_dataSupport

Certificate model:

  • ‘personal-hsm-fortress-qes`: Qualified personal certificate (QES) hosted

in the cloud (FirmaCloud).

  • ‘personal-sw`: Qualified personal certificate (AES) in software support.

  • ‘personal-sw-identity`: Qualified personal certificate (AES) hosted in

the cloud (FirmaCloud).

  • ‘personal-sw-identity-sc`: Qualified personal certificate (AES) hosted

in Client System (SC) in cloud. Does not require end-user activation.

Returns:



54
55
56
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 54

def support_data
  @support_data
end

#time2closeString

Validity period of the transaction. Accepts a numeric value followed by a unit: ‘m` (minutes), `h` (hours), `d` (days). After this period the transaction is automatically closed with result `TIME_EXPIRED`. Default: `30d`.

Returns:

  • (String)


93
94
95
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 93

def time2close
  @time2close
end

#url_backString

Redirect URL where the end-user will be redirected after process completion (GET method). The following query parameters are appended automatically:

  • ‘code`: Unique transaction identifier in Logalty.

  • ‘externalid`: External identifier (URL-encoded), if provided.

  • ‘process`: `issuing` (certificate issuance flow) or `activation`

(certificate activation flow).

  • ‘status`: `ok`, `cancelled`, `error`, or `exit`.

Returns:

  • (String)


77
78
79
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 77

def url_back
  @url_back
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 156

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id_model = hash.key?('idModel') ? hash['idModel'] : nil
  profile_data = Profile.from_hash(hash['profileData']) if hash['profileData']
  duration_data = Duration.from_hash(hash['durationData']) if hash['durationData']
  support_data = Support.from_hash(hash['supportData']) if hash['supportData']
  external_id = hash.key?('externalId') ? hash['externalId'] : SKIP
  duplicate_key_off = hash['duplicateKeyOff'] ||= false
  url_back = hash.key?('urlBack') ? hash['urlBack'] : SKIP
  notice_method = hash.key?('noticeMethod') ? hash['noticeMethod'] : SKIP
  time2close = hash['time2close'] ||= '30d'
  locale = hash['locale'] ||= 'es-ES'

  # 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.
  TransactionRequest.new(id_model: id_model,
                         profile_data: profile_data,
                         duration_data: duration_data,
                         support_data: support_data,
                         external_id: external_id,
                         duplicate_key_off: duplicate_key_off,
                         url_back: url_back,
                         notice_method: notice_method,
                         time2close: time2close,
                         locale: locale,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 100

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id_model'] = 'idModel'
  @_hash['profile_data'] = 'profileData'
  @_hash['duration_data'] = 'durationData'
  @_hash['support_data'] = 'supportData'
  @_hash['external_id'] = 'externalId'
  @_hash['duplicate_key_off'] = 'duplicateKeyOff'
  @_hash['url_back'] = 'urlBack'
  @_hash['notice_method'] = 'noticeMethod'
  @_hash['time2close'] = 'time2close'
  @_hash['locale'] = 'locale'
  @_hash
end

.nullablesObject

An array for nullable fields



130
131
132
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 130

def self.nullables
  []
end

.optionalsObject

An array for optional fields



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 116

def self.optionals
  %w[
    duration_data
    support_data
    external_id
    duplicate_key_off
    url_back
    notice_method
    time2close
    locale
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



203
204
205
206
207
208
209
210
211
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 203

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id_model: #{@id_model.inspect}, profile_data: #{@profile_data.inspect},"\
  " duration_data: #{@duration_data.inspect}, support_data: #{@support_data.inspect},"\
  " external_id: #{@external_id.inspect}, duplicate_key_off: #{@duplicate_key_off.inspect},"\
  " url_back: #{@url_back.inspect}, notice_method: #{@notice_method.inspect}, time2close:"\
  " #{@time2close.inspect}, locale: #{@locale.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



193
194
195
196
197
198
199
200
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_request.rb', line 193

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id_model: #{@id_model}, profile_data: #{@profile_data}, duration_data:"\
  " #{@duration_data}, support_data: #{@support_data}, external_id: #{@external_id},"\
  " duplicate_key_off: #{@duplicate_key_off}, url_back: #{@url_back}, notice_method:"\
  " #{@notice_method}, time2close: #{@time2close}, locale: #{@locale}, additional_properties:"\
  " #{@additional_properties}>"
end