Skip to content

Commit a522e90

Browse files
Merge pull request #1 from PaystackOSS/autogen/ruby-sdk/65c0930
chore(ruby-sdk): sync generated dist from 65c0930
2 parents b863741 + 5fe6c6e commit a522e90

98 files changed

Lines changed: 7107 additions & 79 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ CLAUDE.md
1212
acr.yaml
1313
acr.lock
1414
.github/copilot-instructions.md
15+
Gemfile.lock

Gemfile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
source "https://rubygems.org"
44

5-
# Specify your gem's dependencies in paystack-ruby.gemspec
65
gemspec
76

8-
gem "irb"
9-
gem "rake", "~> 13.0"
10-
11-
gem "minitest", "~> 5.16"
12-
13-
gem "standard", "~> 1.3"
7+
group :development do
8+
gem "rake", "~> 13.0"
9+
gem "minitest", "~> 5.16"
10+
end

README.md

Lines changed: 128 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,153 @@
1-
# Paystack::Ruby
1+
# Paystack Ruby SDK
22

3-
TODO: Delete this and the text below, and describe your gem
3+
> The official Ruby SDK for the Paystack API — generated from the Paystack OpenAPI specification.
44
5-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/paystack/ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
[![Ruby ≥ 3.1](https://img.shields.io/badge/ruby-%3E%3D3.1-red)](https://www.ruby-lang.org)
7+
8+
---
9+
10+
## Requirements
11+
12+
- **Ruby 3.1 or later**
13+
- Standard library HTTP stack (`net/http`) — no extra runtime HTTP dependency
14+
15+
---
616

717
## Installation
818

9-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
19+
Add this line to your application's Gemfile:
1020

11-
Install the gem and add to the application's Gemfile by executing:
21+
```ruby
22+
gem "paystack-ruby"
23+
```
24+
25+
Then execute:
1226

1327
```bash
14-
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
28+
bundle install
1529
```
1630

17-
If bundler is not being used to manage dependencies, install the gem by executing:
31+
Or install directly:
1832

1933
```bash
20-
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
34+
gem install paystack-ruby
35+
```
36+
37+
---
38+
39+
## Quick Start
40+
41+
```ruby
42+
require "paystack"
43+
44+
paystack = Paystack::Client.new(ENV.fetch("PAYSTACK_SECRET_KEY"))
45+
46+
result = paystack.transaction.initialize(
47+
{
48+
email: "customer@example.com",
49+
amount: 100_000 # kobo
50+
}
51+
)
52+
53+
puts result.data[:authorization_url]
2154
```
2255

23-
## Usage
56+
---
2457

25-
TODO: Write usage instructions here
58+
## Configuration
2659

27-
## Development
60+
Initialize `Paystack::Client` with your secret key:
2861

29-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
62+
```ruby
63+
paystack = Paystack::Client.new("sk_live_xxxxxxxxxxxx")
64+
```
3065

31-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
66+
| Option | Type | Required | Default |
67+
|---|---|---|---|
68+
| `api_key` | `String` |||
69+
70+
---
71+
72+
## Response Shape
73+
74+
All resource methods return a `Paystack::Response` object exposing:
75+
76+
```ruby
77+
response.http_status # Integer
78+
response.status # Boolean
79+
response.message # String
80+
response.data # Hash / Array / nil
81+
response.meta # Hash / nil
82+
```
83+
84+
---
85+
86+
## Error Handling
87+
88+
API failures raise typed exceptions:
89+
90+
```ruby
91+
begin
92+
paystack.transaction.initialize({ email: "customer@example.com", amount: 100_000 })
93+
rescue Paystack::AuthenticationError,
94+
Paystack::ValidationError,
95+
Paystack::NotFoundError,
96+
Paystack::RateLimitError,
97+
Paystack::ServerError => e
98+
puts e.message
99+
puts e.http_status
100+
end
101+
```
102+
103+
---
104+
105+
## API Reference
106+
107+
The SDK exposes one method per API resource on the `Paystack::Client` instance.
108+
109+
| Resource | Property | Description | Methods |
110+
|---|---|---|---|
111+
| [ApplePay](./docs/apple_pay.md) | `paystack.apple_pay` | A collection of endpoints for managing application's top-level domain or subdomain accepting payment via Apple Pay | 3 |
112+
| [Balance](./docs/balance.md) | `paystack.balance` | A collection of endpoints gaining insights into the amount on an integration | 2 |
113+
| [Bank](./docs/bank.md) | `paystack.bank` | A collection of endpoints for managing bank details | 3 |
114+
| [BulkCharge](./docs/bulk_charge.md) | `paystack.bulk_charge` | A collection of endpoints for creating and managing multiple recurring payments | 6 |
115+
| [Charge](./docs/charge.md) | `paystack.charge` | A collection of endpoints for configuring and managing the payment channels when initiating a payment | 7 |
116+
| [Customer](./docs/customer.md) | `paystack.customer` | A collection of endpoints for creating and managing customers on an integration | 12 |
117+
| [DedicatedVirtualAccount](./docs/dedicated_virtual_account.md) | `paystack.dedicated_virtual_account` | A collection of endpoints for creating and managing payment accounts for customers | 9 |
118+
| [DirectDebit](./docs/direct_debit.md) | `paystack.direct_debit` | A collection of endpoints for managing Direct Debit | 2 |
119+
| [Dispute](./docs/dispute.md) | `paystack.dispute` | A collection of endpoints for managing transactions complaint made by customers | 8 |
120+
| [Integration](./docs/integration.md) | `paystack.integration` | A collection of endpoints for managing some settings on an integration | 2 |
121+
| [Miscellaneous](./docs/miscellaneous.md) | `paystack.miscellaneous` | A collection of endpoints that provides utility functions | 3 |
122+
| [Order](./docs/order.md) | `paystack.order` | A collection of endpoints for creating and managing orders | 5 |
123+
| [Page](./docs/page.md) | `paystack.page` | A collection of endpoints for creating and managing links for the collection of payment for products | 6 |
124+
| [PaymentRequest](./docs/payment_request.md) | `paystack.payment_request` | A collection of endpoints for managing invoices for the payment of goods and services | 9 |
125+
| [Plan](./docs/plan.md) | `paystack.plan` | A collection of endpoints for creating and managing recurring payment configuration | 4 |
126+
| [Product](./docs/product.md) | `paystack.product` | A collection of endpoints for creating and managing inventories | 5 |
127+
| [Refund](./docs/refund.md) | `paystack.refund` | A collection of endpoints for creating and managing transaction reimbursement | 4 |
128+
| [Settlement](./docs/settlement.md) | `paystack.settlement` | A collection of endpoints for gaining insights into payouts | 2 |
129+
| [Split](./docs/split.md) | `paystack.split` | A collection of endpoints for spliting a transaction and managing the splits | 6 |
130+
| [Storefront](./docs/storefront.md) | `paystack.storefront` | A collection of endpoints for creating and managing storefronts | 11 |
131+
| [Subaccount](./docs/subaccount.md) | `paystack.subaccount` | A collection of endpoints for creating and managing accounts for sharing a transaction with | 4 |
132+
| [Subscription](./docs/subscription.md) | `paystack.subscription` | A collection of endpoints for creating and managing recurring payments | 7 |
133+
| [Terminal](./docs/terminal.md) | `paystack.terminal` | A collection of endpoints for building delightful in-person payment experiences | 8 |
134+
| [Transaction](./docs/transaction.md) | `paystack.transaction` | A collection of endpoints for managing payments | 9 |
135+
| [Transfer](./docs/transfer.md) | `paystack.transfer` | A collection of endpoints for automating sending money to beneficiaries | 11 |
136+
| [TransferRecipient](./docs/transfer_recipient.md) | `paystack.transfer_recipient` | A collection of endpoints for creating and managing beneficiaries that you send money to | 6 |
137+
| [VirtualTerminal](./docs/virtual_terminal.md) | `paystack.virtual_terminal` | A collection of endpoints for building in-person payments without a physical terminal | 9 |
138+
139+
Detailed method-level documentation for each resource is available in [`docs/`](./docs/).
140+
141+
---
32142

33143
## Contributing
34144

35-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/paystack-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/paystack-ruby/blob/main/CODE_OF_CONDUCT.md).
145+
> ⚠️ **This SDK is auto-generated** from the Paystack OpenAPI specification. Regenerate instead of manually editing generated files.
36146
37-
## License
147+
To request endpoint/schema changes, open an issue or pull request against the [Paystack OpenAPI specification](https://github.com/PaystackOSS/openapi).
38148

39-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
149+
---
40150

41-
## Code of Conduct
151+
## License
42152

43-
Everyone interacting in the Paystack::Ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/paystack-ruby/blob/main/CODE_OF_CONDUCT.md).
153+
MIT © Paystack

Rakefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ require "minitest/test_task"
55

66
Minitest::TestTask.create
77

8-
require "standard/rake"
9-
10-
task default: %i[test standard]
8+
task default: %i[test]

docs/apple_pay.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# ApplePay
2+
3+
A collection of endpoints for managing application's top-level domain or subdomain accepting payment via Apple Pay
4+
5+
## Methods
6+
7+
| Method | HTTP | Path | Summary |
8+
|---|---|---|---|
9+
| `list_domain` | `GET` | `/apple-pay/domain` | List Domains |
10+
| `register_domain` | `POST` | `/apple-pay/domain` | Register Domain |
11+
| `unregister_domain` | `DELETE` | `/apple-pay/domain` | Unregister Domain |
12+
13+
---
14+
15+
## `list_domain`
16+
17+
**HTTP:** `GET`
18+
**Path:** `/apple-pay/domain`
19+
20+
```ruby
21+
paystack.apple_pay.list_domain({ ... })
22+
```
23+
24+
### Query Fields
25+
26+
| Name | Required |
27+
|---|---|
28+
| `use_cursor` | false |
29+
| `next` | false |
30+
| `previous` | false |
31+
32+
## `register_domain`
33+
34+
**HTTP:** `POST`
35+
**Path:** `/apple-pay/domain`
36+
37+
```ruby
38+
paystack.apple_pay.register_domain({ ... })
39+
```
40+
41+
### Body Fields
42+
43+
| Name | Required |
44+
|---|---|
45+
| `domainName` | true |
46+
47+
## `unregister_domain`
48+
49+
**HTTP:** `DELETE`
50+
**Path:** `/apple-pay/domain`
51+
52+
```ruby
53+
paystack.apple_pay.unregister_domain({ ... })
54+
```
55+
56+
### Body Fields
57+
58+
| Name | Required |
59+
|---|---|
60+
| `domainName` | true |

docs/balance.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Balance
2+
3+
A collection of endpoints gaining insights into the amount on an integration
4+
5+
## Methods
6+
7+
| Method | HTTP | Path | Summary |
8+
|---|---|---|---|
9+
| `fetch` | `GET` | `/balance` | Fetch Balance |
10+
| `ledger` | `GET` | `/balance/ledger` | Balance Ledger |
11+
12+
---
13+
14+
## `fetch`
15+
16+
**HTTP:** `GET`
17+
**Path:** `/balance`
18+
19+
```ruby
20+
paystack.balance.fetch
21+
```
22+
23+
## `ledger`
24+
25+
**HTTP:** `GET`
26+
**Path:** `/balance/ledger`
27+
28+
```ruby
29+
paystack.balance.ledger({ ... })
30+
```
31+
32+
### Query Fields
33+
34+
| Name | Required |
35+
|---|---|
36+
| `perPage` | false |
37+
| `page` | false |
38+
| `from` | false |
39+
| `to` | false |

docs/bank.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Bank
2+
3+
A collection of endpoints for managing bank details
4+
5+
## Methods
6+
7+
| Method | HTTP | Path | Summary |
8+
|---|---|---|---|
9+
| `list` | `GET` | `/bank` | List Banks |
10+
| `resolve_account_number` | `GET` | `/bank/resolve` | Resolve Account Number |
11+
| `validate_account_number` | `POST` | `/bank/validate` | Validate Bank Account |
12+
13+
---
14+
15+
## `list`
16+
17+
**HTTP:** `GET`
18+
**Path:** `/bank`
19+
20+
```ruby
21+
paystack.bank.list({ ... })
22+
```
23+
24+
### Query Fields
25+
26+
| Name | Required |
27+
|---|---|
28+
| `country` | false |
29+
| `currency` | false |
30+
| `use_cursor` | false |
31+
| `perPage` | false |
32+
| `page` | false |
33+
| `next` | false |
34+
| `previous` | false |
35+
| `pay_with_bank_transfer` | false |
36+
| `pay_with_bank` | false |
37+
| `enabled_for_verification` | false |
38+
| `gateway` | false |
39+
| `type` | false |
40+
| `include_nip_sort_code` | false |
41+
42+
## `resolve_account_number`
43+
44+
**HTTP:** `GET`
45+
**Path:** `/bank/resolve`
46+
47+
```ruby
48+
paystack.bank.resolve_account_number({ ... })
49+
```
50+
51+
### Query Fields
52+
53+
| Name | Required |
54+
|---|---|
55+
| `account_number` | false |
56+
| `bank_code` | false |
57+
58+
## `validate_account_number`
59+
60+
**HTTP:** `POST`
61+
**Path:** `/bank/validate`
62+
63+
```ruby
64+
paystack.bank.validate_account_number({ ... })
65+
```
66+
67+
### Body Fields
68+
69+
| Name | Required |
70+
|---|---|
71+
| `account_name` | true |
72+
| `account_number` | true |
73+
| `account_type` | true |
74+
| `bank_code` | true |
75+
| `country_code` | true |
76+
| `document_type` | true |
77+
| `document_number` | false |

0 commit comments

Comments
 (0)