Class: Vellum::VellumSdkError
- Inherits:
-
Object
- Object
- Vellum::VellumSdkError
- Defined in:
- lib/vellum_ai/types/vellum_sdk_error.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #code ⇒ Vellum::VellumSdkErrorCodeEnum readonly
- #message ⇒ String readonly
- #raw_data ⇒ Vellum::VellumSdkErrorRawData readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(message:, raw_data: OMIT, code:, additional_properties: nil) ⇒ Vellum::VellumSdkError constructor
- #to_json ⇒ String
Constructor Details
#initialize(message:, raw_data: OMIT, code:, additional_properties: nil) ⇒ Vellum::VellumSdkError
28 29 30 31 32 33 34 35 36 |
# File 'lib/vellum_ai/types/vellum_sdk_error.rb', line 28 def initialize(message:, raw_data: OMIT, code:, additional_properties: nil) @message = @raw_data = raw_data if raw_data != OMIT @code = code @additional_properties = additional_properties @_field_set = { "message": , "raw_data": raw_data, "code": code }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/vellum_ai/types/vellum_sdk_error.rb', line 16 def additional_properties @additional_properties end |
#code ⇒ Vellum::VellumSdkErrorCodeEnum (readonly)
14 15 16 |
# File 'lib/vellum_ai/types/vellum_sdk_error.rb', line 14 def code @code end |
#message ⇒ String (readonly)
10 11 12 |
# File 'lib/vellum_ai/types/vellum_sdk_error.rb', line 10 def @message end |
#raw_data ⇒ Vellum::VellumSdkErrorRawData (readonly)
12 13 14 |
# File 'lib/vellum_ai/types/vellum_sdk_error.rb', line 12 def raw_data @raw_data end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::VellumSdkError
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/vellum_ai/types/vellum_sdk_error.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["message"] unless parsed_json["raw_data"].nil? raw_data = parsed_json["raw_data"].to_json raw_data = Vellum::VellumSdkErrorRawData.from_json(json_object: raw_data) else raw_data = nil end code = parsed_json["code"] new( message: , raw_data: raw_data, code: code, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
71 72 73 74 75 |
# File 'lib/vellum_ai/types/vellum_sdk_error.rb', line 71 def self.validate_raw(obj:) obj..is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") obj.raw_data.nil? || Vellum::VellumSdkErrorRawData.validate_raw(obj: obj.raw_data) obj.code.is_a?(Vellum::VellumSdkErrorCodeEnum) != false || raise("Passed value for field obj.code is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
62 63 64 |
# File 'lib/vellum_ai/types/vellum_sdk_error.rb', line 62 def to_json @_field_set&.to_json end |