Skip to content

Commit 9af5943

Browse files
chore: misc sdk polish (#116)
1 parent 0745cc7 commit 9af5943

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ Style/MethodCallWithArgsParentheses:
202202
Exclude:
203203
- "**/*.gemspec"
204204

205+
Style/MultilineBlockChain:
206+
Enabled: false
207+
205208
# Perfectly fine.
206209
Style/MultipleComparison:
207210
Enabled: false

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ Due to limitations with the Sorbet type system, where a method otherwise can tak
139139
Please follow Sorbet's [setup guides](https://sorbet.org/docs/adopting) for best experience.
140140

141141
```ruby
142-
model = FinchAPI::Models::HRIS::DirectoryListParams.new
142+
params = FinchAPI::Models::HRIS::DirectoryListParams.new
143143

144-
finch.hris.directory.list(**model)
144+
finch.hris.directory.list(**params)
145145
```
146146

147147
## Advanced

lib/finch_api/internal/type/base_model.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ def optional(name_sym, type_info, spec = {})
175175
# @param other [Object]
176176
#
177177
# @return [Boolean]
178-
def ==(other) = other.is_a?(Class) && other <= FinchAPI::Internal::Type::BaseModel && other.fields == fields
178+
def ==(other)
179+
other.is_a?(Class) && other <= FinchAPI::Internal::Type::BaseModel && other.fields == fields
180+
end
179181
end
180182

181183
# @param other [Object]
@@ -357,15 +359,16 @@ def initialize(data = {})
357359
in Hash => coerced
358360
@data = coerced
359361
else
360-
raise ArgumentError.new("Expected a #{Hash} or #{FinchAPI::Internal::Type::BaseModel}, got #{data.inspect}")
362+
message = "Expected a #{Hash} or #{FinchAPI::Internal::Type::BaseModel}, got #{data.inspect}"
363+
raise ArgumentError.new(message)
361364
end
362365
end
363366

364367
# @return [String]
365368
def inspect
366369
rows = self.class.known_fields.keys.map do
367370
"#{_1}=#{@data.key?(_1) ? public_send(_1) : ''}"
368-
rescue FinchAPI::ConversionError
371+
rescue FinchAPI::Errors::ConversionError
369372
"#{_1}=#{@data.fetch(_1)}"
370373
end
371374
"#<#{self.class.name}:0x#{object_id.to_s(16)} #{rows.join(' ')}>"

lib/finch_api/internal/type/converter.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ def coerce(
209209
#
210210
# @return [Object]
211211
def dump(target, value)
212+
# rubocop:disable Layout/LineLength
212213
target.is_a?(FinchAPI::Internal::Type::Converter) ? target.dump(value) : FinchAPI::Internal::Type::Unknown.dump(value)
214+
# rubocop:enable Layout/LineLength
213215
end
214216
end
215217
end

lib/finch_api/internal/type/enum.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ def ===(other) = values.include?(other)
6262
#
6363
# @return [Boolean]
6464
def ==(other)
65+
# rubocop:disable Layout/LineLength
6566
other.is_a?(Module) && other.singleton_class <= FinchAPI::Internal::Type::Enum && other.values.to_set == values.to_set
67+
# rubocop:enable Layout/LineLength
6668
end
6769

6870
# @api private

0 commit comments

Comments
 (0)