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
  •  
  •  
  •  
19 changes: 11 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- next
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/increase-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
Expand All @@ -25,8 +27,9 @@ jobs:
- name: Run lints
run: ./scripts/lint
test:
timeout-minutes: 10
name: test
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/increase-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
Expand Down
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.1.0-alpha.11"
".": "0.1.0-alpha.12"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 199
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-77c909117116f16f4bd7d5596257445e57c54d288d6534fe5b11ee37126c4c34.yml
openapi_spec_hash: 29e929217173626e3edec897a5b6c5e7
config_hash: 20a463ecd33bd32b7b9bc6f4990907ac
configured_endpoints: 194
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-27dc46bb403d49303c0a407c619e63dfcb1be14d16536390f0b4a8dd3b3d8e38.yml
openapi_spec_hash: 679632c6d91d4a35625ce94adc2c6ea0
config_hash: 6ae27f935d24d38237894dd4fd6bd749
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## 0.1.0-alpha.12 (2025-04-25)

Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/Increase/increase-ruby/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)

### Features

* **api:** api update ([666183d](https://github.com/Increase/increase-ruby/commit/666183d2e524186260dcca5505a794c545840183))
* **api:** api update ([f7348dc](https://github.com/Increase/increase-ruby/commit/f7348dc4328a7e2111a67be09dc77843c83b2e49))
* **api:** api update ([7d7ab72](https://github.com/Increase/increase-ruby/commit/7d7ab72a46faa7274855639846a130f2a9e0ad41))
* support specifying content-type with FilePart class ([05afd72](https://github.com/Increase/increase-ruby/commit/05afd7274f7881cdef4bc4292d9c7eb8104f0c27))
* support webmock for testing ([995c8ba](https://github.com/Increase/increase-ruby/commit/995c8baa67995d921ea02054f120e9bdaebe01ad))


### Bug Fixes

* ensure gem release is unaffected by renaming ([c0a0fb7](https://github.com/Increase/increase-ruby/commit/c0a0fb79e9b89a36d3dfbcb0dac08919e4eea8c4))
* make a typo for `FilePart.content` ([a080024](https://github.com/Increase/increase-ruby/commit/a080024a471808e2fb1cf1eade231d93c652e411))


### Chores

* broadly detect json family of content-type headers ([6ce04be](https://github.com/Increase/increase-ruby/commit/6ce04be506ecb273342936ed47e4996cd2173fef))
* **ci:** only use depot for staging repos ([0ab95d5](https://github.com/Increase/increase-ruby/commit/0ab95d54a80ef309144a61b51543bfb298f44f22))
* **ci:** run on more branches and use depot runners ([81e1f3a](https://github.com/Increase/increase-ruby/commit/81e1f3ac48fe1e256ae0f203b902a1b3e87901f9))
* consistently use string in examples, even for enums ([e87d2db](https://github.com/Increase/increase-ruby/commit/e87d2db29255f5f9372f82a2e9ecd5da02cc2ca6))
* **internal:** codegen related update ([79b309d](https://github.com/Increase/increase-ruby/commit/79b309d21bf855bdd27c7822cf6735e83d3cb484))
* **internal:** improve response envelope unwrap functionality ([b3f18d4](https://github.com/Increase/increase-ruby/commit/b3f18d4820ff1d2a1f3b4b551f3abd0530a5b77c))
* show truncated parameter docs in yard ([294b347](https://github.com/Increase/increase-ruby/commit/294b3473dff35162a9f5e64552579261b1babed6))

## 0.1.0-alpha.11 (2025-04-21)

Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/Increase/increase-ruby/compare/v0.1.0-alpha.10...v0.1.0-alpha.11)
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ group :development, :test do
gem "minitest-hooks"
gem "minitest-proveit"
gem "minitest-rg"
gem "webmock"
end

group :development, :docs do
Expand Down
15 changes: 14 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
increase (0.1.0.pre.alpha.11)
increase (0.1.0.pre.alpha.12)
connection_pool

GEM
Expand All @@ -29,6 +29,8 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.3)
async (2.23.1)
console (~> 1.29)
Expand All @@ -45,6 +47,9 @@ GEM
fiber-annotation
fiber-local (~> 1.1)
json
crack (1.0.0)
bigdecimal
rexml
csv (3.3.3)
drb (2.2.1)
erubi (1.13.1)
Expand All @@ -54,6 +59,7 @@ GEM
fiber-storage
fiber-storage (1.0.0)
fileutils (1.7.3)
hashdiff (1.1.2)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-event (1.10.0)
Expand Down Expand Up @@ -82,6 +88,7 @@ GEM
racc
prettier_print (1.2.1)
prism (1.4.0)
public_suffix (6.0.1)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
Expand All @@ -96,6 +103,7 @@ GEM
logger
redcarpet (3.6.1)
regexp_parser (2.10.0)
rexml (3.4.1)
rubocop (1.75.1)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
Expand Down Expand Up @@ -165,6 +173,10 @@ GEM
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
webmock (3.25.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.9.1)
yard (0.9.37)
yard-sorbet (0.9.0)
Expand All @@ -191,6 +203,7 @@ DEPENDENCIES
syntax_tree
syntax_tree-rbs!
tapioca
webmock
webrick
yard

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 "increase", "~> 0.1.0.pre.alpha.11"
gem "increase", "~> 0.1.0.pre.alpha.12"
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -81,11 +81,11 @@ Request parameters that correspond to file uploads can be passed as `StringIO`,
require "pathname"

# using `Pathname`, the file will be lazily read, without reading everything in to memory
file = increase.files.create(file: Pathname("my/file.txt"), purpose: :check_image_front)
file = increase.files.create(file: Pathname("my/file.txt"), purpose: "check_image_front")

file = File.read("my/file.txt")
# using `StringIO`, useful if you already have the data in memory
file = increase.files.create(file: StringIO.new(file), purpose: :check_image_front)
file = increase.files.create(file: StringIO.new(file), purpose: "check_image_front")

puts(file.id)
```
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ multitask(:test) do
.map { "require_relative(#{_1.dump});" }
.join

ruby(*%w[-w -e], rb, verbose: false) { fail unless _1 }
ruby(*%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]
Expand Down Expand Up @@ -135,5 +135,5 @@ end

desc("Release ruby gem")
multitask(release: [:"build:gem"]) do
sh(*%w[gem push], *FileList["increase-*.gem"])
sh(*%w[gem push], *FileList["*.gem"])
end
12 changes: 2 additions & 10 deletions lib/increase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
require_relative "increase/internal/type/converter"
require_relative "increase/internal/type/unknown"
require_relative "increase/internal/type/boolean"
require_relative "increase/internal/type/io_like"
require_relative "increase/internal/type/file_input"
require_relative "increase/internal/type/enum"
require_relative "increase/internal/type/union"
require_relative "increase/internal/type/array_of"
Expand All @@ -41,6 +41,7 @@
require_relative "increase/internal/type/request_parameters"
require_relative "increase/internal"
require_relative "increase/request_options"
require_relative "increase/file_part"
require_relative "increase/errors"
require_relative "increase/internal/transport/base_client"
require_relative "increase/internal/transport/pooled_net_requester"
Expand Down Expand Up @@ -236,13 +237,6 @@
require_relative "increase/models/program"
require_relative "increase/models/program_list_params"
require_relative "increase/models/program_retrieve_params"
require_relative "increase/models/proof_of_authorization_request"
require_relative "increase/models/proof_of_authorization_request_list_params"
require_relative "increase/models/proof_of_authorization_request_retrieve_params"
require_relative "increase/models/proof_of_authorization_request_submission"
require_relative "increase/models/proof_of_authorization_request_submission_create_params"
require_relative "increase/models/proof_of_authorization_request_submission_list_params"
require_relative "increase/models/proof_of_authorization_request_submission_retrieve_params"
require_relative "increase/models/real_time_decision"
require_relative "increase/models/real_time_decision_action_params"
require_relative "increase/models/real_time_decision_retrieve_params"
Expand Down Expand Up @@ -348,8 +342,6 @@
require_relative "increase/resources/physical_card_profiles"
require_relative "increase/resources/physical_cards"
require_relative "increase/resources/programs"
require_relative "increase/resources/proof_of_authorization_requests"
require_relative "increase/resources/proof_of_authorization_request_submissions"
require_relative "increase/resources/real_time_decisions"
require_relative "increase/resources/real_time_payments_transfers"
require_relative "increase/resources/routing_numbers"
Expand Down
9 changes: 0 additions & 9 deletions lib/increase/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ class Client < Increase::Internal::Transport::BaseClient
# @return [Increase::Resources::Programs]
attr_reader :programs

# @return [Increase::Resources::ProofOfAuthorizationRequests]
attr_reader :proof_of_authorization_requests

# @return [Increase::Resources::ProofOfAuthorizationRequestSubmissions]
attr_reader :proof_of_authorization_request_submissions

# @return [Increase::Resources::AccountStatements]
attr_reader :account_statements

Expand Down Expand Up @@ -281,9 +275,6 @@ def initialize(
@entities = Increase::Resources::Entities.new(client: self)
@supplemental_documents = Increase::Resources::SupplementalDocuments.new(client: self)
@programs = Increase::Resources::Programs.new(client: self)
@proof_of_authorization_requests = Increase::Resources::ProofOfAuthorizationRequests.new(client: self)
@proof_of_authorization_request_submissions =
Increase::Resources::ProofOfAuthorizationRequestSubmissions.new(client: self)
@account_statements = Increase::Resources::AccountStatements.new(client: self)
@files = Increase::Resources::Files.new(client: self)
@file_links = Increase::Resources::FileLinks.new(client: self)
Expand Down
55 changes: 55 additions & 0 deletions lib/increase/file_part.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# frozen_string_literal: true

module Increase
class FilePart
# @return [Pathname, StringIO, IO, String]
attr_reader :content

# @return [String, nil]
attr_reader :content_type

# @return [String, nil]
attr_reader :filename

# @api private
#
# @return [String]
private def read
case content
in Pathname
content.read(binmode: true)
in StringIO
content.string
in IO
content.read
in String
content
end
end

# @param a [Object]
#
# @return [String]
def to_json(*a) = read.to_json(*a)

# @param a [Object]
#
# @return [String]
def to_yaml(*a) = read.to_yaml(*a)

# @param content [Pathname, StringIO, IO, String]
# @param filename [String, nil]
# @param content_type [String, nil]
def initialize(content, filename: nil, content_type: nil)
@content = content
@filename =
case content
in Pathname
filename.nil? ? content.basename.to_path : File.basename(filename)
else
filename.nil? ? nil : File.basename(filename)
end
@content_type = content_type
end
end
end
6 changes: 3 additions & 3 deletions lib/increase/internal/transport/base_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def reap_connection!(status, stream:)

# @api private
# @return [Increase::Internal::Transport::PooledNetRequester]
attr_accessor :requester
attr_reader :requester

# @api private
#
Expand Down Expand Up @@ -214,7 +214,7 @@ def initialize(
#
# @option req [Object, nil] :body
#
# @option req [Symbol, nil] :unwrap
# @option req [Symbol, Integer, Array<Symbol, Integer>, Proc, nil] :unwrap
#
# @option req [Class<Increase::Internal::Type::BasePage>, nil] :page
#
Expand Down Expand Up @@ -415,7 +415,7 @@ def initialize(
#
# @param body [Object, nil]
#
# @param unwrap [Symbol, nil]
# @param unwrap [Symbol, Integer, Array<Symbol, Integer>, Proc, nil]
#
# @param page [Class<Increase::Internal::Type::BasePage>, nil]
#
Expand Down
2 changes: 1 addition & 1 deletion lib/increase/internal/transport/pooled_net_requester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def execute(request)
conn.finish if !eof && conn&.started?
closing&.call
end
[Integer(response.code), response, (response.body = body)]
[Integer(response.code), response, body]
end

# @api private
Expand Down
5 changes: 4 additions & 1 deletion lib/increase/internal/type/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def dump(value, state:)
value.string
in Pathname | IO
state[:can_retry] = false if value.is_a?(IO)
Increase::Internal::Util::SerializationAdapter.new(value)
Increase::FilePart.new(value)
in Increase::FilePart
state[:can_retry] = false if value.content.is_a?(IO)
value
else
value
end
Expand Down
Loading
Loading