Class: CandidApiClient::Commons::Types::PhoneNumberOptional
- Inherits:
-
Object
- Object
- CandidApiClient::Commons::Types::PhoneNumberOptional
- Defined in:
- lib/candidhealth/commons/types/phone_number_optional.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #number ⇒ String readonly
- #type ⇒ CandidApiClient::Commons::Types::PhoneNumberType readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Commons::Types::PhoneNumberOptional
Deserialize a JSON object to an instance of PhoneNumberOptional.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(number: OMIT, type: OMIT, additional_properties: nil) ⇒ CandidApiClient::Commons::Types::PhoneNumberOptional constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PhoneNumberOptional to a JSON object.
Constructor Details
#initialize(number: OMIT, type: OMIT, additional_properties: nil) ⇒ CandidApiClient::Commons::Types::PhoneNumberOptional
27 28 29 30 31 32 33 34 |
# File 'lib/candidhealth/commons/types/phone_number_optional.rb', line 27 def initialize(number: OMIT, type: OMIT, additional_properties: nil) @number = number if number != OMIT @type = type if type != OMIT @additional_properties = additional_properties @_field_set = { "number": number, "type": type }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/candidhealth/commons/types/phone_number_optional.rb', line 16 def additional_properties @additional_properties end |
#number ⇒ String (readonly)
12 13 14 |
# File 'lib/candidhealth/commons/types/phone_number_optional.rb', line 12 def number @number end |
#type ⇒ CandidApiClient::Commons::Types::PhoneNumberType (readonly)
14 15 16 |
# File 'lib/candidhealth/commons/types/phone_number_optional.rb', line 14 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Commons::Types::PhoneNumberOptional
Deserialize a JSON object to an instance of PhoneNumberOptional
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/candidhealth/commons/types/phone_number_optional.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) number = struct["number"] type = struct["type"] new( number: number, type: type, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
64 65 66 67 |
# File 'lib/candidhealth/commons/types/phone_number_optional.rb', line 64 def self.validate_raw(obj:) obj.number&.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.") obj.type&.is_a?(CandidApiClient::Commons::Types::PhoneNumberType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PhoneNumberOptional to a JSON object
54 55 56 |
# File 'lib/candidhealth/commons/types/phone_number_optional.rb', line 54 def to_json(*_args) @_field_set&.to_json end |