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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9520a7eb024d05477e162e1158a07f54167a6a89297f44d3a71caa01a40599cf
4
- data.tar.gz: 273bb964f85fb97660212f6a2046a58caf4e7302d07859fe3d562afe8269922d
3
+ metadata.gz: d2f519593b1d866474675fcfa516e6178ba31e43c4477b31613a7c45632d5b65
4
+ data.tar.gz: e9ae945478b507e3fa73f99b442c42344b54d5455f235f387a93cbc4185f567c
5
5
  SHA512:
6
- metadata.gz: d4b399cda4f620ca00549831546a4992069eb17cb84f08ce9aa0039744e7d3ea4868dd3498ee593c001678633bf708a6e8257ee093f75922996c0f1012f9aa6d
7
- data.tar.gz: bfd03c310aaf256d89228e6bcd0da10e3505004ab958c10c30baa51dd6df1c22d09ca974bcd61def524888dc9203a00fef78a51082991d2dd3aa8701f6060294
6
+ metadata.gz: ca77fb0fa96f9cf628522e77b8e52b61602eee6e4a1d95f159061519aa8af23c51b94460ff119565061e489b29883079afae9a7ed3cfdfd9a083c20c2b2e5a57
7
+ data.tar.gz: dbb86295fbe7fb1f2000eb12fb224eebf28564d8a9fb40a973fd8e80422901785b7e0f11eef1832a9d14a14a867da8919765687afa92b274122e1ecac8089944
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.2] - 2023-03-24
4
+
5
+ ### Fixes
6
+
7
+ - Updated `Increase::Webhook::Signature#verify` to
8
+ raise `WebhookSignatureVerificationError` when arguments are `nil`
9
+
3
10
  ## [0.3.1] - 2023-03-23
4
11
 
5
12
  ### Enhancements
data/README.md CHANGED
@@ -1,7 +1,11 @@
1
1
  # Increase
2
2
 
3
- A Ruby API client for [Increase](https://increase.com/), a platform for
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.1
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.1
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, update the version number in `version.rb`, and then
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
- Alternatively, use [`gem-release`](https://github.com/svenfuchs/gem-release) and
335
- run `gem bump --version patch|minor|major`. Then release the gem by
336
- running `bundle exec rake release`.
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/garyhtou/increase-ruby/blob/main/LICENSE.txt).
351
+ the [MIT License](https://github.com/hackclub/increase-ruby/blob/main/LICENSE.txt).
347
352
 
348
353
  ---
349
354
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Increase
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.3"
5
5
  end
@@ -23,7 +23,7 @@ module Increase
23
23
  end
24
24
 
25
25
  # Parse header
26
- sig_values = signature_header.split(",").map { |pair| pair.split("=") }.to_h
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.1
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: 2023-03-24 00:00:00.000000000 Z
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.3.7
246
+ rubygems_version: 3.4.10
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: An Increase.com Ruby client library