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
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,40 @@ on:
- 'stl-preview-base/**'

jobs:
build:
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/yoomoney-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/yoomoney-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork)
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/yoomoney-ruby'
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/yoomoney-ruby'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PACKAGE_NAME: yoomoney
run: ./scripts/utils/upload-artifact.sh
lint:
timeout-minutes: 10
name: lint
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.0"
".": "0.4.1"
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 0.4.1 (2026-03-03)

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

### Bug Fixes

* properly mock time in ruby ci tests ([0b0f2b9](https://github.com/Hexlet/yoomoney-ruby/commit/0b0f2b9b46b018511f77974f9c07bf16c41b9de8))


### Chores

* **ci:** add build step ([97e903b](https://github.com/Hexlet/yoomoney-ruby/commit/97e903b2e36f772efddd46fe27068e52c83bbd9c))
* **internal:** codegen related update ([a3a34e9](https://github.com/Hexlet/yoomoney-ruby/commit/a3a34e92ccdbaf9b73180348eb9e6d748027aaf5))
* **internal:** remove mock server code ([ff71548](https://github.com/Hexlet/yoomoney-ruby/commit/ff7154864d2ab53d55c4eeacb28120965dca14a1))
* update mock server docs ([98bf708](https://github.com/Hexlet/yoomoney-ruby/commit/98bf7084f1c04c1d0c816d96584a4074e9187024))

## 0.4.0 (2026-02-19)

Full Changelog: [v0.3.0...v0.4.0](https://github.com/Hexlet/yoomoney-ruby/compare/v0.3.0...v0.4.0)
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:
yoomoney (0.4.0)
yoomoney (0.4.1)
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 "yoomoney", "~> 0.4.0"
gem "yoomoney", "~> 0.4.1"
```

<!-- x-release-please-end -->
Expand Down
31 changes: 31 additions & 0 deletions lib/yoomoney/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,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
3 changes: 2 additions & 1 deletion lib/yoomoney/resources/deals.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ def retrieve(deal_id, params = {})
# @see Yoomoney::Models::DealListParams
def list(params = {})
parsed, options = Yoomoney::DealListParams.dump_request(params)
query = Yoomoney::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "deals",
query: parsed,
query: query,
model: Yoomoney::Models::DealListResponse,
options: options
)
Expand Down
3 changes: 2 additions & 1 deletion lib/yoomoney/resources/me.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ class Me
# @see Yoomoney::Models::MeRetrieveParams
def retrieve(params = {})
parsed, options = Yoomoney::MeRetrieveParams.dump_request(params)
query = Yoomoney::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "me",
query: parsed,
query: query,
model: Yoomoney::Models::MeRetrieveResponse,
options: options
)
Expand Down
3 changes: 2 additions & 1 deletion lib/yoomoney/resources/payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ def retrieve(payment_id, params = {})
# @see Yoomoney::Models::PaymentListParams
def list(params = {})
parsed, options = Yoomoney::PaymentListParams.dump_request(params)
query = Yoomoney::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "payments",
query: parsed,
query: query,
model: Yoomoney::Models::PaymentListResponse,
options: options
)
Expand Down
6 changes: 4 additions & 2 deletions lib/yoomoney/resources/payouts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ def retrieve(payout_id, params = {})
# @see Yoomoney::Models::PayoutListParams
def list(params = {})
parsed, options = Yoomoney::PayoutListParams.dump_request(params)
query = Yoomoney::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "payouts",
query: parsed,
query: query,
model: Yoomoney::PayoutsList,
options: options
)
Expand All @@ -104,10 +105,11 @@ def list(params = {})
# @see Yoomoney::Models::PayoutSearchParams
def search(params = {})
parsed, options = Yoomoney::PayoutSearchParams.dump_request(params)
query = Yoomoney::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "payouts/search",
query: parsed,
query: query,
model: Yoomoney::PayoutsList,
options: options
)
Expand Down
3 changes: 2 additions & 1 deletion lib/yoomoney/resources/receipts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ def retrieve(receipt_id, params = {})
# @see Yoomoney::Models::ReceiptListParams
def list(params = {})
parsed, options = Yoomoney::ReceiptListParams.dump_request(params)
query = Yoomoney::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "receipts",
query: parsed,
query: query,
model: Yoomoney::Models::ReceiptListResponse,
options: options
)
Expand Down
3 changes: 2 additions & 1 deletion lib/yoomoney/resources/refunds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ def retrieve(refund_id, params = {})
# @see Yoomoney::Models::RefundListParams
def list(params = {})
parsed, options = Yoomoney::RefundListParams.dump_request(params)
query = Yoomoney::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "refunds",
query: parsed,
query: query,
model: Yoomoney::Models::RefundListResponse,
options: options
)
Expand Down
2 changes: 1 addition & 1 deletion lib/yoomoney/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Yoomoney
VERSION = "0.4.0"
VERSION = "0.4.1"
end
20 changes: 20 additions & 0 deletions rbi/yoomoney/internal/util.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,26 @@ module Yoomoney
T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)

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

# @api private
sig do
params(
collection: Yoomoney::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.

46 changes: 0 additions & 46 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,7 @@ set -e

cd -- "$(dirname -- "$0")/.."

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function prism_is_running() {
curl --silent "http://localhost:4010" >/dev/null 2>&1
}

kill_server_on_port() {
pids=$(lsof -t -i tcp:"$1" || echo "")
if [ "$pids" != "" ]; then
kill "$pids"
echo "Stopped $pids."
fi
}

function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

if ! is_overriding_api_base_url && ! prism_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT

# Start the dev server
./scripts/mock --daemon
fi

if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
elif ! prism_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
echo -e "running against your OpenAPI spec."
echo
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo

exit 1
else
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
echo
fi

echo "==> Running tests"
bundle exec rake test "$@"
Loading