Class: CandidApiClient::FeeSchedules::V3::Types::RateUploadWithPossibleErrors

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rate_upload:, possible_errors:, existing_rate: OMIT, additional_properties: nil) ⇒ CandidApiClient::FeeSchedules::V3::Types::RateUploadWithPossibleErrors

Parameters:



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb', line 33

def initialize(rate_upload:, possible_errors:, existing_rate: OMIT, additional_properties: nil)
  @rate_upload = rate_upload
  @existing_rate = existing_rate if existing_rate != OMIT
  @possible_errors = possible_errors
  @additional_properties = additional_properties
  @_field_set = {
    "rate_upload": rate_upload,
    "existing_rate": existing_rate,
    "possible_errors": possible_errors
  }.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



21
22
23
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb', line 21

def additional_properties
  @additional_properties
end

#existing_rateCandidApiClient::FeeSchedules::V3::Types::Rate (readonly)



17
18
19
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb', line 17

def existing_rate
  @existing_rate
end

#possible_errorsArray<CandidApiClient::FeeSchedules::V3::Types::ValidationError> (readonly)



19
20
21
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb', line 19

def possible_errors
  @possible_errors
end

#rate_uploadCandidApiClient::FeeSchedules::V3::Types::RateUpload (readonly)



15
16
17
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb', line 15

def rate_upload
  @rate_upload
end

Class Method Details

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

Deserialize a JSON object to an instance of RateUploadWithPossibleErrors



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb', line 51

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["rate_upload"].nil?
    rate_upload = nil
  else
    rate_upload = parsed_json["rate_upload"].to_json
    rate_upload = CandidApiClient::FeeSchedules::V3::Types::RateUpload.from_json(json_object: rate_upload)
  end
  if parsed_json["existing_rate"].nil?
    existing_rate = nil
  else
    existing_rate = parsed_json["existing_rate"].to_json
    existing_rate = CandidApiClient::FeeSchedules::V3::Types::Rate.from_json(json_object: existing_rate)
  end
  possible_errors = parsed_json["possible_errors"]&.map do |item|
    item = item.to_json
    CandidApiClient::FeeSchedules::V3::Types::ValidationError.from_json(json_object: item)
  end
  new(
    rate_upload: rate_upload,
    existing_rate: existing_rate,
    possible_errors: possible_errors,
    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)


91
92
93
94
95
# File 'lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb', line 91

def self.validate_raw(obj:)
  CandidApiClient::FeeSchedules::V3::Types::RateUpload.validate_raw(obj: obj.rate_upload)
  obj.existing_rate.nil? || CandidApiClient::FeeSchedules::V3::Types::Rate.validate_raw(obj: obj.existing_rate)
  obj.possible_errors.is_a?(Array) != false || raise("Passed value for field obj.possible_errors is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of RateUploadWithPossibleErrors to a JSON object

Returns:

  • (String)


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

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