Class: CandidApiClient::PreEncounter::Common::Types::ContactPoint
- Inherits:
-
Object
- Object
- CandidApiClient::PreEncounter::Common::Types::ContactPoint
- Defined in:
- lib/candidhealth/pre_encounter/common/types/contact_point.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #period ⇒ CandidApiClient::PreEncounter::Common::Types::Period readonly
- #use ⇒ CandidApiClient::PreEncounter::Common::Types::ContactPointUse readonly
- #value ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Common::Types::ContactPoint
Deserialize a JSON object to an instance of ContactPoint.
-
.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(value:, use:, period: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Common::Types::ContactPoint constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ContactPoint to a JSON object.
Constructor Details
#initialize(value:, use:, period: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Common::Types::ContactPoint
32 33 34 35 36 37 38 39 40 |
# File 'lib/candidhealth/pre_encounter/common/types/contact_point.rb', line 32 def initialize(value:, use:, period: OMIT, additional_properties: nil) @value = value @use = use @period = period if period != OMIT @additional_properties = additional_properties @_field_set = { "value": value, "use": use, "period": period }.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/pre_encounter/common/types/contact_point.rb', line 20 def additional_properties @additional_properties end |
#period ⇒ CandidApiClient::PreEncounter::Common::Types::Period (readonly)
18 19 20 |
# File 'lib/candidhealth/pre_encounter/common/types/contact_point.rb', line 18 def period @period end |
#use ⇒ CandidApiClient::PreEncounter::Common::Types::ContactPointUse (readonly)
16 17 18 |
# File 'lib/candidhealth/pre_encounter/common/types/contact_point.rb', line 16 def use @use end |
#value ⇒ String (readonly)
14 15 16 |
# File 'lib/candidhealth/pre_encounter/common/types/contact_point.rb', line 14 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Common::Types::ContactPoint
Deserialize a JSON object to an instance of ContactPoint
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/candidhealth/pre_encounter/common/types/contact_point.rb', line 46 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) value = struct["value"] use = struct["use"] if parsed_json["period"].nil? period = nil else period = parsed_json["period"].to_json period = CandidApiClient::PreEncounter::Common::Types::Period.from_json(json_object: period) end new( value: value, use: use, period: period, 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.
78 79 80 81 82 |
# File 'lib/candidhealth/pre_encounter/common/types/contact_point.rb', line 78 def self.validate_raw(obj:) obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") obj.use.is_a?(CandidApiClient::PreEncounter::Common::Types::ContactPointUse) != false || raise("Passed value for field obj.use is not the expected type, validation failed.") obj.period.nil? || CandidApiClient::PreEncounter::Common::Types::Period.validate_raw(obj: obj.period) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ContactPoint to a JSON object
68 69 70 |
# File 'lib/candidhealth/pre_encounter/common/types/contact_point.rb', line 68 def to_json(*_args) @_field_set&.to_json end |