Skip to content

Commit 8950333

Browse files
chore: rename confusing Type::BooleanModel to Type::Boolean (#227)
1 parent edbbd05 commit 8950333

File tree

68 files changed

+441
-439
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+441
-439
lines changed

lib/orb/internal/page.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class PaginationMetadata < Orb::Internal::Type::BaseModel
9292
# @!attribute has_more
9393
#
9494
# @return [Boolean]
95-
required :has_more, Orb::Internal::Type::BooleanModel
95+
required :has_more, Orb::Internal::Type::Boolean
9696

9797
# @!attribute next_cursor
9898
#

lib/orb/internal/type/boolean_model.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Type
88
# @abstract
99
#
1010
# Ruby has no Boolean class; this is something for models to refer to.
11-
class BooleanModel
11+
class Boolean
1212
extend Orb::Internal::Type::Converter
1313

1414
# @param other [Object]
@@ -19,7 +19,7 @@ def self.===(other) = other == true || other == false
1919
# @param other [Object]
2020
#
2121
# @return [Boolean]
22-
def self.==(other) = other.is_a?(Class) && other <= Orb::Internal::Type::BooleanModel
22+
def self.==(other) = other.is_a?(Class) && other <= Orb::Internal::Type::Boolean
2323

2424
class << self
2525
# @api private

lib/orb/internal/type/converter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def type_info(spec)
6464
in Hash
6565
type_info(spec.slice(:const, :enum, :union).first&.last)
6666
in true | false
67-
-> { Orb::Internal::Type::BooleanModel }
67+
-> { Orb::Internal::Type::Boolean }
6868
in Orb::Internal::Type::Converter | Class | Symbol
6969
-> { spec }
7070
in NilClass | Integer | Float

lib/orb/internal/util.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class << self
6161
# @return [Boolean]
6262
def primitive?(input)
6363
case input
64-
in true | false | Integer | Float | Symbol | String
64+
in true | false | Numeric | Symbol | String
6565
true
6666
else
6767
false
@@ -504,7 +504,7 @@ class << self
504504
def encode_content(headers, body)
505505
content_type = headers["content-type"]
506506
case [content_type, body]
507-
in [%r{^application/(?:vnd\.api\+)?json}, Hash | Array]
507+
in [%r{^application/(?:vnd\.api\+)?json}, _] unless body.nil?
508508
[headers, JSON.fast_generate(body)]
509509
in [%r{^application/(?:x-)?jsonl}, Enumerable]
510510
[headers, body.lazy.map { JSON.fast_generate(_1) }]
@@ -516,6 +516,8 @@ def encode_content(headers, body)
516516
[headers, body.tap(&:rewind)]
517517
in [_, StringIO]
518518
[headers, body.string]
519+
in [_, Symbol | Numeric]
520+
[headers, body.to_s]
519521
else
520522
[headers, body]
521523
end

lib/orb/models/alert.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Alert < Orb::Internal::Type::BaseModel
3232
# Whether the alert is enabled or disabled.
3333
#
3434
# @return [Boolean]
35-
required :enabled, Orb::Internal::Type::BooleanModel
35+
required :enabled, Orb::Internal::Type::Boolean
3636

3737
# @!attribute metric
3838
# The metric the alert applies to.

lib/orb/models/coupon_list_params.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CouponListParams < Orb::Internal::Type::BaseModel
3636
# coupons).
3737
#
3838
# @return [Boolean, nil]
39-
optional :show_archived, Orb::Internal::Type::BooleanModel, nil?: true
39+
optional :show_archived, Orb::Internal::Type::Boolean, nil?: true
4040

4141
# @!parse
4242
# # @param cursor [String, nil]

lib/orb/models/customer.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Customer < Orb::Internal::Type::BaseModel
1717
# @!attribute auto_collection
1818
#
1919
# @return [Boolean]
20-
required :auto_collection, Orb::Internal::Type::BooleanModel
20+
required :auto_collection, Orb::Internal::Type::Boolean
2121

2222
# @!attribute balance
2323
# The customer's current balance in their currency.
@@ -51,12 +51,12 @@ class Customer < Orb::Internal::Type::BaseModel
5151
# @!attribute email_delivery
5252
#
5353
# @return [Boolean]
54-
required :email_delivery, Orb::Internal::Type::BooleanModel
54+
required :email_delivery, Orb::Internal::Type::Boolean
5555

5656
# @!attribute exempt_from_automated_tax
5757
#
5858
# @return [Boolean, nil]
59-
required :exempt_from_automated_tax, Orb::Internal::Type::BooleanModel, nil?: true
59+
required :exempt_from_automated_tax, Orb::Internal::Type::Boolean, nil?: true
6060

6161
# @!attribute external_customer_id
6262
# An optional user-defined ID for this customer resource, used throughout the
@@ -807,7 +807,7 @@ class AccountingSyncConfiguration < Orb::Internal::Type::BaseModel
807807
# @!attribute excluded
808808
#
809809
# @return [Boolean]
810-
required :excluded, Orb::Internal::Type::BooleanModel
810+
required :excluded, Orb::Internal::Type::Boolean
811811

812812
# @!parse
813813
# # @param accounting_providers [Array<Orb::Models::Customer::AccountingSyncConfiguration::AccountingProvider>]
@@ -858,7 +858,7 @@ class ReportingConfiguration < Orb::Internal::Type::BaseModel
858858
# @!attribute exempt
859859
#
860860
# @return [Boolean]
861-
required :exempt, Orb::Internal::Type::BooleanModel
861+
required :exempt, Orb::Internal::Type::Boolean
862862

863863
# @!parse
864864
# # @param exempt [Boolean]

lib/orb/models/customer_create_params.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CustomerCreateParams < Orb::Internal::Type::BaseModel
4242
# when a payment provider is provided on customer creation.
4343
#
4444
# @return [Boolean, nil]
45-
optional :auto_collection, Orb::Internal::Type::BooleanModel, nil?: true
45+
optional :auto_collection, Orb::Internal::Type::Boolean, nil?: true
4646

4747
# @!attribute billing_address
4848
#
@@ -59,7 +59,7 @@ class CustomerCreateParams < Orb::Internal::Type::BaseModel
5959
# @!attribute email_delivery
6060
#
6161
# @return [Boolean, nil]
62-
optional :email_delivery, Orb::Internal::Type::BooleanModel, nil?: true
62+
optional :email_delivery, Orb::Internal::Type::Boolean, nil?: true
6363

6464
# @!attribute external_customer_id
6565
# An optional user-defined ID for this customer resource, used throughout the
@@ -292,7 +292,7 @@ class AccountingSyncConfiguration < Orb::Internal::Type::BaseModel
292292
# @!attribute excluded
293293
#
294294
# @return [Boolean, nil]
295-
optional :excluded, Orb::Internal::Type::BooleanModel, nil?: true
295+
optional :excluded, Orb::Internal::Type::Boolean, nil?: true
296296

297297
# @!parse
298298
# # @param accounting_providers [Array<Orb::Models::CustomerCreateParams::AccountingSyncConfiguration::AccountingProvider>, nil]
@@ -420,7 +420,7 @@ class ReportingConfiguration < Orb::Internal::Type::BaseModel
420420
# @!attribute exempt
421421
#
422422
# @return [Boolean]
423-
required :exempt, Orb::Internal::Type::BooleanModel
423+
required :exempt, Orb::Internal::Type::Boolean
424424

425425
# @!parse
426426
# # @param exempt [Boolean]
@@ -487,7 +487,7 @@ class NewAvalaraTaxConfiguration < Orb::Internal::Type::BaseModel
487487
# @!attribute tax_exempt
488488
#
489489
# @return [Boolean]
490-
required :tax_exempt, Orb::Internal::Type::BooleanModel
490+
required :tax_exempt, Orb::Internal::Type::Boolean
491491

492492
# @!attribute tax_provider
493493
#
@@ -513,7 +513,7 @@ class NewTaxJarConfiguration < Orb::Internal::Type::BaseModel
513513
# @!attribute tax_exempt
514514
#
515515
# @return [Boolean]
516-
required :tax_exempt, Orb::Internal::Type::BooleanModel
516+
required :tax_exempt, Orb::Internal::Type::Boolean
517517

518518
# @!attribute tax_provider
519519
#

lib/orb/models/customer_update_by_external_id_params.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CustomerUpdateByExternalIDParams < Orb::Internal::Type::BaseModel
2828
# when a payment provider is provided on customer creation.
2929
#
3030
# @return [Boolean, nil]
31-
optional :auto_collection, Orb::Internal::Type::BooleanModel, nil?: true
31+
optional :auto_collection, Orb::Internal::Type::Boolean, nil?: true
3232

3333
# @!attribute billing_address
3434
#
@@ -53,7 +53,7 @@ class CustomerUpdateByExternalIDParams < Orb::Internal::Type::BaseModel
5353
# @!attribute email_delivery
5454
#
5555
# @return [Boolean, nil]
56-
optional :email_delivery, Orb::Internal::Type::BooleanModel, nil?: true
56+
optional :email_delivery, Orb::Internal::Type::Boolean, nil?: true
5757

5858
# @!attribute external_customer_id
5959
# The external customer ID. This can only be set if empty and the customer has no
@@ -291,7 +291,7 @@ class AccountingSyncConfiguration < Orb::Internal::Type::BaseModel
291291
# @!attribute excluded
292292
#
293293
# @return [Boolean, nil]
294-
optional :excluded, Orb::Internal::Type::BooleanModel, nil?: true
294+
optional :excluded, Orb::Internal::Type::Boolean, nil?: true
295295

296296
# @!parse
297297
# # @param accounting_providers [Array<Orb::Models::CustomerUpdateByExternalIDParams::AccountingSyncConfiguration::AccountingProvider>, nil]
@@ -423,7 +423,7 @@ class ReportingConfiguration < Orb::Internal::Type::BaseModel
423423
# @!attribute exempt
424424
#
425425
# @return [Boolean]
426-
required :exempt, Orb::Internal::Type::BooleanModel
426+
required :exempt, Orb::Internal::Type::Boolean
427427

428428
# @!parse
429429
# # @param exempt [Boolean]
@@ -492,7 +492,7 @@ class NewAvalaraTaxConfiguration < Orb::Internal::Type::BaseModel
492492
# @!attribute tax_exempt
493493
#
494494
# @return [Boolean]
495-
required :tax_exempt, Orb::Internal::Type::BooleanModel
495+
required :tax_exempt, Orb::Internal::Type::Boolean
496496

497497
# @!attribute tax_provider
498498
#
@@ -518,7 +518,7 @@ class NewTaxJarConfiguration < Orb::Internal::Type::BaseModel
518518
# @!attribute tax_exempt
519519
#
520520
# @return [Boolean]
521-
required :tax_exempt, Orb::Internal::Type::BooleanModel
521+
required :tax_exempt, Orb::Internal::Type::Boolean
522522

523523
# @!attribute tax_provider
524524
#

lib/orb/models/customer_update_params.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CustomerUpdateParams < Orb::Internal::Type::BaseModel
2828
# when a payment provider is provided on customer creation.
2929
#
3030
# @return [Boolean, nil]
31-
optional :auto_collection, Orb::Internal::Type::BooleanModel, nil?: true
31+
optional :auto_collection, Orb::Internal::Type::Boolean, nil?: true
3232

3333
# @!attribute billing_address
3434
#
@@ -51,7 +51,7 @@ class CustomerUpdateParams < Orb::Internal::Type::BaseModel
5151
# @!attribute email_delivery
5252
#
5353
# @return [Boolean, nil]
54-
optional :email_delivery, Orb::Internal::Type::BooleanModel, nil?: true
54+
optional :email_delivery, Orb::Internal::Type::Boolean, nil?: true
5555

5656
# @!attribute external_customer_id
5757
# The external customer ID. This can only be set if empty and the customer has no
@@ -283,7 +283,7 @@ class AccountingSyncConfiguration < Orb::Internal::Type::BaseModel
283283
# @!attribute excluded
284284
#
285285
# @return [Boolean, nil]
286-
optional :excluded, Orb::Internal::Type::BooleanModel, nil?: true
286+
optional :excluded, Orb::Internal::Type::Boolean, nil?: true
287287

288288
# @!parse
289289
# # @param accounting_providers [Array<Orb::Models::CustomerUpdateParams::AccountingSyncConfiguration::AccountingProvider>, nil]
@@ -415,7 +415,7 @@ class ReportingConfiguration < Orb::Internal::Type::BaseModel
415415
# @!attribute exempt
416416
#
417417
# @return [Boolean]
418-
required :exempt, Orb::Internal::Type::BooleanModel
418+
required :exempt, Orb::Internal::Type::Boolean
419419

420420
# @!parse
421421
# # @param exempt [Boolean]
@@ -482,7 +482,7 @@ class NewAvalaraTaxConfiguration < Orb::Internal::Type::BaseModel
482482
# @!attribute tax_exempt
483483
#
484484
# @return [Boolean]
485-
required :tax_exempt, Orb::Internal::Type::BooleanModel
485+
required :tax_exempt, Orb::Internal::Type::Boolean
486486

487487
# @!attribute tax_provider
488488
#
@@ -508,7 +508,7 @@ class NewTaxJarConfiguration < Orb::Internal::Type::BaseModel
508508
# @!attribute tax_exempt
509509
#
510510
# @return [Boolean]
511-
required :tax_exempt, Orb::Internal::Type::BooleanModel
511+
required :tax_exempt, Orb::Internal::Type::Boolean
512512

513513
# @!attribute tax_provider
514514
#

0 commit comments

Comments
 (0)