Class: CandidApiClient::Identifiers::Types::Identifier
- Inherits:
-
Object
- Object
- CandidApiClient::Identifiers::Types::Identifier
- Defined in:
- lib/candidhealth/identifiers/types/identifier.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #identifier_code ⇒ CandidApiClient::Identifiers::Types::IdentifierCode readonly
- #identifier_id ⇒ String readonly
- #identifier_value ⇒ CandidApiClient::Identifiers::Types::IdentifierValue readonly
- #period ⇒ CandidApiClient::Commons::Types::DateRangeOptionalEnd readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Identifiers::Types::Identifier
Deserialize a JSON object to an instance of Identifier.
-
.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(identifier_id:, identifier_code:, identifier_value:, period: OMIT, additional_properties: nil) ⇒ CandidApiClient::Identifiers::Types::Identifier constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Identifier to a JSON object.
Constructor Details
#initialize(identifier_id:, identifier_code:, identifier_value:, period: OMIT, additional_properties: nil) ⇒ CandidApiClient::Identifiers::Types::Identifier
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/candidhealth/identifiers/types/identifier.rb', line 35 def initialize(identifier_id:, identifier_code:, identifier_value:, period: OMIT, additional_properties: nil) @identifier_id = identifier_id @period = period if period != OMIT @identifier_code = identifier_code @identifier_value = identifier_value @additional_properties = additional_properties @_field_set = { "identifier_id": identifier_id, "period": period, "identifier_code": identifier_code, "identifier_value": identifier_value }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/candidhealth/identifiers/types/identifier.rb', line 22 def additional_properties @additional_properties end |
#identifier_code ⇒ CandidApiClient::Identifiers::Types::IdentifierCode (readonly)
18 19 20 |
# File 'lib/candidhealth/identifiers/types/identifier.rb', line 18 def identifier_code @identifier_code end |
#identifier_id ⇒ String (readonly)
14 15 16 |
# File 'lib/candidhealth/identifiers/types/identifier.rb', line 14 def identifier_id @identifier_id end |
#identifier_value ⇒ CandidApiClient::Identifiers::Types::IdentifierValue (readonly)
20 21 22 |
# File 'lib/candidhealth/identifiers/types/identifier.rb', line 20 def identifier_value @identifier_value end |
#period ⇒ CandidApiClient::Commons::Types::DateRangeOptionalEnd (readonly)
16 17 18 |
# File 'lib/candidhealth/identifiers/types/identifier.rb', line 16 def period @period end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Identifiers::Types::Identifier
Deserialize a JSON object to an instance of Identifier
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/candidhealth/identifiers/types/identifier.rb', line 55 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) identifier_id = struct["identifier_id"] if parsed_json["period"].nil? period = nil else period = parsed_json["period"].to_json period = CandidApiClient::Commons::Types::DateRangeOptionalEnd.from_json(json_object: period) end identifier_code = struct["identifier_code"] if parsed_json["identifier_value"].nil? identifier_value = nil else identifier_value = parsed_json["identifier_value"].to_json identifier_value = CandidApiClient::Identifiers::Types::IdentifierValue.from_json(json_object: identifier_value) end new( identifier_id: identifier_id, period: period, identifier_code: identifier_code, identifier_value: identifier_value, 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.
94 95 96 97 98 99 |
# File 'lib/candidhealth/identifiers/types/identifier.rb', line 94 def self.validate_raw(obj:) obj.identifier_id.is_a?(String) != false || raise("Passed value for field obj.identifier_id is not the expected type, validation failed.") obj.period.nil? || CandidApiClient::Commons::Types::DateRangeOptionalEnd.validate_raw(obj: obj.period) obj.identifier_code.is_a?(CandidApiClient::Identifiers::Types::IdentifierCode) != false || raise("Passed value for field obj.identifier_code is not the expected type, validation failed.") CandidApiClient::Identifiers::Types::IdentifierValue.validate_raw(obj: obj.identifier_value) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Identifier to a JSON object
84 85 86 |
# File 'lib/candidhealth/identifiers/types/identifier.rb', line 84 def to_json(*_args) @_field_set&.to_json end |