Class: CandidApiClient::Identifiers::Types::IdentifierBase
- Inherits:
-
Object
- Object
- CandidApiClient::Identifiers::Types::IdentifierBase
- Defined in:
- lib/candidhealth/identifiers/types/identifier_base.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_value ⇒ CandidApiClient::Identifiers::Types::IdentifierValue readonly
- #period ⇒ CandidApiClient::Commons::Types::DateRangeOptionalEnd readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Identifiers::Types::IdentifierBase
Deserialize a JSON object to an instance of IdentifierBase.
-
.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_code:, identifier_value:, period: OMIT, additional_properties: nil) ⇒ CandidApiClient::Identifiers::Types::IdentifierBase constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of IdentifierBase to a JSON object.
Constructor Details
#initialize(identifier_code:, identifier_value:, period: OMIT, additional_properties: nil) ⇒ CandidApiClient::Identifiers::Types::IdentifierBase
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/candidhealth/identifiers/types/identifier_base.rb', line 32 def initialize(identifier_code:, identifier_value:, period: OMIT, additional_properties: nil) @period = period if period != OMIT @identifier_code = identifier_code @identifier_value = identifier_value @additional_properties = additional_properties @_field_set = { "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.
20 21 22 |
# File 'lib/candidhealth/identifiers/types/identifier_base.rb', line 20 def additional_properties @additional_properties end |
#identifier_code ⇒ CandidApiClient::Identifiers::Types::IdentifierCode (readonly)
16 17 18 |
# File 'lib/candidhealth/identifiers/types/identifier_base.rb', line 16 def identifier_code @identifier_code end |
#identifier_value ⇒ CandidApiClient::Identifiers::Types::IdentifierValue (readonly)
18 19 20 |
# File 'lib/candidhealth/identifiers/types/identifier_base.rb', line 18 def identifier_value @identifier_value end |
#period ⇒ CandidApiClient::Commons::Types::DateRangeOptionalEnd (readonly)
14 15 16 |
# File 'lib/candidhealth/identifiers/types/identifier_base.rb', line 14 def period @period end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Identifiers::Types::IdentifierBase
Deserialize a JSON object to an instance of IdentifierBase
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/candidhealth/identifiers/types/identifier_base.rb', line 50 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) 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( 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.
87 88 89 90 91 |
# File 'lib/candidhealth/identifiers/types/identifier_base.rb', line 87 def self.validate_raw(obj:) 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 IdentifierBase to a JSON object
77 78 79 |
# File 'lib/candidhealth/identifiers/types/identifier_base.rb', line 77 def to_json(*_args) @_field_set&.to_json end |