revolut-connect 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/lib/revolut/connect.rb +1 -0
- data/lib/revolut/resources/auth.rb +4 -4
- data/lib/revolut/version.rb +1 -1
- data/lib/revolut.rb +5 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c3fcb46e2423e47f2597ae155daa4e0f86f0a861c4a862c04b7ca8e8064378d
|
4
|
+
data.tar.gz: aabf68cbbccf5c8e5e6c14bfb6ad329c45251e3621b0fc5c0f53373d3cf5e8ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9687a994b4e4944c2f1148ddbd0d0a064655bbaf0534e230ff5367508f7a77cbe00f57dde98fa7a09811678448b4d1d4b03ca5a7a00874f8ec2ca52ee0d54bc8
|
7
|
+
data.tar.gz: fe4531d59a808adb461487693b146207ab5f54b254e2a07d1447448203cfba2cec9f19c06182aab41e36ce050951720f9548659c141b3306e17b0a1687f15a4c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -156,6 +156,10 @@ Revolut.configure do |config|
|
|
156
156
|
# Optional: Set the environment to be production or sandbox.
|
157
157
|
# Default: sandbox
|
158
158
|
config.environment = ENV["REVOLUT_ENVIRONMENT"]
|
159
|
+
|
160
|
+
# Optional: The JWT for an already exchanged token.
|
161
|
+
# Used to preload an existing auth token so that you don't have to exchange / renew it again.
|
162
|
+
config.auth_json = ENV["REVOLUT_AUTH_JSON"]
|
159
163
|
end
|
160
164
|
```
|
161
165
|
|
@@ -229,6 +233,8 @@ deleted = Revolut::Payment.delete(transaction.id)
|
|
229
233
|
|
230
234
|
## Development
|
231
235
|
|
236
|
+
You can use `bin/console` to access an interactive console. This will preload environment variables from a `.env` file.
|
237
|
+
|
232
238
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
233
239
|
|
234
240
|
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).
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative "../revolut"
|
@@ -105,17 +105,17 @@ module Revolut
|
|
105
105
|
!@access_token.nil? && !expired?
|
106
106
|
end
|
107
107
|
|
108
|
-
# Loads authentication information from
|
108
|
+
# Loads authentication information from the configuration auth_json.
|
109
109
|
#
|
110
|
-
# If the access token is not already set and
|
111
|
-
# this method loads the JSON data from the
|
110
|
+
# If the access token is not already set and auth_json config is present,
|
111
|
+
# this method loads the JSON data from the config variable and calls the load method to set the authentication information.
|
112
112
|
#
|
113
113
|
# Example:
|
114
114
|
# auth.load_from_env
|
115
115
|
#
|
116
116
|
# @return [void]
|
117
117
|
def load_from_env
|
118
|
-
env_json =
|
118
|
+
env_json = Revolut.config.auth_json
|
119
119
|
|
120
120
|
return unless @access_token.nil? && env_json
|
121
121
|
|
data/lib/revolut/version.rb
CHANGED
data/lib/revolut.rb
CHANGED
@@ -10,9 +10,6 @@ require_relative "revolut/client"
|
|
10
10
|
require_relative "revolut/resources/resource"
|
11
11
|
Dir[File.join(__dir__, "revolut", "resources", "*.rb")].each { |file| require file }
|
12
12
|
|
13
|
-
# Load the authentication information from the environment variable REVOLUT_AUTH_JSON right away if possible.
|
14
|
-
Revolut::Auth.load_from_env
|
15
|
-
|
16
13
|
module Revolut
|
17
14
|
class Error < StandardError; end
|
18
15
|
|
@@ -21,7 +18,7 @@ module Revolut
|
|
21
18
|
class NotImplementedError < Error; end
|
22
19
|
|
23
20
|
class Configuration
|
24
|
-
attr_accessor :request_timeout, :global_headers, :environment, :token_duration, :scope
|
21
|
+
attr_accessor :request_timeout, :global_headers, :environment, :token_duration, :scope, :auth_json
|
25
22
|
attr_writer :client_id, :signing_key, :iss, :authorize_redirect_uri
|
26
23
|
attr_reader :base_uri
|
27
24
|
|
@@ -38,6 +35,7 @@ module Revolut
|
|
38
35
|
@iss = ENV.fetch("REVOLUT_ISS", "example.com")
|
39
36
|
@authorize_redirect_uri = ENV["REVOLUT_AUTHORIZE_REDIRECT_URI"]
|
40
37
|
@token_duration = ENV.fetch("REVOLUT_TOKEN_DURATION", DEFAULT_TOKEN_DURATION)
|
38
|
+
@auth_json = ENV["REVOLUT_AUTH_JSON"]
|
41
39
|
@scope = ENV["REVOLUT_SCOPE"]
|
42
40
|
@environment = ENV.fetch("REVOLUT_ENVIRONMENT", DEFAULT_ENVIRONMENT).to_sym
|
43
41
|
@base_uri = (environment == :sandbox) ? "https://sandbox-b2b.revolut.com/api/1.0/" : "https://b2b.revolut.com/api/1.0/"
|
@@ -80,3 +78,6 @@ module Revolut
|
|
80
78
|
end
|
81
79
|
end
|
82
80
|
end
|
81
|
+
|
82
|
+
# Load the authentication information from the environment variable REVOLUT_AUTH_JSON right away if possible.
|
83
|
+
Revolut::Auth.load_from_env
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revolut-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Mochetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- Rakefile
|
76
76
|
- lib/revolut.rb
|
77
77
|
- lib/revolut/client.rb
|
78
|
+
- lib/revolut/connect.rb
|
78
79
|
- lib/revolut/http.rb
|
79
80
|
- lib/revolut/middlewares/catch_error.rb
|
80
81
|
- lib/revolut/resources/account.rb
|