Class: CandidApiClient::FeeSchedules::V3::Types::Rate

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

Overview

A comprehensive rate including the current rate value and all values for

historic time ranges. The time ranges specified by each RateEntry are disjoint.
A rate must always have at least one entry.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rate_id:, dimensions:, version:, updated_at:, updated_by:, entries:, additional_properties: nil) ⇒ CandidApiClient::FeeSchedules::V3::Types::Rate

Parameters:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/candidhealth/fee_schedules/v_3/types/rate.rb', line 45

def initialize(rate_id:, dimensions:, version:, updated_at:, updated_by:, entries:,
               additional_properties: nil)
  @rate_id = rate_id
  @dimensions = dimensions
  @version = version
  @updated_at = updated_at
  @updated_by = updated_by
  @entries = entries
  @additional_properties = additional_properties
  @_field_set = {
    "rate_id": rate_id,
    "dimensions": dimensions,
    "version": version,
    "updated_at": updated_at,
    "updated_by": updated_by,
    "entries": entries
  }
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



30
31
32
# File 'lib/candidhealth/fee_schedules/v_3/types/rate.rb', line 30

def additional_properties
  @additional_properties
end

#dimensionsCandidApiClient::FeeSchedules::V3::Types::Dimensions (readonly)

Returns The dimension values that distinguish this rate from others.

Returns:



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

def dimensions
  @dimensions
end

#entriesArray<CandidApiClient::FeeSchedules::V3::Types::RateEntry> (readonly)



28
29
30
# File 'lib/candidhealth/fee_schedules/v_3/types/rate.rb', line 28

def entries
  @entries
end

#rate_idString (readonly)

Returns:

  • (String)


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

def rate_id
  @rate_id
end

#updated_atDate (readonly)

Returns:

  • (Date)


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

def updated_at
  @updated_at
end

#updated_byString (readonly)

Returns:

  • (String)


26
27
28
# File 'lib/candidhealth/fee_schedules/v_3/types/rate.rb', line 26

def updated_by
  @updated_by
end

#versionInteger (readonly)

Returns The version of this rate in the system.

Returns:

  • (Integer)

    The version of this rate in the system.



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

def version
  @version
end

Class Method Details

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

Deserialize a JSON object to an instance of Rate

Parameters:

  • json_object (String)

Returns:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/candidhealth/fee_schedules/v_3/types/rate.rb', line 68

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  rate_id = struct["rate_id"]
  if parsed_json["dimensions"].nil?
    dimensions = nil
  else
    dimensions = parsed_json["dimensions"].to_json
    dimensions = CandidApiClient::FeeSchedules::V3::Types::Dimensions.from_json(json_object: dimensions)
  end
  version = struct["version"]
  updated_at = (Date.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?)
  updated_by = struct["updated_by"]
  entries = parsed_json["entries"]&.map do |item|
    item = item.to_json
    CandidApiClient::FeeSchedules::V3::Types::RateEntry.from_json(json_object: item)
  end
  new(
    rate_id: rate_id,
    dimensions: dimensions,
    version: version,
    updated_at: updated_at,
    updated_by: updated_by,
    entries: entries,
    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)


109
110
111
112
113
114
115
116
# File 'lib/candidhealth/fee_schedules/v_3/types/rate.rb', line 109

def self.validate_raw(obj:)
  obj.rate_id.is_a?(String) != false || raise("Passed value for field obj.rate_id is not the expected type, validation failed.")
  CandidApiClient::FeeSchedules::V3::Types::Dimensions.validate_raw(obj: obj.dimensions)
  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?(Date) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.updated_by.is_a?(String) != false || raise("Passed value for field obj.updated_by is not the expected type, validation failed.")
  obj.entries.is_a?(Array) != false || raise("Passed value for field obj.entries is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Rate to a JSON object

Returns:

  • (String)


99
100
101
# File 'lib/candidhealth/fee_schedules/v_3/types/rate.rb', line 99

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