Class: PrimaryConnectClient::Demographics
- Inherits:
-
Object
- Object
- PrimaryConnectClient::Demographics
- Defined in:
- lib/primary_connect_client/models/demographics.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#citizenships ⇒ Object
Returns the value of attribute citizenships.
-
#death_date_time ⇒ Object
ISO 8601.
-
#dob ⇒ Object
Returns the value of attribute dob.
-
#email_addresses ⇒ Object
Returns the value of attribute email_addresses.
-
#ethnicity ⇒ Object
Returns the value of attribute ethnicity.
-
#ethnicity_detail ⇒ Object
Returns the value of attribute ethnicity_detail.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#is_deceased ⇒ Object
Returns the value of attribute is_deceased.
-
#language_code ⇒ Object
Returns the value of attribute language_code.
-
#marital_status ⇒ Object
Returns the value of attribute marital_status.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone_numbers ⇒ Object
Returns the value of attribute phone_numbers.
-
#race_details ⇒ Object
Returns the value of attribute race_details.
-
#races ⇒ Object
Returns the value of attribute races.
-
#sex ⇒ Object
Returns the value of attribute sex.
-
#sexual_orientation ⇒ Object
Returns the value of attribute sexual_orientation.
-
#ssn ⇒ Object
Returns the value of attribute ssn.
Class Method Summary collapse
-
.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_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.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Demographics
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 = {}) ⇒ Demographics
Initializes the object
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 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 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 |
# File 'lib/primary_connect_client/models/demographics.rb', line 138 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::Demographics` 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 `PrimaryConnectClient::Demographics`. 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?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'dob') self.dob = attributes[:'dob'] end if attributes.key?(:'ssn') self.ssn = attributes[:'ssn'] end if attributes.key?(:'sex') self.sex = attributes[:'sex'] end if attributes.key?(:'gender') self.gender = attributes[:'gender'] end if attributes.key?(:'sexual_orientation') self.sexual_orientation = attributes[:'sexual_orientation'] end if attributes.key?(:'races') if (value = attributes[:'races']).is_a?(Array) self.races = value end end if attributes.key?(:'race_details') if (value = attributes[:'race_details']).is_a?(Array) self.race_details = value end end if attributes.key?(:'ethnicity') self.ethnicity = attributes[:'ethnicity'] end if attributes.key?(:'ethnicity_detail') if (value = attributes[:'ethnicity_detail']).is_a?(Array) self.ethnicity_detail = value end end if attributes.key?(:'marital_status') self.marital_status = attributes[:'marital_status'] end if attributes.key?(:'is_deceased') self.is_deceased = attributes[:'is_deceased'] end if attributes.key?(:'death_date_time') self.death_date_time = attributes[:'death_date_time'] end if attributes.key?(:'phone_numbers') if (value = attributes[:'phone_numbers']).is_a?(Array) self.phone_numbers = value end end if attributes.key?(:'email_addresses') if (value = attributes[:'email_addresses']).is_a?(Array) self.email_addresses = value end end if attributes.key?(:'language_code') self.language_code = attributes[:'language_code'] end if attributes.key?(:'citizenships') if (value = attributes[:'citizenships']).is_a?(Array) self.citizenships = value end end if attributes.key?(:'address') self.address = attributes[:'address'] end end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
53 54 55 |
# File 'lib/primary_connect_client/models/demographics.rb', line 53 def address @address end |
#citizenships ⇒ Object
Returns the value of attribute citizenships.
51 52 53 |
# File 'lib/primary_connect_client/models/demographics.rb', line 51 def citizenships @citizenships end |
#death_date_time ⇒ Object
ISO 8601
43 44 45 |
# File 'lib/primary_connect_client/models/demographics.rb', line 43 def death_date_time @death_date_time end |
#dob ⇒ Object
Returns the value of attribute dob.
20 21 22 |
# File 'lib/primary_connect_client/models/demographics.rb', line 20 def dob @dob end |
#email_addresses ⇒ Object
Returns the value of attribute email_addresses.
47 48 49 |
# File 'lib/primary_connect_client/models/demographics.rb', line 47 def email_addresses @email_addresses end |
#ethnicity ⇒ Object
Returns the value of attribute ethnicity.
34 35 36 |
# File 'lib/primary_connect_client/models/demographics.rb', line 34 def ethnicity @ethnicity end |
#ethnicity_detail ⇒ Object
Returns the value of attribute ethnicity_detail.
36 37 38 |
# File 'lib/primary_connect_client/models/demographics.rb', line 36 def ethnicity_detail @ethnicity_detail end |
#gender ⇒ Object
Returns the value of attribute gender.
26 27 28 |
# File 'lib/primary_connect_client/models/demographics.rb', line 26 def gender @gender end |
#is_deceased ⇒ Object
Returns the value of attribute is_deceased.
40 41 42 |
# File 'lib/primary_connect_client/models/demographics.rb', line 40 def is_deceased @is_deceased end |
#language_code ⇒ Object
Returns the value of attribute language_code.
49 50 51 |
# File 'lib/primary_connect_client/models/demographics.rb', line 49 def language_code @language_code end |
#marital_status ⇒ Object
Returns the value of attribute marital_status.
38 39 40 |
# File 'lib/primary_connect_client/models/demographics.rb', line 38 def marital_status @marital_status end |
#name ⇒ Object
Returns the value of attribute name.
18 19 20 |
# File 'lib/primary_connect_client/models/demographics.rb', line 18 def name @name end |
#phone_numbers ⇒ Object
Returns the value of attribute phone_numbers.
45 46 47 |
# File 'lib/primary_connect_client/models/demographics.rb', line 45 def phone_numbers @phone_numbers end |
#race_details ⇒ Object
Returns the value of attribute race_details.
32 33 34 |
# File 'lib/primary_connect_client/models/demographics.rb', line 32 def race_details @race_details end |
#races ⇒ Object
Returns the value of attribute races.
30 31 32 |
# File 'lib/primary_connect_client/models/demographics.rb', line 30 def races @races end |
#sex ⇒ Object
Returns the value of attribute sex.
24 25 26 |
# File 'lib/primary_connect_client/models/demographics.rb', line 24 def sex @sex end |
#sexual_orientation ⇒ Object
Returns the value of attribute sexual_orientation.
28 29 30 |
# File 'lib/primary_connect_client/models/demographics.rb', line 28 def sexual_orientation @sexual_orientation end |
#ssn ⇒ Object
Returns the value of attribute ssn.
22 23 24 |
# File 'lib/primary_connect_client/models/demographics.rb', line 22 def ssn @ssn end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
102 103 104 |
# File 'lib/primary_connect_client/models/demographics.rb', line 102 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/primary_connect_client/models/demographics.rb', line 78 def self.attribute_map { :'name' => :'name', :'dob' => :'dob', :'ssn' => :'ssn', :'sex' => :'sex', :'gender' => :'gender', :'sexual_orientation' => :'sexualOrientation', :'races' => :'races', :'race_details' => :'raceDetails', :'ethnicity' => :'ethnicity', :'ethnicity_detail' => :'ethnicityDetail', :'marital_status' => :'maritalStatus', :'is_deceased' => :'isDeceased', :'death_date_time' => :'deathDateTime', :'phone_numbers' => :'phoneNumbers', :'email_addresses' => :'emailAddresses', :'language_code' => :'languageCode', :'citizenships' => :'citizenships', :'address' => :'address' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
349 350 351 |
# File 'lib/primary_connect_client/models/demographics.rb', line 349 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
131 132 133 134 |
# File 'lib/primary_connect_client/models/demographics.rb', line 131 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/primary_connect_client/models/demographics.rb', line 107 def self.openapi_types { :'name' => :'Name', :'dob' => :'String', :'ssn' => :'String', :'sex' => :'String', :'gender' => :'String', :'sexual_orientation' => :'String', :'races' => :'Array<String>', :'race_details' => :'Array<String>', :'ethnicity' => :'String', :'ethnicity_detail' => :'Array<String>', :'marital_status' => :'String', :'is_deceased' => :'Boolean', :'death_date_time' => :'Time', :'phone_numbers' => :'Array<PhoneNumber>', :'email_addresses' => :'Array<String>', :'language_code' => :'String', :'citizenships' => :'Array<String>', :'address' => :'Address' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/primary_connect_client/models/demographics.rb', line 311 def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && dob == o.dob && ssn == o.ssn && sex == o.sex && gender == o.gender && sexual_orientation == o.sexual_orientation && races == o.races && race_details == o.race_details && ethnicity == o.ethnicity && ethnicity_detail == o.ethnicity_detail && marital_status == o.marital_status && is_deceased == o.is_deceased && death_date_time == o.death_date_time && phone_numbers == o.phone_numbers && email_addresses == o.email_addresses && language_code == o.language_code && citizenships == o.citizenships && address == o.address end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/primary_connect_client/models/demographics.rb', line 379 def _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 = PrimaryConnectClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
450 451 452 453 454 455 456 457 458 459 460 461 462 |
# File 'lib/primary_connect_client/models/demographics.rb', line 450 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 |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/primary_connect_client/models/demographics.rb', line 356 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{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[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
336 337 338 |
# File 'lib/primary_connect_client/models/demographics.rb', line 336 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
342 343 344 |
# File 'lib/primary_connect_client/models/demographics.rb', line 342 def hash [name, dob, ssn, sex, gender, sexual_orientation, races, race_details, ethnicity, ethnicity_detail, marital_status, is_deceased, death_date_time, phone_numbers, email_addresses, language_code, citizenships, address].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
238 239 240 241 |
# File 'lib/primary_connect_client/models/demographics.rb', line 238 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
426 427 428 |
# File 'lib/primary_connect_client/models/demographics.rb', line 426 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/primary_connect_client/models/demographics.rb', line 432 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
420 421 422 |
# File 'lib/primary_connect_client/models/demographics.rb', line 420 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/primary_connect_client/models/demographics.rb', line 245 def valid? sex_validator = EnumAttributeValidator.new('String', ["SEX_UNKNOWN", "SEX_FEMALE", "SEX_MALE", "SEX_OTHER", "SEX_NON_BINARY", "SEX_PREFER_NOT_TO_DISCLOSE"]) return false unless sex_validator.valid?(@sex) gender_validator = EnumAttributeValidator.new('String', ["GENDER_UNKNOWN", "GENDER_FEMALE", "GENDER_MALE", "GENDER_OTHER", "GENDER_NON_BINARY", "GENDER_TRANSGENDER_MALE", "GENDER_TRANSGENDER_FEMALE", "GENDER_PREFER_NOT_TO_DISCLOSE", "GENDER_INTERSEX"]) return false unless gender_validator.valid?(@gender) sexual_orientation_validator = EnumAttributeValidator.new('String', ["ORIENTATION_UNKNOWN", "ORIENTATION_HOMOSEXUAL", "ORIENTATION_HETEROSEXUAL", "ORIENTATION_BISEXUAL", "ORIENTATION_QUESTIONING", "ORIENTATION_OTHER", "ORIENTATION_PREFER_NOT_TO_DISCLOSE"]) return false unless sexual_orientation_validator.valid?(@sexual_orientation) ethnicity_validator = EnumAttributeValidator.new('String', ["ETHNICITY_UNKNOWN", "ETHNICITY_HISPANIC", "ETHNICITY_NON_HISPANIC", "ETHNICITY_PREFER_NOT_TO_DISCLOSE"]) return false unless ethnicity_validator.valid?(@ethnicity) marital_status_validator = EnumAttributeValidator.new('String', ["MARITAL_STATUS_UNKNOWN", "MARITAL_STATUS_SEPARATED", "MARITAL_STATUS_UNMARRIED", "MARITAL_STATUS_COMMON_LAW", "MARITAL_STATUS_DIVORCED", "MARITAL_STATUS_LEGALLY_SEPARATED", "MARITAL_STATUS_LIVING_TOGETHER", "MARITAL_STATUS_INTERLOCUTORY", "MARITAL_STATUS_MARRIED", "MARITAL_STATUS_ANNULLED", "MARITAL_STATUS_OTHER", "MARITAL_STATUS_DOMESTIC_PARTNER", "MARITAL_STATUS_REGISTERED_DOMESTIC_PARTNER", "MARITAL_STATUS_SINGLE", "MARITAL_STATUS_UNREPORTED", "MARITAL_STATUS_WIDOWED"]) return false unless marital_status_validator.valid?(@marital_status) true end |