Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
bin/tapioca
Brewfile.lock.json
doc/
Gemfile.lock
sorbet/tapioca/*
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.3.1"
".": "0.3.2"
}
10 changes: 10 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Layout/MultilineMethodParameterLineBreaks:
# Prefer compact hash literals.
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Exclude:
- "**/*.rbi"

Lint/BooleanSymbol:
Enabled: false
Expand Down Expand Up @@ -90,6 +92,10 @@ Lint/MissingSuper:
Exclude:
- "**/*.rbi"

Lint/SymbolConversion:
Exclude:
- "**/*.rbi"

# Disabled for safety reasons, this option changes code semantics.
Lint/UnusedMethodArgument:
AutoCorrect: false
Expand Down Expand Up @@ -244,6 +250,10 @@ Style/RedundantInitialize:
Exclude:
- "**/*.rbi"

Style/RedundantParentheses:
Exclude:
- "**/*.rbi"

# Prefer slashes for regex literals.
Style/RegexpLiteral:
EnforcedStyle: slashes
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.3.2 (2025-05-07)

Full Changelog: [v0.3.1...v0.3.2](https://github.com/orbcorp/orb-ruby/compare/v0.3.1...v0.3.2)

### Bug Fixes

* **internal:** ensure formatting always uses c.utf-8 locale ([c4cc44a](https://github.com/orbcorp/orb-ruby/commit/c4cc44a8e280089938586de353b08e8091056ca0))


### Chores

* **internal:** version bump ([fede0e6](https://github.com/orbcorp/orb-ruby/commit/fede0e64ca4753cc961e8308ddcef2b39dcb6f24))
* revert ignoring Gemfile.lock ([e572719](https://github.com/orbcorp/orb-ruby/commit/e572719854490cfa7735dcc70d9cfd1dc4d4a122))

## 0.3.1 (2025-05-06)

Full Changelog: [v0.3.0...v0.3.1](https://github.com/orbcorp/orb-ruby/compare/v0.3.0...v0.3.1)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
orb-billing (0.3.0)
orb-billing (0.3.1)
connection_pool

GEM
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "orb-billing", "~> 0.3.1"
gem "orb-billing", "~> 0.3.2"
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -200,9 +200,9 @@ Sorbet's typed enums require sub-classing of the [`T::Enum` class](https://sorbe
Since this library does not depend on `sorbet-runtime`, it uses a [`T.all` intersection type](https://sorbet.org/docs/intersection-types) with a ruby primitive type to construct a "tagged alias" instead.

```ruby
module Orb::Models::BillingCycleRelativeDate
module Orb::BillingCycleRelativeDate
# This alias aids language service driven navigation.
TaggedSymbol = T.type_alias { T.all(Symbol, Orb::Models::BillingCycleRelativeDate) }
TaggedSymbol = T.type_alias { T.all(Symbol, Orb::BillingCycleRelativeDate) }
end
```

Expand Down
29 changes: 20 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require "rubocop/rake_task"
tapioca = "sorbet/tapioca"
ignore_file = ".ignore"

CLEAN.push(*%w[.idea/ .ruby-lsp/ .yardoc/ doc/ Gemfile.lock], *FileList["*.gem"], ignore_file)
CLEAN.push(*%w[.idea/ .ruby-lsp/ .yardoc/ doc/], *FileList["*.gem"], ignore_file)

CLOBBER.push(*%w[sorbet/rbi/annotations/ sorbet/rbi/gems/], tapioca)

Expand All @@ -34,29 +34,40 @@ multitask(:test) do
ruby(*%w[-w -e], rb, verbose: false) { fail unless _1 }
end

rubo_find = %w[find ./lib ./test ./rbi -type f -and ( -name *.rb -or -name *.rbi ) -print0]
xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
locale = {"LC_ALL" => "C.UTF-8"}

desc("Lint `*.rb(i)`")
multitask(:"lint:rubocop") do
find = %w[find ./lib ./test ./rbi -type f -and ( -name *.rb -or -name *.rbi ) -print0]

rubocop = %w[rubocop --fail-level E]
rubocop += %w[--format github] if ENV.key?("CI")

# some lines cannot be shortened
rubocop += %w[--except Lint/RedundantCopDisableDirective,Layout/LineLength]

lint = xargs + rubocop
sh("#{rubo_find.shelljoin} | #{lint.shelljoin}")
sh("#{find.shelljoin} | #{lint.shelljoin}")
end

desc("Format `*.rb(i)`")
multitask(:"format:rubocop") do
desc("Format `*.rb`")
multitask(:"format:rb") do
# while `syntax_tree` is much faster than `rubocop`, `rubocop` is the only formatter with full syntax support
find = %w[find ./lib ./test -type f -and -name *.rb -print0]
fmt = xargs + %w[rubocop --fail-level F --autocorrect --format simple --]
sh("#{rubo_find.shelljoin} | #{fmt.shelljoin}")
sh("#{find.shelljoin} | #{fmt.shelljoin}")
end

desc("Format `*.rbi`")
multitask(:"format:rbi") do
find = %w[find ./rbi -type f -and -name *.rbi -print0]
fmt = xargs + %w[stree write --]
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}")
end

desc("Format `*.rbs`")
multitask(:"format:syntax_tree") do
multitask(:"format:rbs") do
find = %w[find ./sig -type f -name *.rbs -print0]
inplace = /darwin|bsd/ =~ RUBY_PLATFORM ? ["-i", ""] : %w[-i]
uuid = SecureRandom.uuid
Expand Down Expand Up @@ -88,7 +99,7 @@ multitask(:"format:syntax_tree") do
# transform class aliases to type aliases, which syntax tree has no trouble with
sh("#{find.shelljoin} | #{pre.shelljoin}")
# run syntax tree to format `*.rbs` files
sh("#{find.shelljoin} | #{fmt.shelljoin}") do
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}") do
success = _1
end
# transform type aliases back to class aliases
Expand All @@ -99,7 +110,7 @@ multitask(:"format:syntax_tree") do
end

desc("Format everything")
multitask(format: [:"format:rubocop", :"format:syntax_tree"])
multitask(format: [:"format:rb", :"format:rbi", :"format:rbs"])

desc("Typecheck `*.rbs`")
multitask(:"typecheck:steep") do
Expand Down
1 change: 1 addition & 0 deletions lib/orb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
require_relative "orb/models/top_level_ping_response"
require_relative "orb/models/trial_discount"
require_relative "orb/models/usage_discount"
require_relative "orb/models"
require_relative "orb/resources/alerts"
require_relative "orb/resources/coupons"
require_relative "orb/resources/coupons/subscriptions"
Expand Down
4 changes: 2 additions & 2 deletions lib/orb/file_part.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def initialize(content, filename: nil, content_type: nil)
@filename =
case content
in Pathname
filename.nil? ? content.basename.to_path : File.basename(filename)
filename.nil? ? content.basename.to_path : ::File.basename(filename)
else
filename.nil? ? nil : File.basename(filename)
filename.nil? ? nil : ::File.basename(filename)
end
@content_type = content_type
end
Expand Down
6 changes: 3 additions & 3 deletions lib/orb/internal/type/enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ module Type
# values safely.
#
# @example
# # `billing_cycle_relative_date` is a `Orb::Models::BillingCycleRelativeDate`
# # `billing_cycle_relative_date` is a `Orb::BillingCycleRelativeDate`
# case billing_cycle_relative_date
# when Orb::Models::BillingCycleRelativeDate::START_OF_TERM
# when Orb::BillingCycleRelativeDate::START_OF_TERM
# # ...
# when Orb::Models::BillingCycleRelativeDate::END_OF_TERM
# when Orb::BillingCycleRelativeDate::END_OF_TERM
# # ...
# else
# puts(billing_cycle_relative_date)
Expand Down
8 changes: 4 additions & 4 deletions lib/orb/internal/type/request_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module Internal
module Type
# @api private
module RequestParameters
# @!parse
# # Options to specify HTTP behaviour for this request.
# # @return [Orb::RequestOptions, Hash{Symbol=>Object}]
# attr_accessor :request_options
# @!attribute request_options
# Options to specify HTTP behaviour for this request.
#
# @return [Orb::RequestOptions, Hash{Symbol=>Object}]

# @param mod [Module]
def self.included(mod)
Expand Down
8 changes: 4 additions & 4 deletions lib/orb/internal/type/union.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ module Type
# @api private
#
# @example
# # `discount` is a `Orb::Models::Discount`
# # `discount` is a `Orb::Discount`
# case discount
# when Orb::Models::PercentageDiscount
# when Orb::PercentageDiscount
# puts(discount.applies_to_price_ids)
# when Orb::Models::TrialDiscount
# when Orb::TrialDiscount
# puts(discount.discount_type)
# when Orb::Models::UsageDiscount
# when Orb::UsageDiscount
# puts(discount.usage_discount)
# else
# puts(discount)
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ class << self
filename = ERB::Util.url_encode(val.filename)
y << "; filename=\"#{filename}\""
in Pathname | IO
filename = ERB::Util.url_encode(File.basename(val.to_path))
filename = ERB::Util.url_encode(::File.basename(val.to_path))
y << "; filename=\"#{filename}\""
else
end
Expand Down
Loading