Skip to content

Commit f2a6cec

Browse files
chore: misc sdk polish (#224)
1 parent e25b11c commit f2a6cec

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
@@ -147,9 +147,9 @@ Due to limitations with the Sorbet type system, where a method otherwise can tak
147147
Please follow Sorbet's [setup guides](https://sorbet.org/docs/adopting) for best experience.
148148

149149
```ruby
150-
model = Orb::Models::CustomerCreateParams.new(email: "example-customer@withorb.com", name: "My Customer")
150+
params = Orb::Models::CustomerCreateParams.new(email: "example-customer@withorb.com", name: "My Customer")
151151

152-
orb.customers.create(**model)
152+
orb.customers.create(**params)
153153
```
154154

155155
## Advanced

lib/orb/internal/type/base_model.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ def optional(name_sym, type_info, spec = {})
168168
# @param other [Object]
169169
#
170170
# @return [Boolean]
171-
def ==(other) = other.is_a?(Class) && other <= Orb::Internal::Type::BaseModel && other.fields == fields
171+
def ==(other)
172+
other.is_a?(Class) && other <= Orb::Internal::Type::BaseModel && other.fields == fields
173+
end
172174
end
173175

174176
# @param other [Object]
@@ -350,15 +352,16 @@ def initialize(data = {})
350352
in Hash => coerced
351353
@data = coerced
352354
else
353-
raise ArgumentError.new("Expected a #{Hash} or #{Orb::Internal::Type::BaseModel}, got #{data.inspect}")
355+
message = "Expected a #{Hash} or #{Orb::Internal::Type::BaseModel}, got #{data.inspect}"
356+
raise ArgumentError.new(message)
354357
end
355358
end
356359

357360
# @return [String]
358361
def inspect
359362
rows = self.class.known_fields.keys.map do
360363
"#{_1}=#{@data.key?(_1) ? public_send(_1) : ''}"
361-
rescue Orb::ConversionError
364+
rescue Orb::Errors::ConversionError
362365
"#{_1}=#{@data.fetch(_1)}"
363366
end
364367
"#<#{self.class.name}:0x#{object_id.to_s(16)} #{rows.join(' ')}>"

lib/orb/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?(Orb::Internal::Type::Converter) ? target.dump(value) : Orb::Internal::Type::Unknown.dump(value)
214+
# rubocop:enable Layout/LineLength
213215
end
214216
end
215217
end

lib/orb/internal/type/enum.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def ===(other) = values.include?(other)
5858
#
5959
# @return [Boolean]
6060
def ==(other)
61+
# rubocop:disable Layout/LineLength
6162
other.is_a?(Module) && other.singleton_class <= Orb::Internal::Type::Enum && other.values.to_set == values.to_set
63+
# rubocop:enable Layout/LineLength
6264
end
6365

6466
# @api private

0 commit comments

Comments
 (0)