Class: Yoti::Sandbox::Profile::TokenRequestBuilder
- Inherits:
-
Object
- Object
- Yoti::Sandbox::Profile::TokenRequestBuilder
- Defined in:
- lib/yoti_sandbox/profile/token_request.rb
Overview
Builder for TokenRequest
Instance Method Summary collapse
- #build ⇒ TokenRequest
-
#initialize ⇒ TokenRequestBuilder
constructor
A new instance of TokenRequestBuilder.
- #with_age_verification(age_verification) ⇒ self
- #with_attribute(attribute) ⇒ self
- #with_base64_selfie(base64_data, anchors: []) ⇒ self
- #with_date_of_birth(date, anchors: []) ⇒ self
- #with_document_details(value, anchors: []) ⇒ self
- #with_document_images(document_images, anchors: []) ⇒ self
- #with_email_address(value, anchors: []) ⇒ self
- #with_extra_data(extra_data) ⇒ self
- #with_family_name(value, anchors: []) ⇒ self
- #with_full_name(value, anchors: []) ⇒ self
- #with_gender(value, anchors: []) ⇒ self
- #with_given_names(value, anchors: []) ⇒ self
- #with_nationality(value, anchors: []) ⇒ self
- #with_phone_number(value, anchors: []) ⇒ self
- #with_postal_address(value, anchors: []) ⇒ self
- #with_remember_me_id(remember_me_id) ⇒ self
- #with_selfie(data, anchors: []) ⇒ self
- #with_structured_postal_address(data, anchors: []) ⇒ self
Constructor Details
#initialize ⇒ TokenRequestBuilder
Returns a new instance of TokenRequestBuilder.
62 63 64 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 62 def initialize @attributes = [] end |
Instance Method Details
#build ⇒ TokenRequest
330 331 332 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 330 def build TokenRequest.new(@remember_me_id, @attributes, @extra_data) end |
#with_age_verification(age_verification) ⇒ self
155 156 157 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 155 def with_age_verification(age_verification) with_attribute(age_verification.to_attribute) end |
#with_attribute(attribute) ⇒ self
81 82 83 84 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 81 def with_attribute(attribute) @attributes.push attribute self end |
#with_base64_selfie(base64_data, anchors: []) ⇒ self
258 259 260 261 262 263 264 265 266 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 258 def with_base64_selfie(base64_data, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::SELFIE, value: base64_data, anchors: anchors ) ) end |
#with_date_of_birth(date, anchors: []) ⇒ self
140 141 142 143 144 145 146 147 148 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 140 def with_date_of_birth(date, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::DATE_OF_BIRTH, value: date.strftime('%F'), anchors: anchors ) ) end |
#with_document_details(value, anchors: []) ⇒ self
290 291 292 293 294 295 296 297 298 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 290 def with_document_details(value, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::DOCUMENT_DETAILS, value: value, anchors: anchors ) ) end |
#with_document_images(document_images, anchors: []) ⇒ self
306 307 308 309 310 311 312 313 314 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 306 def with_document_images(document_images, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::DOCUMENT_IMAGES, value: document_images.value, anchors: anchors ) ) end |
#with_email_address(value, anchors: []) ⇒ self
274 275 276 277 278 279 280 281 282 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 274 def with_email_address(value, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::EMAIL_ADDRESS, value: value, anchors: anchors ) ) end |
#with_extra_data(extra_data) ⇒ self
321 322 323 324 325 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 321 def with_extra_data(extra_data) Validation.assert_is_a(ExtraData, extra_data, 'extra_data') @extra_data = extra_data self end |
#with_family_name(value, anchors: []) ⇒ self
108 109 110 111 112 113 114 115 116 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 108 def with_family_name(value, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::FAMILY_NAME, value: value, anchors: anchors ) ) end |
#with_full_name(value, anchors: []) ⇒ self
124 125 126 127 128 129 130 131 132 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 124 def with_full_name(value, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::FULL_NAME, value: value, anchors: anchors ) ) end |
#with_gender(value, anchors: []) ⇒ self
165 166 167 168 169 170 171 172 173 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 165 def with_gender(value, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::GENDER, value: value, anchors: anchors ) ) end |
#with_given_names(value, anchors: []) ⇒ self
92 93 94 95 96 97 98 99 100 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 92 def with_given_names(value, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::GIVEN_NAMES, value: value, anchors: anchors ) ) end |
#with_nationality(value, anchors: []) ⇒ self
197 198 199 200 201 202 203 204 205 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 197 def with_nationality(value, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::NATIONALITY, value: value, anchors: anchors ) ) end |
#with_phone_number(value, anchors: []) ⇒ self
181 182 183 184 185 186 187 188 189 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 181 def with_phone_number(value, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::PHONE_NUMBER, value: value, anchors: anchors ) ) end |
#with_postal_address(value, anchors: []) ⇒ self
213 214 215 216 217 218 219 220 221 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 213 def with_postal_address(value, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::POSTAL_ADDRESS, value: value, anchors: anchors ) ) end |
#with_remember_me_id(remember_me_id) ⇒ self
71 72 73 74 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 71 def with_remember_me_id(remember_me_id) @remember_me_id = remember_me_id self end |
#with_selfie(data, anchors: []) ⇒ self
245 246 247 248 249 250 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 245 def with_selfie(data, anchors: []) with_base64_selfie( Base64.strict_encode64(data), anchors: anchors ) end |
#with_structured_postal_address(data, anchors: []) ⇒ self
229 230 231 232 233 234 235 236 237 |
# File 'lib/yoti_sandbox/profile/token_request.rb', line 229 def with_structured_postal_address(data, anchors: []) with_attribute( create_attribute( name: Yoti::Attribute::STRUCTURED_POSTAL_ADDRESS, value: data.to_json, anchors: anchors ) ) end |