Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,58 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
build:
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/cloudpayments-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/cloudpayments-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: |-
bundle install

- name: Get GitHub OIDC Token
if: |-
github.repository == 'stainless-sdks/cloudpayments-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload gem artifacts
if: |-
github.repository == 'stainless-sdks/cloudpayments-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PACKAGE_NAME: cloudpayments_ruby
run: ./scripts/utils/upload-artifact.sh
lint:
timeout-minutes: 10
name: lint
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.idea/
.ignore
.prism.log
.stdy.log
.ruby-lsp/
.yardoc/
bin/tapioca
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.4.1"
".": "0.4.2"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hexlet%2Fcloudpayments-737bf804f9ef1282c03bc532fc392f69a6e00eb5d229fa39368ea8ca2ff02de1.yml
openapi_spec_hash: 68aafd72cb1fa7266ab697cc29f73583
config_hash: 33c8a1290e177bcab7a82d1fe4e9ecfd
config_hash: 7e3e36dabba4af552324a8ffefba23f5
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 0.4.2 (2026-04-01)

Full Changelog: [v0.4.1...v0.4.2](https://github.com/Hexlet/cloudpayments-ruby/compare/v0.4.1...v0.4.2)

### Bug Fixes

* align path encoding with RFC 3986 section 3.3 ([090212b](https://github.com/Hexlet/cloudpayments-ruby/commit/090212b29a6295c575a845adc45b0a5ed8262c81))
* **internal:** correct multipart form field name encoding ([b4394ee](https://github.com/Hexlet/cloudpayments-ruby/commit/b4394ee4c68e84bd71af191b6deda6a7bb3c3080))
* properly mock time in ruby ci tests ([7cfd820](https://github.com/Hexlet/cloudpayments-ruby/commit/7cfd8204e2a9d7045d9a05045be6b525768455e0))
* variable name typo ([74c7bb5](https://github.com/Hexlet/cloudpayments-ruby/commit/74c7bb5ecea0ba1797f0ac837953e94906d7391e))


### Chores

* **ci:** add build step ([9287b3c](https://github.com/Hexlet/cloudpayments-ruby/commit/9287b3cf46dba9228ab6aa4472d7f0cc8a2e437d))
* **ci:** skip lint on metadata-only changes ([c9de760](https://github.com/Hexlet/cloudpayments-ruby/commit/c9de760a0803d8a04e298009b54508d0f65e44ed))
* **ci:** skip uploading artifacts on stainless-internal branches ([928a685](https://github.com/Hexlet/cloudpayments-ruby/commit/928a68530d231ae1588a6890280166caf2309831))
* **ci:** support opting out of skipping builds on metadata-only commits ([0aa99a1](https://github.com/Hexlet/cloudpayments-ruby/commit/0aa99a16822e786207fe0dbf85fc20af0aa4b7b4))
* **internal:** codegen related update ([2fc9917](https://github.com/Hexlet/cloudpayments-ruby/commit/2fc991731a559b659f2dbe3ae53c130fda957533))
* **internal:** remove mock server code ([e100d4f](https://github.com/Hexlet/cloudpayments-ruby/commit/e100d4f1eb3433101355817d309ae3008b0faa06))
* **internal:** tweak CI branches ([85b9aeb](https://github.com/Hexlet/cloudpayments-ruby/commit/85b9aeb70a105aafdfbe6665fc2f5576ca6a0d98))
* **internal:** update gitignore ([1fb92c3](https://github.com/Hexlet/cloudpayments-ruby/commit/1fb92c3f2453e220bd6c3ea478ad22db68c443b5))
* update mock server docs ([36a2a37](https://github.com/Hexlet/cloudpayments-ruby/commit/36a2a3788aa8b4638c9d41e2fe54a6cd4a939990))

## 0.4.1 (2026-02-13)

Full Changelog: [v0.4.0...v0.4.1](https://github.com/Hexlet/cloudpayments-ruby/compare/v0.4.0...v0.4.1)
Expand Down
6 changes: 0 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ $ bundle exec rake

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
$ npx prism mock path/to/your/openapi.yml
```

```bash
$ bundle exec rake test
```
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:
cloudpayments-ruby (0.4.1)
cloudpayments-ruby (0.4.2)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion 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 "cloudpayments-ruby", "~> 0.4.1"
gem "cloudpayments-ruby", "~> 0.4.2"
```

<!-- x-release-please-end -->
Expand Down
56 changes: 50 additions & 6 deletions lib/cloudpayments_ruby/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def coerce_hash!(input)
in Hash | nil => coerced
coerced
else
message = "Expected a #{Hash} or #{CloudpaymentsRuby::Internal::Type::BaseModel}, got #{data.inspect}"
message = "Expected a #{Hash} or #{CloudpaymentsRuby::Internal::Type::BaseModel}, got #{input.inspect}"
raise ArgumentError.new(message)
end
end
Expand Down Expand Up @@ -237,6 +237,11 @@ def dig(data, pick, &blk)
end
end

# @type [Regexp]
#
# https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/

class << self
# @api private
#
Expand All @@ -247,6 +252,15 @@ def uri_origin(uri)
"#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
end

# @api private
#
# @param path [String, Integer]
#
# @return [String]
def encode_path(path)
path.to_s.gsub(CloudpaymentsRuby::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
end

# @api private
#
# @param path [String, Array<String>]
Expand All @@ -259,7 +273,7 @@ def interpolate_path(path)
in []
""
in [String => p, *interpolations]
encoded = interpolations.map { ERB::Util.url_encode(_1) }
encoded = interpolations.map { encode_path(_1) }
format(p, *encoded)
end
end
Expand Down Expand Up @@ -490,6 +504,37 @@ def writable_enum(&blk)
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}

class << self
# @api private
#
# @param query [Hash{Symbol=>Object}]
#
# @return [Hash{Symbol=>Object}]
def encode_query_params(query)
out = {}
query.each { write_query_param_element!(out, _1, _2) }
out
end

# @api private
#
# @param collection [Hash{Symbol=>Object}]
# @param key [String]
# @param element [Object]
#
# @return [nil]
private def write_query_param_element!(collection, key, element)
case element
in Hash
element.each do |name, value|
write_query_param_element!(collection, "#{key}[#{name}]", value)
end
in Array
collection[key] = element.map(&:to_s).join(",")
else
collection[key] = element.to_s
end
end

# @api private
#
# @param y [Enumerator::Yielder]
Expand Down Expand Up @@ -540,16 +585,15 @@ class << self
y << "Content-Disposition: form-data"

unless key.nil?
name = ERB::Util.url_encode(key.to_s)
y << "; name=\"#{name}\""
y << "; name=\"#{key}\""
end

case val
in CloudpaymentsRuby::FilePart unless val.filename.nil?
filename = ERB::Util.url_encode(val.filename)
filename = encode_path(val.filename)
y << "; filename=\"#{filename}\""
in Pathname | IO
filename = ERB::Util.url_encode(::File.basename(val.to_path))
filename = encode_path(::File.basename(val.to_path))
y << "; filename=\"#{filename}\""
else
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cloudpayments_ruby/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module CloudpaymentsRuby
VERSION = "0.4.1"
VERSION = "0.4.2"
end
28 changes: 28 additions & 0 deletions rbi/cloudpayments_ruby/internal/util.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,20 @@ module CloudpaymentsRuby
end
end

# https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)

class << self
# @api private
sig { params(uri: URI::Generic).returns(String) }
def uri_origin(uri)
end

# @api private
sig { params(path: T.any(String, Integer)).returns(String) }
def encode_path(path)
end

# @api private
sig { params(path: T.any(String, T::Array[String])).returns(String) }
def interpolate_path(path)
Expand Down Expand Up @@ -301,6 +309,26 @@ module CloudpaymentsRuby
T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)

class << self
# @api private
sig do
params(query: CloudpaymentsRuby::Internal::AnyHash).returns(
CloudpaymentsRuby::Internal::AnyHash
)
end
def encode_query_params(query)
end

# @api private
sig do
params(
collection: CloudpaymentsRuby::Internal::AnyHash,
key: String,
element: T.anything
).void
end
private def write_query_param_element!(collection, key, element)
end

# @api private
sig do
params(
Expand Down
41 changes: 0 additions & 41 deletions scripts/mock

This file was deleted.

Loading