Class: CandidApiClient::FeeSchedules::V3::Types::MatchDate

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/fee_schedules/v_3/types/match_date.rb

Overview

Match information for date of service

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(match:, explanation:, value: OMIT, additional_properties: nil) ⇒ CandidApiClient::FeeSchedules::V3::Types::MatchDate

Parameters:

  • value (Date) (defaults to: OMIT)
  • match (Boolean)
  • explanation (String)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



32
33
34
35
36
37
38
39
40
# File 'lib/candidhealth/fee_schedules/v_3/types/match_date.rb', line 32

def initialize(match:, explanation:, value: OMIT, additional_properties: nil)
  @value = value if value != OMIT
  @match = match
  @explanation = explanation
  @additional_properties = additional_properties
  @_field_set = { "value": value, "match": match, "explanation": explanation }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



20
21
22
# File 'lib/candidhealth/fee_schedules/v_3/types/match_date.rb', line 20

def additional_properties
  @additional_properties
end

#explanationString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/candidhealth/fee_schedules/v_3/types/match_date.rb', line 18

def explanation
  @explanation
end

#matchBoolean (readonly)

Returns:

  • (Boolean)


16
17
18
# File 'lib/candidhealth/fee_schedules/v_3/types/match_date.rb', line 16

def match
  @match
end

#valueDate (readonly)

Returns:

  • (Date)


14
15
16
# File 'lib/candidhealth/fee_schedules/v_3/types/match_date.rb', line 14

def value
  @value
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::FeeSchedules::V3::Types::MatchDate

Deserialize a JSON object to an instance of MatchDate

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/candidhealth/fee_schedules/v_3/types/match_date.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  value = (Date.parse(parsed_json["value"]) unless parsed_json["value"].nil?)
  match = struct["match"]
  explanation = struct["explanation"]
  new(
    value: value,
    match: match,
    explanation: explanation,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


73
74
75
76
77
# File 'lib/candidhealth/fee_schedules/v_3/types/match_date.rb', line 73

def self.validate_raw(obj:)
  obj.value&.is_a?(Date) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
  obj.match.is_a?(Boolean) != false || raise("Passed value for field obj.match is not the expected type, validation failed.")
  obj.explanation.is_a?(String) != false || raise("Passed value for field obj.explanation is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of MatchDate to a JSON object

Returns:

  • (String)


63
64
65
# File 'lib/candidhealth/fee_schedules/v_3/types/match_date.rb', line 63

def to_json(*_args)
  @_field_set&.to_json
end