Class: CandidApiClient::FeeSchedules::V3::Types::RateEntry

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

Overview

A rate value in cents for a specific time range. Rate entries can be

deactivated, which is set by using the deelte_rate endpoint. Deactivated rate
entries are not considered when matching against service lines.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_date:, rate_cents:, is_deactivated:, end_date: OMIT, additional_properties: nil) ⇒ CandidApiClient::FeeSchedules::V3::Types::RateEntry

Parameters:

  • start_date (Date)
  • end_date (Date) (defaults to: OMIT)
  • rate_cents (Integer)
  • is_deactivated (Boolean)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_entry.rb', line 37

def initialize(start_date:, rate_cents:, is_deactivated:, end_date: OMIT, additional_properties: nil)
  @start_date = start_date
  @end_date = end_date if end_date != OMIT
  @rate_cents = rate_cents
  @is_deactivated = is_deactivated
  @additional_properties = additional_properties
  @_field_set = {
    "start_date": start_date,
    "end_date": end_date,
    "rate_cents": rate_cents,
    "is_deactivated": is_deactivated
  }.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



24
25
26
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_entry.rb', line 24

def additional_properties
  @additional_properties
end

#end_dateDate (readonly)

Returns:

  • (Date)


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

def end_date
  @end_date
end

#is_deactivatedBoolean (readonly)

Returns:

  • (Boolean)


22
23
24
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_entry.rb', line 22

def is_deactivated
  @is_deactivated
end

#rate_centsInteger (readonly)

Returns:

  • (Integer)


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

def rate_cents
  @rate_cents
end

#start_dateDate (readonly)

Returns:

  • (Date)


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

def start_date
  @start_date
end

Class Method Details

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

Deserialize a JSON object to an instance of RateEntry

Parameters:

  • json_object (String)

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_entry.rb', line 57

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?)
  rate_cents = struct["rate_cents"]
  is_deactivated = struct["is_deactivated"]
  new(
    start_date: start_date,
    end_date: end_date,
    rate_cents: rate_cents,
    is_deactivated: is_deactivated,
    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)


86
87
88
89
90
91
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_entry.rb', line 86

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.rate_cents.is_a?(Integer) != false || raise("Passed value for field obj.rate_cents is not the expected type, validation failed.")
  obj.is_deactivated.is_a?(Boolean) != false || raise("Passed value for field obj.is_deactivated is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of RateEntry to a JSON object

Returns:

  • (String)


76
77
78
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_entry.rb', line 76

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