Class: CandidApiClient::PreEncounter::Common::Types::BaseModel
- Inherits:
-
Object
- Object
- CandidApiClient::PreEncounter::Common::Types::BaseModel
- Defined in:
- lib/candidhealth/pre_encounter/common/types/base_model.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#deactivated ⇒ Boolean
readonly
True if the object is deactivated.
-
#organization_id ⇒ String
readonly
The organization that owns this object.
- #updated_at ⇒ DateTime readonly
-
#updating_user_id ⇒ String
readonly
The user ID of the user who last updated the object.
-
#version ⇒ Integer
readonly
The version of the object.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Common::Types::BaseModel
Deserialize a JSON object to an instance of BaseModel.
-
.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(organization_id:, deactivated:, version:, updated_at:, updating_user_id:, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Common::Types::BaseModel constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of BaseModel to a JSON object.
Constructor Details
#initialize(organization_id:, deactivated:, version:, updated_at:, updating_user_id:, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Common::Types::BaseModel
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 41 def initialize(organization_id:, deactivated:, version:, updated_at:, updating_user_id:, additional_properties: nil) @organization_id = organization_id @deactivated = deactivated @version = version @updated_at = updated_at @updating_user_id = updating_user_id @additional_properties = additional_properties @_field_set = { "organization_id": organization_id, "deactivated": deactivated, "version": version, "updated_at": updated_at, "updating_user_id": updating_user_id } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
25 26 27 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 25 def additional_properties @additional_properties end |
#deactivated ⇒ Boolean (readonly)
Returns True if the object is deactivated. Deactivated objects are not returned in search results but are returned in all other endpoints including scan.
16 17 18 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 16 def deactivated @deactivated end |
#organization_id ⇒ String (readonly)
Returns The organization that owns this object.
13 14 15 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 13 def organization_id @organization_id end |
#updated_at ⇒ DateTime (readonly)
21 22 23 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 21 def updated_at @updated_at end |
#updating_user_id ⇒ String (readonly)
Returns The user ID of the user who last updated the object.
23 24 25 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 23 def updating_user_id @updating_user_id end |
#version ⇒ Integer (readonly)
Returns The version of the object. Any update to any property of an object object will create a new version.
19 20 21 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 19 def version @version end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Common::Types::BaseModel
Deserialize a JSON object to an instance of BaseModel
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 62 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) organization_id = struct["organization_id"] deactivated = struct["deactivated"] version = struct["version"] updated_at = (DateTime.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?) updating_user_id = struct["updating_user_id"] new( organization_id: organization_id, deactivated: deactivated, version: version, updated_at: updated_at, updating_user_id: updating_user_id, 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.
93 94 95 96 97 98 99 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 93 def self.validate_raw(obj:) obj.organization_id.is_a?(String) != false || raise("Passed value for field obj.organization_id is not the expected type, validation failed.") obj.deactivated.is_a?(Boolean) != false || raise("Passed value for field obj.deactivated is not the expected type, validation failed.") obj.version.is_a?(Integer) != false || raise("Passed value for field obj.version is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") obj.updating_user_id.is_a?(String) != false || raise("Passed value for field obj.updating_user_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of BaseModel to a JSON object
83 84 85 |
# File 'lib/candidhealth/pre_encounter/common/types/base_model.rb', line 83 def to_json(*_args) @_field_set&.to_json end |