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