Class: Onfido::UsDrivingLicenceBuilder
- Inherits:
-
Object
- Object
- Onfido::UsDrivingLicenceBuilder
- Defined in:
- lib/onfido/models/us_driving_licence_builder.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#address_line_1 ⇒ Object
Line 1 of the address.
-
#address_line_2 ⇒ Object
Line 2 of the address.
-
#city ⇒ Object
The city of the owner’s address.
-
#date_of_birth ⇒ Object
Date of birth in yyyy-mm-dd format.
-
#document_category ⇒ Object
Document category.
-
#expiration_date ⇒ Object
Expiration date of the driving licence in yyyy-mm-dd format.
-
#eye_color_code ⇒ Object
Eye color code.
-
#first_name ⇒ Object
The owner’s first name.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#id_number ⇒ Object
Driving licence ID number.
-
#issue_date ⇒ Object
Issue date in yyyy-mm-dd format.
-
#issue_state ⇒ Object
Two letter code of issuing state (state-issued driving licenses only).
-
#last_name ⇒ Object
The owner’s surname.
-
#middle_name ⇒ Object
The owner’s middle name.
-
#name_suffix ⇒ Object
The owner’s name suffix.
-
#postal_code ⇒ Object
The postcode or ZIP of the owner’s address.
-
#state ⇒ Object
2-characters state code.
-
#weight_measure ⇒ Object
Weight in pounds.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3).
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ UsDrivingLicenceBuilder
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ UsDrivingLicenceBuilder
Initializes the object
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 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 161 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceBuilder` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id_number') self.id_number = attributes[:'id_number'] else self.id_number = nil end if attributes.key?(:'issue_state') self.issue_state = attributes[:'issue_state'] else self.issue_state = nil end if attributes.key?(:'address_line_1') self.address_line_1 = attributes[:'address_line_1'] end if attributes.key?(:'address_line_2') self.address_line_2 = attributes[:'address_line_2'] end if attributes.key?(:'city') self.city = attributes[:'city'] end if attributes.key?(:'date_of_birth') self.date_of_birth = attributes[:'date_of_birth'] end if attributes.key?(:'document_category') self.document_category = attributes[:'document_category'] end if attributes.key?(:'expiration_date') self.expiration_date = attributes[:'expiration_date'] end if attributes.key?(:'eye_color_code') self.eye_color_code = attributes[:'eye_color_code'] end if attributes.key?(:'first_name') self.first_name = attributes[:'first_name'] end if attributes.key?(:'gender') self.gender = attributes[:'gender'] end if attributes.key?(:'issue_date') self.issue_date = attributes[:'issue_date'] end if attributes.key?(:'last_name') self.last_name = attributes[:'last_name'] end if attributes.key?(:'middle_name') self.middle_name = attributes[:'middle_name'] end if attributes.key?(:'name_suffix') self.name_suffix = attributes[:'name_suffix'] end if attributes.key?(:'postal_code') self.postal_code = attributes[:'postal_code'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'weight_measure') self.weight_measure = attributes[:'weight_measure'] end end |
Instance Attribute Details
#address_line_1 ⇒ Object
Line 1 of the address
25 26 27 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 25 def address_line_1 @address_line_1 end |
#address_line_2 ⇒ Object
Line 2 of the address
28 29 30 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 28 def address_line_2 @address_line_2 end |
#city ⇒ Object
The city of the owner’s address
31 32 33 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 31 def city @city end |
#date_of_birth ⇒ Object
Date of birth in yyyy-mm-dd format
34 35 36 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 34 def date_of_birth @date_of_birth end |
#document_category ⇒ Object
Document category.
37 38 39 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 37 def document_category @document_category end |
#expiration_date ⇒ Object
Expiration date of the driving licence in yyyy-mm-dd format
40 41 42 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 40 def expiration_date @expiration_date end |
#eye_color_code ⇒ Object
Eye color code.
43 44 45 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 43 def eye_color_code @eye_color_code end |
#first_name ⇒ Object
The owner’s first name
46 47 48 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 46 def first_name @first_name end |
#gender ⇒ Object
Returns the value of attribute gender.
48 49 50 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 48 def gender @gender end |
#id_number ⇒ Object
Driving licence ID number
19 20 21 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 19 def id_number @id_number end |
#issue_date ⇒ Object
Issue date in yyyy-mm-dd format
51 52 53 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 51 def issue_date @issue_date end |
#issue_state ⇒ Object
Two letter code of issuing state (state-issued driving licenses only)
22 23 24 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 22 def issue_state @issue_state end |
#last_name ⇒ Object
The owner’s surname
54 55 56 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 54 def last_name @last_name end |
#middle_name ⇒ Object
The owner’s middle name
57 58 59 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 57 def middle_name @middle_name end |
#name_suffix ⇒ Object
The owner’s name suffix
60 61 62 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 60 def name_suffix @name_suffix end |
#postal_code ⇒ Object
The postcode or ZIP of the owner’s address
63 64 65 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 63 def postal_code @postal_code end |
#state ⇒ Object
2-characters state code
66 67 68 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 66 def state @state end |
#weight_measure ⇒ Object
Weight in pounds
69 70 71 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 69 def weight_measure @weight_measure end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 418 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Onfido.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
118 119 120 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 118 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 94 def self.attribute_map { :'id_number' => :'id_number', :'issue_state' => :'issue_state', :'address_line_1' => :'address_line_1', :'address_line_2' => :'address_line_2', :'city' => :'city', :'date_of_birth' => :'date_of_birth', :'document_category' => :'document_category', :'expiration_date' => :'expiration_date', :'eye_color_code' => :'eye_color_code', :'first_name' => :'first_name', :'gender' => :'gender', :'issue_date' => :'issue_date', :'last_name' => :'last_name', :'middle_name' => :'middle_name', :'name_suffix' => :'name_suffix', :'postal_code' => :'postal_code', :'state' => :'state', :'weight_measure' => :'weight_measure' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 394 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3)
153 154 155 156 157 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 153 def self.openapi_all_of [ :'UsDrivingLicenceShared' ] end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
147 148 149 150 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 147 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 123 def self.openapi_types { :'id_number' => :'String', :'issue_state' => :'String', :'address_line_1' => :'String', :'address_line_2' => :'String', :'city' => :'String', :'date_of_birth' => :'Date', :'document_category' => :'String', :'expiration_date' => :'Date', :'eye_color_code' => :'String', :'first_name' => :'String', :'gender' => :'String', :'issue_date' => :'Date', :'last_name' => :'String', :'middle_name' => :'String', :'name_suffix' => :'String', :'postal_code' => :'String', :'state' => :'String', :'weight_measure' => :'Integer' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 356 def ==(o) return true if self.equal?(o) self.class == o.class && id_number == o.id_number && issue_state == o.issue_state && address_line_1 == o.address_line_1 && address_line_2 == o.address_line_2 && city == o.city && date_of_birth == o.date_of_birth && document_category == o.document_category && expiration_date == o.expiration_date && eye_color_code == o.eye_color_code && first_name == o.first_name && gender == o.gender && issue_date == o.issue_date && last_name == o.last_name && middle_name == o.middle_name && name_suffix == o.name_suffix && postal_code == o.postal_code && state == o.state && weight_measure == o.weight_measure end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 489 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
381 382 383 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 381 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
387 388 389 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 387 def hash [id_number, issue_state, address_line_1, address_line_2, city, date_of_birth, document_category, expiration_date, eye_color_code, first_name, gender, issue_date, last_name, middle_name, name_suffix, postal_code, state, weight_measure].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 253 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id_number.nil? invalid_properties.push('invalid value for "id_number", id_number cannot be nil.') end if @issue_state.nil? invalid_properties.push('invalid value for "issue_state", issue_state cannot be nil.') end pattern = Regexp.new(/^[A-Z]{2}$/) if @issue_state !~ pattern invalid_properties.push("invalid value for \"issue_state\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^[A-Z]{2}$/) if !@state.nil? && @state !~ pattern invalid_properties.push("invalid value for \"state\", must conform to the pattern #{pattern}.") end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
465 466 467 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 465 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 471 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
459 460 461 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 459 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/onfido/models/us_driving_licence_builder.rb', line 279 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id_number.nil? return false if @issue_state.nil? return false if @issue_state !~ Regexp.new(/^[A-Z]{2}$/) document_category_validator = EnumAttributeValidator.new('String', ["driver license", "driver permit", "id card", "unknown_default_open_api"]) return false unless document_category_validator.valid?(@document_category) eye_color_code_validator = EnumAttributeValidator.new('String', ["BLK", "BLU", "BRO", "DIC", "GRY", "GRN", "HAZ", "MAR", "PNK", "unknown_default_open_api"]) return false unless eye_color_code_validator.valid?(@eye_color_code) gender_validator = EnumAttributeValidator.new('String', ["Male", "Female", "unknown_default_open_api"]) return false unless gender_validator.valid?(@gender) return false if !@state.nil? && @state !~ Regexp.new(/^[A-Z]{2}$/) true end |