increase 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +17 -12
- data/lib/increase/version.rb +1 -1
- data/lib/increase/webhook/signature.rb +7 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2f519593b1d866474675fcfa516e6178ba31e43c4477b31613a7c45632d5b65
|
4
|
+
data.tar.gz: e9ae945478b507e3fa73f99b442c42344b54d5455f235f387a93cbc4185f567c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca77fb0fa96f9cf628522e77b8e52b61602eee6e4a1d95f159061519aa8af23c51b94460ff119565061e489b29883079afae9a7ed3cfdfd9a083c20c2b2e5a57
|
7
|
+
data.tar.gz: dbb86295fbe7fb1f2000eb12fb224eebf28564d8a9fb40a973fd8e80422901785b7e0f11eef1832a9d14a14a867da8919765687afa92b274122e1ecac8089944
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
# Increase
|
2
2
|
|
3
|
-
|
4
|
-
Bare-Metal Banking APIs!
|
3
|
+
_A Ruby API client for [Increase](https://increase.com/), a platform for
|
4
|
+
Bare-Metal Banking APIs!_
|
5
|
+
|
6
|
+
Interact with Increase's API in a simple and Ruby-like manner.
|
7
|
+
|
8
|
+
🏦 Battle-tested at [HCB](https://hackclub.com/hcb/)
|
5
9
|
|
6
10
|
- [Installation](#installation)
|
7
11
|
- [Usage](#usage)
|
@@ -19,14 +23,14 @@ Bare-Metal Banking APIs!
|
|
19
23
|
Install the gem and add to the application's Gemfile by executing:
|
20
24
|
|
21
25
|
```sh
|
22
|
-
$ bundle add increase -v 0.3.
|
26
|
+
$ bundle add increase -v 0.3.2
|
23
27
|
```
|
24
28
|
|
25
29
|
If bundler is not being used to manage dependencies, install the gem by
|
26
30
|
executing:
|
27
31
|
|
28
32
|
```sh
|
29
|
-
$ gem install increase -v 0.3.
|
33
|
+
$ gem install increase -v 0.3.2
|
30
34
|
```
|
31
35
|
|
32
36
|
## Usage
|
@@ -326,14 +330,15 @@ to run the console with your Increase sandbox API key pre-filled.
|
|
326
330
|
|
327
331
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
328
332
|
|
329
|
-
To release a new version
|
330
|
-
run `bundle exec rake release`, which will create a git tag for the version,
|
331
|
-
push git commits and the created tag, and push the `.gem` file
|
332
|
-
to [rubygems.org](https://rubygems.org).
|
333
|
+
To release a new version:
|
333
334
|
|
334
|
-
|
335
|
-
|
336
|
-
|
335
|
+
- `gem bump --version patch|minor|major`
|
336
|
+
- Make sure you
|
337
|
+
have [`gem-release`](https://github.com/svenfuchs/gem-release)
|
338
|
+
installed
|
339
|
+
- Update the CHANGELOG and README if necessary
|
340
|
+
- `bundle exec rake release`
|
341
|
+
- Create release on GitHub from newly created tag
|
337
342
|
|
338
343
|
## Contributing
|
339
344
|
|
@@ -343,7 +348,7 @@ at https://github.com/garyhtou/increase.
|
|
343
348
|
## License
|
344
349
|
|
345
350
|
The gem is available as open source under the terms of
|
346
|
-
the [MIT License](https://github.com/
|
351
|
+
the [MIT License](https://github.com/hackclub/increase-ruby/blob/main/LICENSE.txt).
|
347
352
|
|
348
353
|
---
|
349
354
|
|
data/lib/increase/version.rb
CHANGED
@@ -23,7 +23,7 @@ module Increase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# Parse header
|
26
|
-
sig_values = signature_header
|
26
|
+
sig_values = signature_header&.split(",")&.map { |pair| pair.split("=") }&.to_h || {}
|
27
27
|
|
28
28
|
# Extract values
|
29
29
|
t = sig_values["t"] # Should be a string (ISO-8601 timestamp)
|
@@ -32,6 +32,8 @@ module Increase
|
|
32
32
|
raise sig_error.call("No signature found with scheme #{scheme} in signature header") if sig.nil?
|
33
33
|
|
34
34
|
# Check signature
|
35
|
+
raise sig_error.call("Webhook secret is required") if secret.nil?
|
36
|
+
raise sig_error.call("Payload is required") if payload.nil?
|
35
37
|
expected_sig = compute_signature(timestamp: t, payload: payload, secret: secret)
|
36
38
|
matches = Util.secure_compare(expected_sig, sig)
|
37
39
|
raise sig_error.call("Signature mismatch") unless matches
|
@@ -56,6 +58,10 @@ module Increase
|
|
56
58
|
end
|
57
59
|
|
58
60
|
def self.compute_signature(timestamp:, payload:, secret:)
|
61
|
+
raise ArgumentError, "timestamp is required" if timestamp.nil?
|
62
|
+
raise ArgumentError, "payload is required" if payload.nil?
|
63
|
+
raise ArgumentError, "secret is required" if secret.nil?
|
64
|
+
|
59
65
|
signed_payload = timestamp.to_s + "." + payload.to_s
|
60
66
|
OpenSSL::HMAC.hexdigest("SHA256", secret, signed_payload)
|
61
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: increase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary Tou
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -227,7 +227,7 @@ licenses:
|
|
227
227
|
metadata:
|
228
228
|
homepage_uri: https://github.com/garyhtou/increase-ruby
|
229
229
|
source_code_uri: https://github.com/garyhtou/increase-ruby
|
230
|
-
changelog_uri: https://github.com/garyhtou/increase-ruby
|
230
|
+
changelog_uri: https://github.com/garyhtou/increase-ruby/blob/main/CHANGELOG.md
|
231
231
|
post_install_message:
|
232
232
|
rdoc_options: []
|
233
233
|
require_paths:
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
- !ruby/object:Gem::Version
|
244
244
|
version: '0'
|
245
245
|
requirements: []
|
246
|
-
rubygems_version: 3.
|
246
|
+
rubygems_version: 3.4.10
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
249
|
summary: An Increase.com Ruby client library
|