This is the Adyen Ruby API Library, providing Ruby developers with an easy way to interact with the Adyen API. The library is a wrapper around the Adyen API, with services generated from OpenAPI specifications.
A significant portion of this library, particularly the API services, is automatically generated.
- Engine: We use OpenAPI Generator with custom Mustache templates to convert Adyen's OpenAPI specifications into Ruby code.
- Templates: The custom templates are located in the
/templatesdirectory. These templates are tailored to fit our custom HTTP client and service structure. - Automation:
- Centralized: The primary generation process is managed in a separate repository,
adyen-sdk-automation. Changes to the OpenAPI specs trigger a GitHub workflow in that repository, which generates the code and opens Pull Requests in this library. - Local: For development and testing, you must use the
adyen-sdk-automationrepository.
- Centralized: The primary generation process is managed in a separate repository,
To test new features or changes to the templates, you must run the generation process from a local clone of the adyen-sdk-automation repository.
-
Clone the automation repository:
git clone https://github.com/Adyen/adyen-sdk-automation.git
-
Link this library: The automation project needs to target your local clone of
adyen-ruby-api-library. From inside theadyen-sdk-automationdirectory, run the following commands. This will replace theruby/repodirectory with a symlink to your local project.rm -rf ruby/repo ln -s /path/to/your/adyen-ruby-api-library ruby/repo
-
Run the generator: You can now run the Gradle commands to generate code.
- To generate all services for the Ruby library:
./gradlew :ruby:services
- To generate a single service (e.g., Checkout):
./gradlew :ruby:checkout
- To clean the repository before generating:
./gradlew :ruby:cleanRepo :ruby:checkout
- To generate all services for the Ruby library:
Adyen::Client: The main class inlib/adyen/client.rbthat provides easy access to all API services and handles configuration (API key, environment, etc.).Adyen::Service: The base class located inlib/adyen/services/service.rbfrom which all generated services inherit. It contains the logic for making API calls.lib/adyen/services/: This directory contains the generated service classes (e.g.,Checkout,Management) that expose methods for specific API endpoints. This library does not use generated models for requests and responses; standard Ruby Hashes are used instead.
To install the library and its development dependencies, run:
bundle config set with development
bundle installTo run the RSpec test suite, use the following command:
bundle exec rspecThis is the command used in our GitHub Actions workflow to ensure code quality and correctness.
The release process is automated via GitHub Actions and involves two main workflows:
- Release PR Creation: After a pull request is merged to
main, therelease.ymlworkflow automatically creates a new pull request that bumps the version number inlib/adyen/version.rb. - Publishing to RubyGems: Once the version bump PR is merged, a maintainer can create a GitHub Release. This can be done by manually running the
Releaseworkflow with thegithub-releaseoption. The creation of a published release on GitHub triggers therubygems_release.ymlworkflow, which publishes the new version of the gem to RubyGems.