Class: Cloudflare::AI::Result
- Inherits:
-
Object
- Object
- Cloudflare::AI::Result
show all
- Defined in:
- lib/cloudflare/ai/result.rb
Instance Method Summary
collapse
Constructor Details
#initialize(json_string_or_ruby_hash) ⇒ Result
Returns a new instance of Result.
5
6
7
|
# File 'lib/cloudflare/ai/result.rb', line 5
def initialize(json_string_or_ruby_hash)
@result_data = parse_data(json_string_or_ruby_hash)
end
|
Instance Method Details
#errors ⇒ Object
21
22
23
|
# File 'lib/cloudflare/ai/result.rb', line 21
def errors
result_data.dig(:errors)
end
|
#failure? ⇒ Boolean
17
18
19
|
# File 'lib/cloudflare/ai/result.rb', line 17
def failure?
!success?
end
|
#messages ⇒ Object
25
26
27
|
# File 'lib/cloudflare/ai/result.rb', line 25
def messages
result_data.dig(:messages)
end
|
#result ⇒ Object
9
10
11
|
# File 'lib/cloudflare/ai/result.rb', line 9
def result
result_data[:result]
end
|
#success? ⇒ Boolean
13
14
15
|
# File 'lib/cloudflare/ai/result.rb', line 13
def success?
success == true
end
|
#to_json ⇒ Object
29
30
31
|
# File 'lib/cloudflare/ai/result.rb', line 29
def to_json
result_data.to_json
end
|