revolut-connect 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +6 -0
- data/lib/revolut/resources/auth.rb +4 -4
- data/lib/revolut/version.rb +1 -1
- data/lib/revolut.rb +5 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ab4ede6e2971a49dea7cccc0a36ec45af6b87e9d9e4b239b7870eab34b7a278
|
4
|
+
data.tar.gz: d253ad5ca5b9b40fb8a16989fa787a93fd199a6f01621ed626c8a18dda95eaef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d023304718166aadb50b682fa557c0844932c8ffb0a0757666e8e9c8e9135fa1aeee5ddf774504348641d12099d7ec274fa29db100f66fc88b898b88dd4b340
|
7
|
+
data.tar.gz: 16fb000e2863c830732d031353895425fd1bde52faad6f04ebf1f60f57c8af4534221442ce12a4eb0ae209a135f36da7f6cd7a522dced82cfac35487ac3b3099
|
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).
|
@@ -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,7 +1,7 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Mochetti
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday-retry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2'
|
55
55
|
description: Revolut API connector for Ruby. This gem is not official and is not supported
|
56
56
|
by Revolut. Use at your own risk.
|
57
57
|
email:
|