transferwise 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/transferwise.rb +6 -0
- data/lib/transferwise/oauth.rb +11 -1
- data/lib/transferwise/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab064fb21125ffbf947f8ea73060265c335fe089
|
4
|
+
data.tar.gz: c25dc8712bd5a14f0971c884fe46d372a7d0027b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a76cfca3728b41b7c8689f0895f515facfdb3df2e8631aa5b7059d699d22d2a9e33735f668d45114d639738275d784c56b7a4d9fe2fc71e09b569d00b658687
|
7
|
+
data.tar.gz: 9af83e425156e4ced88cc2ba8344b2555e7d628c366eaeb893659e81d40237a2b1036ff1dff6b8174e5f32c7c7ac0f01d814ee94d4fdeb9b66e3e30febe9afa7
|
data/lib/transferwise.rb
CHANGED
@@ -38,5 +38,11 @@ module Transferwise
|
|
38
38
|
test_url = 'https://api.sandbox.transferwise.tech'
|
39
39
|
@api_base ||= mode == 'live' ? live_url : test_url
|
40
40
|
end
|
41
|
+
|
42
|
+
def authorization_base
|
43
|
+
live_url = 'https://api.transferwise.com'
|
44
|
+
test_url = 'https://sandbox.transferwise.tech'
|
45
|
+
@authorization_base ||= mode == 'live' ? live_url : test_url
|
46
|
+
end
|
41
47
|
end
|
42
48
|
end
|
data/lib/transferwise/oauth.rb
CHANGED
@@ -16,11 +16,21 @@ module Transferwise
|
|
16
16
|
}
|
17
17
|
)
|
18
18
|
end
|
19
|
+
|
20
|
+
def authorize_client
|
21
|
+
@authorize_client ||= ::OAuth2::Client.new(
|
22
|
+
@client_id,
|
23
|
+
@client_secret,
|
24
|
+
{ site: TransferWise.authorization_base,
|
25
|
+
auth_scheme: :basic_auth
|
26
|
+
}
|
27
|
+
)
|
28
|
+
end
|
19
29
|
|
20
30
|
# Get the url to redirect a user to, pass the redirect_url you want the user
|
21
31
|
# to be redirected back to.
|
22
32
|
def authorize_url(redirect_url)
|
23
|
-
|
33
|
+
authorize_client.auth_code.authorize_url({redirect_uri: redirect_url})
|
24
34
|
end
|
25
35
|
|
26
36
|
# Get the access token. You must pass the exact same redirect_url passed
|
data/lib/transferwise/version.rb
CHANGED