Class: CandidApiClient::Encounters::V4::Types::IntakeQuestion
- Inherits:
-
Object
- Object
- CandidApiClient::Encounters::V4::Types::IntakeQuestion
- Defined in:
- lib/candidhealth/encounters/v_4/types/intake_question.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #id ⇒ String readonly
- #responses ⇒ Array<CandidApiClient::Encounters::V4::Types::IntakeResponseAndFollowUps> readonly
- #text ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Encounters::V4::Types::IntakeQuestion
Deserialize a JSON object to an instance of IntakeQuestion.
-
.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(id:, text:, responses: OMIT, additional_properties: nil) ⇒ CandidApiClient::Encounters::V4::Types::IntakeQuestion constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of IntakeQuestion to a JSON object.
Constructor Details
#initialize(id:, text:, responses: OMIT, additional_properties: nil) ⇒ CandidApiClient::Encounters::V4::Types::IntakeQuestion
31 32 33 34 35 36 37 38 39 |
# File 'lib/candidhealth/encounters/v_4/types/intake_question.rb', line 31 def initialize(id:, text:, responses: OMIT, additional_properties: nil) @id = id @text = text @responses = responses if responses != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "text": text, "responses": responses }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/candidhealth/encounters/v_4/types/intake_question.rb', line 19 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
13 14 15 |
# File 'lib/candidhealth/encounters/v_4/types/intake_question.rb', line 13 def id @id end |
#responses ⇒ Array<CandidApiClient::Encounters::V4::Types::IntakeResponseAndFollowUps> (readonly)
17 18 19 |
# File 'lib/candidhealth/encounters/v_4/types/intake_question.rb', line 17 def responses @responses end |
#text ⇒ String (readonly)
15 16 17 |
# File 'lib/candidhealth/encounters/v_4/types/intake_question.rb', line 15 def text @text end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Encounters::V4::Types::IntakeQuestion
Deserialize a JSON object to an instance of IntakeQuestion
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/candidhealth/encounters/v_4/types/intake_question.rb', line 45 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct["id"] text = struct["text"] responses = parsed_json["responses"]&.map do |item| item = item.to_json CandidApiClient::Encounters::V4::Types::IntakeResponseAndFollowUps.from_json(json_object: item) end new( id: id, text: text, responses: responses, 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.
75 76 77 78 79 |
# File 'lib/candidhealth/encounters/v_4/types/intake_question.rb', line 75 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.") obj.responses&.is_a?(Array) != false || raise("Passed value for field obj.responses is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of IntakeQuestion to a JSON object
65 66 67 |
# File 'lib/candidhealth/encounters/v_4/types/intake_question.rb', line 65 def to_json(*_args) @_field_set&.to_json end |