revolut 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/console +4 -4
- data/lib/revolut/client.rb +2 -0
- data/lib/revolut/clients/exchanges.rb +16 -0
- data/lib/revolut/connection.rb +20 -17
- data/lib/revolut/version.rb +1 -1
- data/revolut.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 422496e6b47c339ea92f6223ad2f53c157a348383aefcae6851b10cd957435be
|
4
|
+
data.tar.gz: 4c72ff8cca3ee0d322cea6adfc15d7072c279ad9962697b98468bc35fced9bd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 946fee60d3665248f32628d611cb33752d72a1af7a755e7aa8ae24e13fffd9774c3c14b88aa1cefe9e7ace65923af93a91dfc93bd43e30aca48c99089bcb138f
|
7
|
+
data.tar.gz: 5e4fed6c36acf95b80fc31ccb167fde84ad6f72ec097e5e92becda5853058346b730d13b576f1a2451adbec9904f5603e0489ba0426bc06e80584004f2aa6f18
|
data/bin/console
CHANGED
@@ -8,8 +8,8 @@ require 'revolut'
|
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
9
9
|
|
10
10
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
|
12
|
-
|
11
|
+
require 'pry'
|
12
|
+
Pry.start
|
13
13
|
|
14
|
-
require 'irb'
|
15
|
-
IRB.start(__FILE__)
|
14
|
+
# require 'irb'
|
15
|
+
# IRB.start(__FILE__)
|
data/lib/revolut/client.rb
CHANGED
@@ -5,6 +5,7 @@ require 'revolut/configuration'
|
|
5
5
|
|
6
6
|
require 'revolut/clients/accounts'
|
7
7
|
require 'revolut/clients/counterparties'
|
8
|
+
require 'revolut/clients/exchanges'
|
8
9
|
require 'revolut/clients/payment_drafts'
|
9
10
|
require 'revolut/clients/payments'
|
10
11
|
require 'revolut/clients/webhooks'
|
@@ -14,6 +15,7 @@ module Revolut
|
|
14
15
|
class Client
|
15
16
|
include Revolut::Clients::Accounts
|
16
17
|
include Revolut::Clients::Counterparties
|
18
|
+
include Revolut::Clients::Exchanges
|
17
19
|
include Revolut::Clients::PaymentDrafts
|
18
20
|
include Revolut::Clients::Payments
|
19
21
|
include Revolut::Clients::Webhooks
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Revolut
|
4
|
+
module Clients
|
5
|
+
# Revolut Exchanges
|
6
|
+
module Exchanges
|
7
|
+
def exchange_rate(from:, to:, amount:)
|
8
|
+
connection.get('rate', from: from, to: to, amount: amount)
|
9
|
+
end
|
10
|
+
|
11
|
+
def exchange(params = {})
|
12
|
+
connection.post('exchange', params)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/revolut/connection.rb
CHANGED
@@ -33,39 +33,42 @@ module Revolut
|
|
33
33
|
def request(method, path, query_params = {}, body_params = {})
|
34
34
|
response = connection.send(method) do |request|
|
35
35
|
request.url(path, query_params)
|
36
|
-
request
|
36
|
+
add_request_headers!(request)
|
37
37
|
|
38
|
-
if
|
39
|
-
request.
|
38
|
+
if Revolut::Utils.present?(body_params)
|
39
|
+
request.body = body_params.to_json
|
40
40
|
end
|
41
|
-
|
42
|
-
request.body = body_params.to_json
|
43
41
|
end
|
44
42
|
|
45
43
|
response
|
46
44
|
end
|
47
45
|
|
48
|
-
def
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}
|
46
|
+
def add_request_headers!(request)
|
47
|
+
request.headers['Content-Type'] = 'application/json'
|
48
|
+
request.headers['Accept'] = 'application/json'
|
49
|
+
|
50
|
+
return unless client.config.api_key
|
54
51
|
|
55
|
-
|
52
|
+
request.headers['Authorization'] = "Bearer #{client.config.api_key}"
|
56
53
|
end
|
57
54
|
|
58
|
-
def
|
59
|
-
|
55
|
+
def connection
|
56
|
+
Faraday.new(connection_options) do |builder|
|
60
57
|
builder.request :json
|
61
58
|
|
62
|
-
builder.
|
63
|
-
builder.use FaradayMiddleware::Mashify, mash_class: Revolut::Mash
|
59
|
+
builder.response :mashify, mash_class: Revolut::Mash
|
64
60
|
builder.use Revolut::Middleware::RaiseError
|
65
|
-
builder.
|
61
|
+
builder.response :json
|
66
62
|
|
67
63
|
builder.adapter Faraday.default_adapter
|
68
64
|
end
|
69
65
|
end
|
66
|
+
|
67
|
+
def connection_options
|
68
|
+
{
|
69
|
+
headers: { user_agent: client.config.user_agent },
|
70
|
+
url: client.config.url
|
71
|
+
}
|
72
|
+
end
|
70
73
|
end
|
71
74
|
end
|
data/lib/revolut/version.rb
CHANGED
data/revolut.gemspec
CHANGED
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_development_dependency 'pry', '~> 0.12'
|
44
44
|
spec.add_development_dependency 'rake', '~> 13.0'
|
45
45
|
spec.add_development_dependency 'rspec', '~> 3.9'
|
46
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
46
|
+
spec.add_development_dependency 'rubocop', '~> 0.77'
|
47
47
|
spec.add_development_dependency 'simplecov', '~> 0.17'
|
48
48
|
spec.add_development_dependency 'webmock', '~> 3.7'
|
49
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revolut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justas Palumickas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0.
|
117
|
+
version: '0.77'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0.
|
124
|
+
version: '0.77'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- lib/revolut/client.rb
|
173
173
|
- lib/revolut/clients/accounts.rb
|
174
174
|
- lib/revolut/clients/counterparties.rb
|
175
|
+
- lib/revolut/clients/exchanges.rb
|
175
176
|
- lib/revolut/clients/payment_drafts.rb
|
176
177
|
- lib/revolut/clients/payments.rb
|
177
178
|
- lib/revolut/clients/webhooks.rb
|
@@ -188,8 +189,8 @@ licenses:
|
|
188
189
|
- MIT
|
189
190
|
metadata:
|
190
191
|
bug_tracker_uri: https://github.com/jpalumickas/revolut-ruby/issues
|
191
|
-
source_code_uri: https://github.com/jpalumickas/revolut-ruby/tree/v1.
|
192
|
-
changelog_uri: https://github.com/jpalumickas/revolut-ruby/releases/tag/v1.
|
192
|
+
source_code_uri: https://github.com/jpalumickas/revolut-ruby/tree/v1.2.0
|
193
|
+
changelog_uri: https://github.com/jpalumickas/revolut-ruby/releases/tag/v1.2.0
|
193
194
|
post_install_message:
|
194
195
|
rdoc_options: []
|
195
196
|
require_paths:
|