Class: CandidApiClient::FeeSchedules::V3::Types::NewRateVersion

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rate_id:, previous_version:, entries:, additional_properties: nil) ⇒ CandidApiClient::FeeSchedules::V3::Types::NewRateVersion

Parameters:

  • rate_id (String)
  • previous_version (Integer)

    New versions of rates must indicate the exact version they modify. When the system attempts to save this new version, if the latest version in the system does not equal this previos_version, the request will be rejected with a EntityConflictError.

  • entries (Array<CandidApiClient::FeeSchedules::V3::Types::RateEntry>)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
# File 'lib/candidhealth/fee_schedules/v_3/types/new_rate_version.rb', line 37

def initialize(rate_id:, previous_version:, entries:, additional_properties: nil)
  @rate_id = rate_id
  @previous_version = previous_version
  @entries = entries
  @additional_properties = additional_properties
  @_field_set = { "rate_id": rate_id, "previous_version": previous_version, "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



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

def additional_properties
  @additional_properties
end

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



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

def entries
  @entries
end

#previous_versionInteger (readonly)

Returns New versions of rates must indicate the exact version they modify. When the system attempts to save this new version, if the latest version in the system does not equal this previos_version, the request will be rejected with a EntityConflictError.

Returns:

  • (Integer)

    New versions of rates must indicate the exact version they modify. When the system attempts to save this new version, if the latest version in the system does not equal this previos_version, the request will be rejected with a EntityConflictError.



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

def previous_version
  @previous_version
end

#rate_idString (readonly)

Returns:

  • (String)


13
14
15
# File 'lib/candidhealth/fee_schedules/v_3/types/new_rate_version.rb', line 13

def rate_id
  @rate_id
end

Class Method Details

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

Deserialize a JSON object to an instance of NewRateVersion

Parameters:

  • json_object (String)

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/candidhealth/fee_schedules/v_3/types/new_rate_version.rb', line 49

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"]
  previous_version = struct["previous_version"]
  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,
    previous_version: previous_version,
    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)


79
80
81
82
83
# File 'lib/candidhealth/fee_schedules/v_3/types/new_rate_version.rb', line 79

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.")
  obj.previous_version.is_a?(Integer) != false || raise("Passed value for field obj.previous_version 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 NewRateVersion to a JSON object

Returns:

  • (String)


69
70
71
# File 'lib/candidhealth/fee_schedules/v_3/types/new_rate_version.rb', line 69

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