Class: CandidApiClient::FeeSchedules::V3::Types::ValidationError

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(member:, discriminant:) ⇒ CandidApiClient::FeeSchedules::V3::Types::ValidationError

Parameters:

  • member (Object)
  • discriminant (String)


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

def initialize(member:, discriminant:)
  @member = member
  @discriminant = discriminant
end

Instance Attribute Details

#discriminantString (readonly)

Returns:

  • (String)


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

def discriminant
  @discriminant
end

#memberObject (readonly)

Returns:

  • (Object)


14
15
16
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 14

def member
  @member
end

Class Method Details

.duplicate_rateCandidApiClient::FeeSchedules::V3::Types::ValidationError



123
124
125
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 123

def self.duplicate_rate
  new(member: nil, discriminant: "duplicate_rate")
end

.empty_entriesCandidApiClient::FeeSchedules::V3::Types::ValidationError



128
129
130
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 128

def self.empty_entries
  new(member: nil, discriminant: "empty_entries")
end

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

Deserialize a JSON object to an instance of ValidationError

Parameters:

  • json_object (String)

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 33

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  member = case struct.type
           when "overlapping_rate_entries"
             CandidApiClient::FeeSchedules::V3::Types::OverlappingRateEntriesError.from_json(json_object: json_object)
           when "version_conflict"
             CandidApiClient::Commons::Types::EntityConflictErrorMessage.from_json(json_object: json_object)
           when "organization_provider_not_found"
             CandidApiClient::Commons::Types::EntityNotFoundErrorMessage.from_json(json_object: json_object)
           when "duplicate_rate"
             nil
           when "empty_entries"
             nil
           else
             CandidApiClient::FeeSchedules::V3::Types::OverlappingRateEntriesError.from_json(json_object: json_object)
           end
  new(member: member, discriminant: struct.type)
end

.organization_provider_not_found(member:) ⇒ CandidApiClient::FeeSchedules::V3::Types::ValidationError



118
119
120
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 118

def self.organization_provider_not_found(member:)
  new(member: member, discriminant: "organization_provider_not_found")
end

.overlapping_rate_entries(member:) ⇒ CandidApiClient::FeeSchedules::V3::Types::ValidationError



106
107
108
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 106

def self.overlapping_rate_entries(member:)
  new(member: member, discriminant: "overlapping_rate_entries")
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
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 79

def self.validate_raw(obj:)
  case obj.type
  when "overlapping_rate_entries"
    CandidApiClient::FeeSchedules::V3::Types::OverlappingRateEntriesError.validate_raw(obj: obj)
  when "version_conflict"
    CandidApiClient::Commons::Types::EntityConflictErrorMessage.validate_raw(obj: obj)
  when "organization_provider_not_found"
    CandidApiClient::Commons::Types::EntityNotFoundErrorMessage.validate_raw(obj: obj)
  when "duplicate_rate"
    # noop
  when "empty_entries"
    # noop
  else
    raise("Passed value matched no type within the union, validation failed.")
  end
end

.version_conflict(member:) ⇒ CandidApiClient::FeeSchedules::V3::Types::ValidationError



112
113
114
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 112

def self.version_conflict(member:)
  new(member: member, discriminant: "version_conflict")
end

Instance Method Details

#is_a?(obj) ⇒ Boolean

For Union Types, is_a? functionality is delegated to the wrapped member.

Parameters:

  • obj (Object)

Returns:

  • (Boolean)


100
101
102
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 100

def is_a?(obj)
  @member.is_a?(obj)
end

#kind_of?Object



19
# File 'lib/candidhealth/fee_schedules/v_3/types/validation_error.rb', line 19

alias kind_of? is_a?

#to_json(*_args) ⇒ String

For Union Types, to_json functionality is delegated to the wrapped member.

Returns:

  • (String)


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

def to_json(*_args)
  case @discriminant
  when "overlapping_rate_entries"
    { **@member.to_json, type: @discriminant }.to_json
  when "version_conflict"
    { **@member.to_json, type: @discriminant }.to_json
  when "organization_provider_not_found"
    { **@member.to_json, type: @discriminant }.to_json
  when "duplicate_rate"
    { type: @discriminant }.to_json
  when "empty_entries"
    { type: @discriminant }.to_json
  else
    { "type": @discriminant, value: @member }.to_json
  end
  @member.to_json
end