candidhealth 0.17.5 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/claim_submission/v_1/types/claim_submission_record_create.rb +15 -4
  3. data/lib/candidhealth/commons/types/entity_conflict_error_message.rb +47 -0
  4. data/lib/candidhealth/commons/types/intended_submission_medium.rb +11 -0
  5. data/lib/candidhealth/commons/types/network_type.rb +27 -0
  6. data/lib/candidhealth/commons/types/rate_id.rb +7 -0
  7. data/lib/candidhealth/commons/types/source_of_payment_code.rb +1 -0
  8. data/lib/candidhealth/contracts/v_2/types/contract.rb +2 -2
  9. data/lib/candidhealth/contracts/v_2/types/contract_with_providers.rb +3 -3
  10. data/lib/candidhealth/eligibility/v_2/client.rb +2 -2
  11. data/lib/candidhealth/fee_schedules/client.rb +28 -0
  12. data/lib/candidhealth/fee_schedules/v_3/client.rb +499 -0
  13. data/lib/candidhealth/fee_schedules/v_3/types/dimension_match.rb +157 -0
  14. data/lib/candidhealth/fee_schedules/v_3/types/dimension_name.rb +14 -0
  15. data/lib/candidhealth/fee_schedules/v_3/types/dimensions.rb +136 -0
  16. data/lib/candidhealth/fee_schedules/v_3/types/dimensions_page.rb +69 -0
  17. data/lib/candidhealth/fee_schedules/v_3/types/match_cpt_code.rb +60 -0
  18. data/lib/candidhealth/fee_schedules/v_3/types/match_date.rb +61 -0
  19. data/lib/candidhealth/fee_schedules/v_3/types/match_facility_type_code.rb +61 -0
  20. data/lib/candidhealth/fee_schedules/v_3/types/match_geo.rb +66 -0
  21. data/lib/candidhealth/fee_schedules/v_3/types/match_license_type.rb +61 -0
  22. data/lib/candidhealth/fee_schedules/v_3/types/match_modifiers.rb +66 -0
  23. data/lib/candidhealth/fee_schedules/v_3/types/match_network_types.rb +66 -0
  24. data/lib/candidhealth/fee_schedules/v_3/types/match_payer.rb +61 -0
  25. data/lib/candidhealth/fee_schedules/v_3/types/match_provider.rb +61 -0
  26. data/lib/candidhealth/fee_schedules/v_3/types/match_result.rb +61 -0
  27. data/lib/candidhealth/fee_schedules/v_3/types/match_test_result.rb +66 -0
  28. data/lib/candidhealth/fee_schedules/v_3/types/new_rate.rb +64 -0
  29. data/lib/candidhealth/fee_schedules/v_3/types/new_rate_version.rb +64 -0
  30. data/lib/candidhealth/fee_schedules/v_3/types/optional_dimensions.rb +136 -0
  31. data/lib/candidhealth/fee_schedules/v_3/types/overlapping_rate_entries_error.rb +71 -0
  32. data/lib/candidhealth/fee_schedules/v_3/types/payer_threshold.rb +66 -0
  33. data/lib/candidhealth/fee_schedules/v_3/types/payer_thresholds_page.rb +68 -0
  34. data/lib/candidhealth/fee_schedules/v_3/types/rate.rb +96 -0
  35. data/lib/candidhealth/fee_schedules/v_3/types/rate_entry.rb +72 -0
  36. data/lib/candidhealth/fee_schedules/v_3/types/rate_upload.rb +94 -0
  37. data/lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb +76 -0
  38. data/lib/candidhealth/fee_schedules/v_3/types/rates_page.rb +65 -0
  39. data/lib/candidhealth/fee_schedules/v_3/types/threshold_match.rb +72 -0
  40. data/lib/candidhealth/fee_schedules/v_3/types/validation_error.rb +129 -0
  41. data/lib/requests.rb +2 -2
  42. data/lib/types_export.rb +32 -0
  43. metadata +36 -2
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../commons/types/page_token"
4
+ require "json"
5
+
6
+ module CandidApiClient
7
+ module FeeSchedules
8
+ module V3
9
+ class PayerThresholdsPage
10
+ attr_reader :payer_thresholds, :prev_page_token, :next_page_token, :additional_properties
11
+
12
+ # @param payer_thresholds [Hash{Payers::V3::PAYER_UUID => FeeSchedules::V3::PayerThreshold}]
13
+ # @param prev_page_token [Commons::PAGE_TOKEN]
14
+ # @param next_page_token [Commons::PAGE_TOKEN]
15
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
16
+ # @return [FeeSchedules::V3::PayerThresholdsPage]
17
+ def initialize(payer_thresholds:, prev_page_token: nil, next_page_token: nil, additional_properties: nil)
18
+ # @type [Hash{Payers::V3::PAYER_UUID => FeeSchedules::V3::PayerThreshold}]
19
+ @payer_thresholds = payer_thresholds
20
+ # @type [Commons::PAGE_TOKEN]
21
+ @prev_page_token = prev_page_token
22
+ # @type [Commons::PAGE_TOKEN]
23
+ @next_page_token = next_page_token
24
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
25
+ @additional_properties = additional_properties
26
+ end
27
+
28
+ # Deserialize a JSON object to an instance of PayerThresholdsPage
29
+ #
30
+ # @param json_object [JSON]
31
+ # @return [FeeSchedules::V3::PayerThresholdsPage]
32
+ def self.from_json(json_object:)
33
+ struct = JSON.parse(json_object, object_class: OpenStruct)
34
+ parsed_json = JSON.parse(json_object)
35
+ payer_thresholds = parsed_json["payer_thresholds"]&.transform_values do |_k, v|
36
+ v = v.to_json
37
+ FeeSchedules::V3::PayerThreshold.from_json(json_object: v)
38
+ end
39
+ prev_page_token = struct.prev_page_token
40
+ next_page_token = struct.next_page_token
41
+ new(payer_thresholds: payer_thresholds, prev_page_token: prev_page_token, next_page_token: next_page_token,
42
+ additional_properties: struct)
43
+ end
44
+
45
+ # Serialize an instance of PayerThresholdsPage to a JSON object
46
+ #
47
+ # @return [JSON]
48
+ def to_json(*_args)
49
+ {
50
+ "payer_thresholds": @payer_thresholds,
51
+ "prev_page_token": @prev_page_token,
52
+ "next_page_token": @next_page_token
53
+ }.to_json
54
+ end
55
+
56
+ # 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.
57
+ #
58
+ # @param obj [Object]
59
+ # @return [Void]
60
+ def self.validate_raw(obj:)
61
+ obj.payer_thresholds.is_a?(Hash) != false || raise("Passed value for field obj.payer_thresholds is not the expected type, validation failed.")
62
+ obj.prev_page_token&.is_a?(String) != false || raise("Passed value for field obj.prev_page_token is not the expected type, validation failed.")
63
+ obj.next_page_token&.is_a?(String) != false || raise("Passed value for field obj.next_page_token is not the expected type, validation failed.")
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../commons/types/rate_id"
4
+ require_relative "dimensions"
5
+ require "date"
6
+ require_relative "../../../commons/types/user_id"
7
+ require_relative "rate_entry"
8
+ require "json"
9
+
10
+ module CandidApiClient
11
+ module FeeSchedules
12
+ module V3
13
+ # 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.
14
+ class Rate
15
+ attr_reader :rate_id, :dimensions, :version, :updated_at, :updated_by, :entries, :additional_properties
16
+
17
+ # @param rate_id [Commons::RATE_ID]
18
+ # @param dimensions [FeeSchedules::V3::Dimensions] The dimension values that distinguish this rate from others.
19
+ # @param version [Integer] The version of this rate in the system.
20
+ # @param updated_at [Date]
21
+ # @param updated_by [Commons::USER_ID]
22
+ # @param entries [Array<FeeSchedules::V3::RateEntry>]
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [FeeSchedules::V3::Rate]
25
+ def initialize(rate_id:, dimensions:, version:, updated_at:, updated_by:, entries:, additional_properties: nil)
26
+ # @type [Commons::RATE_ID]
27
+ @rate_id = rate_id
28
+ # @type [FeeSchedules::V3::Dimensions] The dimension values that distinguish this rate from others.
29
+ @dimensions = dimensions
30
+ # @type [Integer] The version of this rate in the system.
31
+ @version = version
32
+ # @type [Date]
33
+ @updated_at = updated_at
34
+ # @type [Commons::USER_ID]
35
+ @updated_by = updated_by
36
+ # @type [Array<FeeSchedules::V3::RateEntry>]
37
+ @entries = entries
38
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
39
+ @additional_properties = additional_properties
40
+ end
41
+
42
+ # Deserialize a JSON object to an instance of Rate
43
+ #
44
+ # @param json_object [JSON]
45
+ # @return [FeeSchedules::V3::Rate]
46
+ def self.from_json(json_object:)
47
+ struct = JSON.parse(json_object, object_class: OpenStruct)
48
+ parsed_json = JSON.parse(json_object)
49
+ rate_id = struct.rate_id
50
+ if parsed_json["dimensions"].nil?
51
+ dimensions = nil
52
+ else
53
+ dimensions = parsed_json["dimensions"].to_json
54
+ dimensions = FeeSchedules::V3::Dimensions.from_json(json_object: dimensions)
55
+ end
56
+ version = struct.version
57
+ updated_at = (Date.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?)
58
+ updated_by = struct.updated_by
59
+ entries = parsed_json["entries"]&.map do |v|
60
+ v = v.to_json
61
+ FeeSchedules::V3::RateEntry.from_json(json_object: v)
62
+ end
63
+ new(rate_id: rate_id, dimensions: dimensions, version: version, updated_at: updated_at,
64
+ updated_by: updated_by, entries: entries, additional_properties: struct)
65
+ end
66
+
67
+ # Serialize an instance of Rate to a JSON object
68
+ #
69
+ # @return [JSON]
70
+ def to_json(*_args)
71
+ {
72
+ "rate_id": @rate_id,
73
+ "dimensions": @dimensions,
74
+ "version": @version,
75
+ "updated_at": @updated_at,
76
+ "updated_by": @updated_by,
77
+ "entries": @entries
78
+ }.to_json
79
+ end
80
+
81
+ # 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.
82
+ #
83
+ # @param obj [Object]
84
+ # @return [Void]
85
+ def self.validate_raw(obj:)
86
+ obj.rate_id.is_a?(UUID) != false || raise("Passed value for field obj.rate_id is not the expected type, validation failed.")
87
+ FeeSchedules::V3::Dimensions.validate_raw(obj: obj.dimensions)
88
+ obj.version.is_a?(Integer) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
89
+ obj.updated_at.is_a?(Date) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
90
+ obj.updated_by.is_a?(UUID) != false || raise("Passed value for field obj.updated_by is not the expected type, validation failed.")
91
+ obj.entries.is_a?(Array) != false || raise("Passed value for field obj.entries is not the expected type, validation failed.")
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require "json"
5
+
6
+ module CandidApiClient
7
+ module FeeSchedules
8
+ module V3
9
+ # 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.
10
+ class RateEntry
11
+ attr_reader :start_date, :end_date, :rate_cents, :is_deactivated, :additional_properties
12
+
13
+ # @param start_date [Date]
14
+ # @param end_date [Date]
15
+ # @param rate_cents [Integer]
16
+ # @param is_deactivated [Boolean]
17
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
18
+ # @return [FeeSchedules::V3::RateEntry]
19
+ def initialize(start_date:, rate_cents:, is_deactivated:, end_date: nil, additional_properties: nil)
20
+ # @type [Date]
21
+ @start_date = start_date
22
+ # @type [Date]
23
+ @end_date = end_date
24
+ # @type [Integer]
25
+ @rate_cents = rate_cents
26
+ # @type [Boolean]
27
+ @is_deactivated = is_deactivated
28
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
29
+ @additional_properties = additional_properties
30
+ end
31
+
32
+ # Deserialize a JSON object to an instance of RateEntry
33
+ #
34
+ # @param json_object [JSON]
35
+ # @return [FeeSchedules::V3::RateEntry]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ parsed_json = JSON.parse(json_object)
39
+ start_date = (Date.parse(parsed_json["start_date"]) unless parsed_json["start_date"].nil?)
40
+ end_date = (Date.parse(parsed_json["end_date"]) unless parsed_json["end_date"].nil?)
41
+ rate_cents = struct.rate_cents
42
+ is_deactivated = struct.is_deactivated
43
+ new(start_date: start_date, end_date: end_date, rate_cents: rate_cents, is_deactivated: is_deactivated,
44
+ additional_properties: struct)
45
+ end
46
+
47
+ # Serialize an instance of RateEntry to a JSON object
48
+ #
49
+ # @return [JSON]
50
+ def to_json(*_args)
51
+ {
52
+ "start_date": @start_date,
53
+ "end_date": @end_date,
54
+ "rate_cents": @rate_cents,
55
+ "is_deactivated": @is_deactivated
56
+ }.to_json
57
+ end
58
+
59
+ # 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.
60
+ #
61
+ # @param obj [Object]
62
+ # @return [Void]
63
+ def self.validate_raw(obj:)
64
+ obj.start_date.is_a?(Date) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.")
65
+ obj.end_date&.is_a?(Date) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.")
66
+ obj.rate_cents.is_a?(Integer) != false || raise("Passed value for field obj.rate_cents is not the expected type, validation failed.")
67
+ obj.is_deactivated.is_a?(Boolean) != false || raise("Passed value for field obj.is_deactivated is not the expected type, validation failed.")
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "new_rate"
5
+ require_relative "new_rate_version"
6
+
7
+ module CandidApiClient
8
+ module FeeSchedules
9
+ module V3
10
+ class RateUpload
11
+ attr_reader :member, :discriminant
12
+
13
+ private_class_method :new
14
+ alias kind_of? is_a?
15
+ # @param member [Object]
16
+ # @param discriminant [String]
17
+ # @return [FeeSchedules::V3::RateUpload]
18
+ def initialize(member:, discriminant:)
19
+ # @type [Object]
20
+ @member = member
21
+ # @type [String]
22
+ @discriminant = discriminant
23
+ end
24
+
25
+ # Deserialize a JSON object to an instance of RateUpload
26
+ #
27
+ # @param json_object [JSON]
28
+ # @return [FeeSchedules::V3::RateUpload]
29
+ def self.from_json(json_object:)
30
+ struct = JSON.parse(json_object, object_class: OpenStruct)
31
+ member = case struct.type
32
+ when "new_rate"
33
+ FeeSchedules::V3::NewRate.from_json(json_object: json_object)
34
+ when "new_version"
35
+ FeeSchedules::V3::NewRateVersion.from_json(json_object: json_object)
36
+ else
37
+ FeeSchedules::V3::NewRate.from_json(json_object: json_object)
38
+ end
39
+ new(member: member, discriminant: struct.type)
40
+ end
41
+
42
+ # For Union Types, to_json functionality is delegated to the wrapped member.
43
+ #
44
+ # @return [JSON]
45
+ def to_json(*_args)
46
+ case @discriminant
47
+ when "new_rate"
48
+ { **@member.to_json, type: @discriminant }.to_json
49
+ when "new_version"
50
+ { **@member.to_json, type: @discriminant }.to_json
51
+ else
52
+ { "type": @discriminant, value: @member }.to_json
53
+ end
54
+ @member.to_json
55
+ end
56
+
57
+ # 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.
58
+ #
59
+ # @param obj [Object]
60
+ # @return [Void]
61
+ def self.validate_raw(obj:)
62
+ case obj.type
63
+ when "new_rate"
64
+ FeeSchedules::V3::NewRate.validate_raw(obj: obj)
65
+ when "new_version"
66
+ FeeSchedules::V3::NewRateVersion.validate_raw(obj: obj)
67
+ else
68
+ raise("Passed value matched no type within the union, validation failed.")
69
+ end
70
+ end
71
+
72
+ # For Union Types, is_a? functionality is delegated to the wrapped member.
73
+ #
74
+ # @param obj [Object]
75
+ # @return [Boolean]
76
+ def is_a?(obj)
77
+ @member.is_a?(obj)
78
+ end
79
+
80
+ # @param member [FeeSchedules::V3::NewRate]
81
+ # @return [FeeSchedules::V3::RateUpload]
82
+ def self.new_rate(member:)
83
+ new(member: member, discriminant: "new_rate")
84
+ end
85
+
86
+ # @param member [FeeSchedules::V3::NewRateVersion]
87
+ # @return [FeeSchedules::V3::RateUpload]
88
+ def self.new_version(member:)
89
+ new(member: member, discriminant: "new_version")
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rate_upload"
4
+ require_relative "rate"
5
+ require_relative "validation_error"
6
+ require "json"
7
+
8
+ module CandidApiClient
9
+ module FeeSchedules
10
+ module V3
11
+ class RateUploadWithPossibleErrors
12
+ attr_reader :rate_upload, :existing_rate, :possible_errors, :additional_properties
13
+
14
+ # @param rate_upload [FeeSchedules::V3::RateUpload]
15
+ # @param existing_rate [FeeSchedules::V3::Rate]
16
+ # @param possible_errors [Array<FeeSchedules::V3::ValidationError>]
17
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
18
+ # @return [FeeSchedules::V3::RateUploadWithPossibleErrors]
19
+ def initialize(rate_upload:, possible_errors:, existing_rate: nil, additional_properties: nil)
20
+ # @type [FeeSchedules::V3::RateUpload]
21
+ @rate_upload = rate_upload
22
+ # @type [FeeSchedules::V3::Rate]
23
+ @existing_rate = existing_rate
24
+ # @type [Array<FeeSchedules::V3::ValidationError>]
25
+ @possible_errors = possible_errors
26
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
27
+ @additional_properties = additional_properties
28
+ end
29
+
30
+ # Deserialize a JSON object to an instance of RateUploadWithPossibleErrors
31
+ #
32
+ # @param json_object [JSON]
33
+ # @return [FeeSchedules::V3::RateUploadWithPossibleErrors]
34
+ def self.from_json(json_object:)
35
+ struct = JSON.parse(json_object, object_class: OpenStruct)
36
+ parsed_json = JSON.parse(json_object)
37
+ if parsed_json["rate_upload"].nil?
38
+ rate_upload = nil
39
+ else
40
+ rate_upload = parsed_json["rate_upload"].to_json
41
+ rate_upload = FeeSchedules::V3::RateUpload.from_json(json_object: rate_upload)
42
+ end
43
+ if parsed_json["existing_rate"].nil?
44
+ existing_rate = nil
45
+ else
46
+ existing_rate = parsed_json["existing_rate"].to_json
47
+ existing_rate = FeeSchedules::V3::Rate.from_json(json_object: existing_rate)
48
+ end
49
+ possible_errors = parsed_json["possible_errors"]&.map do |v|
50
+ v = v.to_json
51
+ FeeSchedules::V3::ValidationError.from_json(json_object: v)
52
+ end
53
+ new(rate_upload: rate_upload, existing_rate: existing_rate, possible_errors: possible_errors,
54
+ additional_properties: struct)
55
+ end
56
+
57
+ # Serialize an instance of RateUploadWithPossibleErrors to a JSON object
58
+ #
59
+ # @return [JSON]
60
+ def to_json(*_args)
61
+ { "rate_upload": @rate_upload, "existing_rate": @existing_rate, "possible_errors": @possible_errors }.to_json
62
+ end
63
+
64
+ # 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.
65
+ #
66
+ # @param obj [Object]
67
+ # @return [Void]
68
+ def self.validate_raw(obj:)
69
+ FeeSchedules::V3::RateUpload.validate_raw(obj: obj.rate_upload)
70
+ obj.existing_rate.nil? || FeeSchedules::V3::Rate.validate_raw(obj: obj.existing_rate)
71
+ obj.possible_errors.is_a?(Array) != false || raise("Passed value for field obj.possible_errors is not the expected type, validation failed.")
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rate"
4
+ require_relative "../../../commons/types/page_token"
5
+ require "json"
6
+
7
+ module CandidApiClient
8
+ module FeeSchedules
9
+ module V3
10
+ class RatesPage
11
+ attr_reader :rates, :prev_page_token, :next_page_token, :additional_properties
12
+
13
+ # @param rates [Array<FeeSchedules::V3::Rate>]
14
+ # @param prev_page_token [Commons::PAGE_TOKEN]
15
+ # @param next_page_token [Commons::PAGE_TOKEN]
16
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
17
+ # @return [FeeSchedules::V3::RatesPage]
18
+ def initialize(rates:, prev_page_token: nil, next_page_token: nil, additional_properties: nil)
19
+ # @type [Array<FeeSchedules::V3::Rate>]
20
+ @rates = rates
21
+ # @type [Commons::PAGE_TOKEN]
22
+ @prev_page_token = prev_page_token
23
+ # @type [Commons::PAGE_TOKEN]
24
+ @next_page_token = next_page_token
25
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
26
+ @additional_properties = additional_properties
27
+ end
28
+
29
+ # Deserialize a JSON object to an instance of RatesPage
30
+ #
31
+ # @param json_object [JSON]
32
+ # @return [FeeSchedules::V3::RatesPage]
33
+ def self.from_json(json_object:)
34
+ struct = JSON.parse(json_object, object_class: OpenStruct)
35
+ parsed_json = JSON.parse(json_object)
36
+ rates = parsed_json["rates"]&.map do |v|
37
+ v = v.to_json
38
+ FeeSchedules::V3::Rate.from_json(json_object: v)
39
+ end
40
+ prev_page_token = struct.prev_page_token
41
+ next_page_token = struct.next_page_token
42
+ new(rates: rates, prev_page_token: prev_page_token, next_page_token: next_page_token,
43
+ additional_properties: struct)
44
+ end
45
+
46
+ # Serialize an instance of RatesPage to a JSON object
47
+ #
48
+ # @return [JSON]
49
+ def to_json(*_args)
50
+ { "rates": @rates, "prev_page_token": @prev_page_token, "next_page_token": @next_page_token }.to_json
51
+ end
52
+
53
+ # 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.
54
+ #
55
+ # @param obj [Object]
56
+ # @return [Void]
57
+ def self.validate_raw(obj:)
58
+ obj.rates.is_a?(Array) != false || raise("Passed value for field obj.rates is not the expected type, validation failed.")
59
+ obj.prev_page_token&.is_a?(String) != false || raise("Passed value for field obj.prev_page_token is not the expected type, validation failed.")
60
+ obj.next_page_token&.is_a?(String) != false || raise("Passed value for field obj.next_page_token is not the expected type, validation failed.")
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "payer_threshold"
4
+ require "json"
5
+
6
+ module CandidApiClient
7
+ module FeeSchedules
8
+ module V3
9
+ # Threshold and dollar amount matching for a service line
10
+ class ThresholdMatch
11
+ attr_reader :threshold, :rate_cents, :match, :explanation, :additional_properties
12
+
13
+ # @param threshold [FeeSchedules::V3::PayerThreshold]
14
+ # @param rate_cents [Integer]
15
+ # @param match [Boolean]
16
+ # @param explanation [String]
17
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
18
+ # @return [FeeSchedules::V3::ThresholdMatch]
19
+ def initialize(threshold:, rate_cents:, match:, explanation:, additional_properties: nil)
20
+ # @type [FeeSchedules::V3::PayerThreshold]
21
+ @threshold = threshold
22
+ # @type [Integer]
23
+ @rate_cents = rate_cents
24
+ # @type [Boolean]
25
+ @match = match
26
+ # @type [String]
27
+ @explanation = explanation
28
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
29
+ @additional_properties = additional_properties
30
+ end
31
+
32
+ # Deserialize a JSON object to an instance of ThresholdMatch
33
+ #
34
+ # @param json_object [JSON]
35
+ # @return [FeeSchedules::V3::ThresholdMatch]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ parsed_json = JSON.parse(json_object)
39
+ if parsed_json["threshold"].nil?
40
+ threshold = nil
41
+ else
42
+ threshold = parsed_json["threshold"].to_json
43
+ threshold = FeeSchedules::V3::PayerThreshold.from_json(json_object: threshold)
44
+ end
45
+ rate_cents = struct.rate_cents
46
+ match = struct.match
47
+ explanation = struct.explanation
48
+ new(threshold: threshold, rate_cents: rate_cents, match: match, explanation: explanation,
49
+ additional_properties: struct)
50
+ end
51
+
52
+ # Serialize an instance of ThresholdMatch to a JSON object
53
+ #
54
+ # @return [JSON]
55
+ def to_json(*_args)
56
+ { "threshold": @threshold, "rate_cents": @rate_cents, "match": @match, "explanation": @explanation }.to_json
57
+ end
58
+
59
+ # 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.
60
+ #
61
+ # @param obj [Object]
62
+ # @return [Void]
63
+ def self.validate_raw(obj:)
64
+ FeeSchedules::V3::PayerThreshold.validate_raw(obj: obj.threshold)
65
+ obj.rate_cents.is_a?(Integer) != false || raise("Passed value for field obj.rate_cents is not the expected type, validation failed.")
66
+ obj.match.is_a?(Boolean) != false || raise("Passed value for field obj.match is not the expected type, validation failed.")
67
+ obj.explanation.is_a?(String) != false || raise("Passed value for field obj.explanation is not the expected type, validation failed.")
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,129 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "overlapping_rate_entries_error"
5
+ require_relative "../../../commons/types/entity_conflict_error_message"
6
+ require_relative "../../../commons/types/entity_not_found_error_message"
7
+
8
+ module CandidApiClient
9
+ module FeeSchedules
10
+ module V3
11
+ class ValidationError
12
+ attr_reader :member, :discriminant
13
+
14
+ private_class_method :new
15
+ alias kind_of? is_a?
16
+ # @param member [Object]
17
+ # @param discriminant [String]
18
+ # @return [FeeSchedules::V3::ValidationError]
19
+ def initialize(member:, discriminant:)
20
+ # @type [Object]
21
+ @member = member
22
+ # @type [String]
23
+ @discriminant = discriminant
24
+ end
25
+
26
+ # Deserialize a JSON object to an instance of ValidationError
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [FeeSchedules::V3::ValidationError]
30
+ def self.from_json(json_object:)
31
+ struct = JSON.parse(json_object, object_class: OpenStruct)
32
+ member = case struct.type
33
+ when "overlapping_rate_entries"
34
+ FeeSchedules::V3::OverlappingRateEntriesError.from_json(json_object: json_object)
35
+ when "version_conflict"
36
+ Commons::EntityConflictErrorMessage.from_json(json_object: json_object)
37
+ when "organization_provider_not_found"
38
+ Commons::EntityNotFoundErrorMessage.from_json(json_object: json_object)
39
+ when "duplicate_rate"
40
+ nil
41
+ when "empty_entries"
42
+ nil
43
+ else
44
+ FeeSchedules::V3::OverlappingRateEntriesError.from_json(json_object: json_object)
45
+ end
46
+ new(member: member, discriminant: struct.type)
47
+ end
48
+
49
+ # For Union Types, to_json functionality is delegated to the wrapped member.
50
+ #
51
+ # @return [JSON]
52
+ def to_json(*_args)
53
+ case @discriminant
54
+ when "overlapping_rate_entries"
55
+ { **@member.to_json, type: @discriminant }.to_json
56
+ when "version_conflict"
57
+ { **@member.to_json, type: @discriminant }.to_json
58
+ when "organization_provider_not_found"
59
+ { **@member.to_json, type: @discriminant }.to_json
60
+ when "duplicate_rate"
61
+ { type: @discriminant }.to_json
62
+ when "empty_entries"
63
+ { type: @discriminant }.to_json
64
+ else
65
+ { "type": @discriminant, value: @member }.to_json
66
+ end
67
+ @member.to_json
68
+ end
69
+
70
+ # 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.
71
+ #
72
+ # @param obj [Object]
73
+ # @return [Void]
74
+ def self.validate_raw(obj:)
75
+ case obj.type
76
+ when "overlapping_rate_entries"
77
+ FeeSchedules::V3::OverlappingRateEntriesError.validate_raw(obj: obj)
78
+ when "version_conflict"
79
+ Commons::EntityConflictErrorMessage.validate_raw(obj: obj)
80
+ when "organization_provider_not_found"
81
+ Commons::EntityNotFoundErrorMessage.validate_raw(obj: obj)
82
+ when "duplicate_rate"
83
+ # noop
84
+ when "empty_entries"
85
+ # noop
86
+ else
87
+ raise("Passed value matched no type within the union, validation failed.")
88
+ end
89
+ end
90
+
91
+ # For Union Types, is_a? functionality is delegated to the wrapped member.
92
+ #
93
+ # @param obj [Object]
94
+ # @return [Boolean]
95
+ def is_a?(obj)
96
+ @member.is_a?(obj)
97
+ end
98
+
99
+ # @param member [FeeSchedules::V3::OverlappingRateEntriesError]
100
+ # @return [FeeSchedules::V3::ValidationError]
101
+ def self.overlapping_rate_entries(member:)
102
+ new(member: member, discriminant: "overlapping_rate_entries")
103
+ end
104
+
105
+ # @param member [Commons::EntityConflictErrorMessage]
106
+ # @return [FeeSchedules::V3::ValidationError]
107
+ def self.version_conflict(member:)
108
+ new(member: member, discriminant: "version_conflict")
109
+ end
110
+
111
+ # @param member [Commons::EntityNotFoundErrorMessage]
112
+ # @return [FeeSchedules::V3::ValidationError]
113
+ def self.organization_provider_not_found(member:)
114
+ new(member: member, discriminant: "organization_provider_not_found")
115
+ end
116
+
117
+ # @return [FeeSchedules::V3::ValidationError]
118
+ def self.duplicate_rate
119
+ new(member: nil, discriminant: "duplicate_rate")
120
+ end
121
+
122
+ # @return [FeeSchedules::V3::ValidationError]
123
+ def self.empty_entries
124
+ new(member: nil, discriminant: "empty_entries")
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end