Skip to content

Commit b6d3a80

Browse files
chore: more accurate type annotations and aliases
1 parent 2238283 commit b6d3a80

File tree

6 files changed

+44
-47
lines changed

6 files changed

+44
-47
lines changed

lib/finch_api/errors.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
module FinchAPI
44
module Errors
55
class Error < StandardError
6-
# @!parse
7-
# # @return [StandardError, nil]
8-
# attr_accessor :cause
6+
# @!attribute cause
7+
#
8+
# @return [StandardError, nil]
99
end
1010

1111
class ConversionError < FinchAPI::Errors::Error
@@ -40,13 +40,13 @@ def initialize(url:, status: nil, body: nil, request: nil, response: nil, messag
4040
end
4141

4242
class APIConnectionError < FinchAPI::Errors::APIError
43-
# @!parse
44-
# # @return [nil]
45-
# attr_accessor :status
43+
# @!attribute status
44+
#
45+
# @return [nil]
4646

47-
# @!parse
48-
# # @return [nil]
49-
# attr_accessor :body
47+
# @!attribute body
48+
#
49+
# @return [nil]
5050

5151
# @api private
5252
#

lib/finch_api/internal/type/boolean.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,16 @@ def coerce(value, state:)
4646
value
4747
end
4848

49-
# @!parse
50-
# # @api private
51-
# #
52-
# # @param value [Boolean, Object]
53-
# #
54-
# # @param state [Hash{Symbol=>Object}] .
55-
# #
56-
# # @option state [Boolean] :can_retry
57-
# #
58-
# # @return [Boolean, Object]
59-
# def dump(value, state:) = super
49+
# @!method dump(value, state:)
50+
# @api private
51+
#
52+
# @param value [Boolean, Object]
53+
#
54+
# @param state [Hash{Symbol=>Object}] .
55+
#
56+
# @option state [Boolean] :can_retry
57+
#
58+
# @return [Boolean, Object]
6059
end
6160
end
6261
end

lib/finch_api/internal/type/enum.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,16 @@ def coerce(value, state:)
100100
end
101101
end
102102

103-
# @!parse
104-
# # @api private
105-
# #
106-
# # @param value [Symbol, Object]
107-
# #
108-
# # @param state [Hash{Symbol=>Object}] .
109-
# #
110-
# # @option state [Boolean] :can_retry
111-
# #
112-
# # @return [Symbol, Object]
113-
# def dump(value, state:) = super
103+
# @!method dump(value, state:)
104+
# @api private
105+
#
106+
# @param value [Symbol, Object]
107+
#
108+
# @param state [Hash{Symbol=>Object}] .
109+
#
110+
# @option state [Boolean] :can_retry
111+
#
112+
# @return [Symbol, Object]
114113

115114
# @api private
116115
#

lib/finch_api/internal/type/unknown.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,16 @@ def coerce(value, state:)
4848
value
4949
end
5050

51-
# @!parse
52-
# # @api private
53-
# #
54-
# # @param value [Object]
55-
# #
56-
# # @param state [Hash{Symbol=>Object}] .
57-
# #
58-
# # @option state [Boolean] :can_retry
59-
# #
60-
# # @return [Object]
61-
# def dump(value, state:) = super
51+
# @!method dump(value, state:)
52+
# @api private
53+
#
54+
# @param value [Object]
55+
#
56+
# @param state [Hash{Symbol=>Object}] .
57+
#
58+
# @option state [Boolean] :can_retry
59+
#
60+
# @return [Object]
6261
end
6362

6463
# rubocop:enable Lint/UnusedMethodArgument

lib/finch_api/request_options.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ def self.validate!(opts)
6565
# @return [Float, nil]
6666
optional :timeout, Float
6767

68-
# @!parse
69-
# # @!method initialize(values = {})
70-
# # Returns a new instance of RequestOptions.
71-
# #
72-
# # @param values [Hash{Symbol=>Object}]
68+
# @!method initialize(values = {})
69+
# Returns a new instance of RequestOptions.
70+
#
71+
# @param values [Hash{Symbol=>Object}]
7372
end
7473
end

test/finch_api/file_part_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ def test_to_json
88
filepart = FinchAPI::FilePart.new(StringIO.new(text))
99

1010
assert_equal(text.to_json, filepart.to_json)
11+
assert_equal(text.to_yaml, filepart.to_yaml)
1112
end
1213
end

0 commit comments

Comments
 (0)