flinks 0.3.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -0
- data/Gemfile.lock +27 -28
- data/README.md +48 -7
- data/VERSION +1 -1
- data/flinks.gemspec +4 -4
- data/lib/flinks.rb +2 -0
- data/lib/flinks/api/account.rb +2 -0
- data/lib/flinks/api/authorize.rb +6 -1
- data/lib/flinks/api/card.rb +2 -0
- data/lib/flinks/api/refresh.rb +2 -14
- data/lib/flinks/api/statement.rb +2 -0
- data/lib/flinks/client.rb +3 -0
- data/lib/flinks/error.rb +33 -1
- data/lib/flinks/request.rb +5 -1
- data/spec/lib/api/authorize_spec.rb +40 -1
- data/spec/lib/api/refresh_spec.rb +0 -22
- data/spec/lib/client_spec.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1f7a9b0d7dffd9587855c4180c6460f075e026aa77aad81e27a3e8a9fdff230
|
4
|
+
data.tar.gz: c7694a914067bad7e8c87de6c075efe68b13aafb658c6b78a535383850045871
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad693d77d924727a384e14df77e150067011fc0eebf417ebcd8436234eabd1eec2d84c7b3816c519bc036421f7401fa88041d2deec9efb095415ec5e52559dbd
|
7
|
+
data.tar.gz: 4ef300d40d8d154222b8a804bd18687bd8e29e515bb1fea168b85dbd6f730c16c73ecd1f83d45fa508646b98d9514cb3b985ff40d45eb4bdbf56e6a70e4d0d3c
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5.
|
1
|
+
2.5.1
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (5.
|
4
|
+
activesupport (5.2.0)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
-
i18n (
|
6
|
+
i18n (>= 0.7, < 2)
|
7
7
|
minitest (~> 5.1)
|
8
8
|
tzinfo (~> 1.1)
|
9
9
|
addressable (2.5.2)
|
@@ -15,40 +15,40 @@ GEM
|
|
15
15
|
descendants_tracker (0.0.4)
|
16
16
|
thread_safe (~> 0.3, >= 0.3.1)
|
17
17
|
diff-lcs (1.3)
|
18
|
-
docile (1.1
|
19
|
-
domain_name (0.5.
|
18
|
+
docile (1.3.1)
|
19
|
+
domain_name (0.5.20180417)
|
20
20
|
unf (>= 0.0.5, < 1.0.0)
|
21
21
|
dry-configurable (0.7.0)
|
22
22
|
concurrent-ruby (~> 1.0)
|
23
23
|
dry-container (0.6.0)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
25
|
dry-configurable (~> 0.1, >= 0.1.3)
|
26
|
-
dry-core (0.4.
|
26
|
+
dry-core (0.4.6)
|
27
27
|
concurrent-ruby (~> 1.0)
|
28
|
-
dry-equalizer (0.2.
|
28
|
+
dry-equalizer (0.2.1)
|
29
|
+
dry-inflector (0.1.2)
|
29
30
|
dry-initializer (2.4.0)
|
30
31
|
dry-logic (0.4.2)
|
31
32
|
dry-container (~> 0.2, >= 0.2.6)
|
32
33
|
dry-core (~> 0.2)
|
33
34
|
dry-equalizer (~> 0.2)
|
34
|
-
dry-types (0.
|
35
|
+
dry-types (0.13.2)
|
35
36
|
concurrent-ruby (~> 1.0)
|
36
|
-
dry-configurable (~> 0.1)
|
37
37
|
dry-container (~> 0.3)
|
38
|
-
dry-core (~> 0.
|
38
|
+
dry-core (~> 0.4, >= 0.4.4)
|
39
39
|
dry-equalizer (~> 0.2)
|
40
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
40
41
|
dry-logic (~> 0.4, >= 0.4.2)
|
41
|
-
|
42
|
-
dry-validation (0.11.1)
|
42
|
+
dry-validation (0.12.0)
|
43
43
|
concurrent-ruby (~> 1.0)
|
44
44
|
dry-configurable (~> 0.1, >= 0.1.3)
|
45
45
|
dry-core (~> 0.2, >= 0.2.1)
|
46
46
|
dry-equalizer (~> 0.2)
|
47
47
|
dry-logic (~> 0.4, >= 0.4.0)
|
48
|
-
dry-types (~> 0.
|
48
|
+
dry-types (~> 0.13.1)
|
49
49
|
faraday (0.12.2)
|
50
50
|
multipart-post (>= 1.2, < 3)
|
51
|
-
git (1.
|
51
|
+
git (1.4.0)
|
52
52
|
github_api (0.18.2)
|
53
53
|
addressable (~> 2.4)
|
54
54
|
descendants_tracker (~> 0.0.4)
|
@@ -57,19 +57,18 @@ GEM
|
|
57
57
|
oauth2 (~> 1.0)
|
58
58
|
hashdiff (0.3.7)
|
59
59
|
hashie (3.5.7)
|
60
|
-
highline (
|
61
|
-
http (3.
|
60
|
+
highline (2.0.0)
|
61
|
+
http (3.3.0)
|
62
62
|
addressable (~> 2.3)
|
63
63
|
http-cookie (~> 1.0)
|
64
|
-
http-form_data (
|
64
|
+
http-form_data (~> 2.0)
|
65
65
|
http_parser.rb (~> 0.6.0)
|
66
66
|
http-cookie (1.0.3)
|
67
67
|
domain_name (~> 0.5)
|
68
|
-
http-form_data (2.
|
68
|
+
http-form_data (2.1.1)
|
69
69
|
http_parser.rb (0.6.0)
|
70
|
-
i18n (0.
|
70
|
+
i18n (1.0.1)
|
71
71
|
concurrent-ruby (~> 1.0)
|
72
|
-
inflecto (0.0.2)
|
73
72
|
json (1.8.6)
|
74
73
|
juwelier (2.1.3)
|
75
74
|
builder
|
@@ -87,7 +86,7 @@ GEM
|
|
87
86
|
multi_json (1.13.1)
|
88
87
|
multi_xml (0.6.0)
|
89
88
|
multipart-post (2.0.0)
|
90
|
-
nokogiri (1.8.
|
89
|
+
nokogiri (1.8.3)
|
91
90
|
mini_portile2 (~> 2.3.0)
|
92
91
|
oauth2 (1.4.0)
|
93
92
|
faraday (>= 0.8, < 0.13)
|
@@ -95,9 +94,9 @@ GEM
|
|
95
94
|
multi_json (~> 1.3)
|
96
95
|
multi_xml (~> 0.5)
|
97
96
|
rack (>= 1.2, < 3)
|
98
|
-
public_suffix (3.0.
|
99
|
-
rack (2.0.
|
100
|
-
rake (12.3.
|
97
|
+
public_suffix (3.0.2)
|
98
|
+
rack (2.0.5)
|
99
|
+
rake (12.3.1)
|
101
100
|
rdoc (3.12.2)
|
102
101
|
json (~> 1.4)
|
103
102
|
rspec (3.7.0)
|
@@ -121,18 +120,18 @@ GEM
|
|
121
120
|
shoulda-context (1.2.2)
|
122
121
|
shoulda-matchers (2.8.0)
|
123
122
|
activesupport (>= 3.0.0)
|
124
|
-
simplecov (0.
|
125
|
-
docile (~> 1.1
|
123
|
+
simplecov (0.16.1)
|
124
|
+
docile (~> 1.1)
|
126
125
|
json (>= 1.8, < 3)
|
127
126
|
simplecov-html (~> 0.10.0)
|
128
127
|
simplecov-html (0.10.2)
|
129
128
|
thread_safe (0.3.6)
|
130
|
-
tzinfo (1.2.
|
129
|
+
tzinfo (1.2.5)
|
131
130
|
thread_safe (~> 0.1)
|
132
131
|
unf (0.1.4)
|
133
132
|
unf_ext
|
134
|
-
unf_ext (0.0.7.
|
135
|
-
webmock (3.
|
133
|
+
unf_ext (0.0.7.5)
|
134
|
+
webmock (3.4.2)
|
136
135
|
addressable (>= 2.3.6)
|
137
136
|
crack (>= 0.3.2)
|
138
137
|
hashdiff
|
data/README.md
CHANGED
@@ -21,10 +21,10 @@ gem 'flinks', require: 'flinks'
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
This library needs to be configured with your API customer ID
|
24
|
+
This library needs to be configured with your API customer ID.
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
flinks = Flinks.new(customer_id: ENV['FLINKS_CUSTOMER_ID']
|
27
|
+
flinks = Flinks.new(customer_id: ENV['FLINKS_CUSTOMER_ID'])
|
28
28
|
```
|
29
29
|
|
30
30
|
Configure `on_error` to catch API requests returning a `400..599` HTTP status.
|
@@ -32,23 +32,38 @@ Configure `on_error` to catch API requests returning a `400..599` HTTP status.
|
|
32
32
|
```ruby
|
33
33
|
flinks = Flinks.new({
|
34
34
|
customer_id: ENV['FLINKS_CUSTOMER_ID'],
|
35
|
-
api_endpoint: "https://YOURNAME-api.private.fin.ag/v3/",
|
36
35
|
on_error: Proc.new do |status, message, body|
|
37
36
|
p [status, message, body]
|
38
37
|
end
|
39
38
|
})
|
40
39
|
```
|
41
40
|
|
42
|
-
Configure `debug` to print every API requests and responses.
|
41
|
+
Configure `debug` to print every API requests and responses. Default to `false`.
|
43
42
|
|
44
43
|
```ruby
|
45
44
|
flinks = Flinks.new({
|
46
45
|
customer_id: ENV['FLINKS_CUSTOMER_ID'],
|
47
|
-
api_endpoint: "https://YOURNAME-api.private.fin.ag/v3/",
|
48
46
|
debug: true
|
49
47
|
})
|
50
48
|
```
|
51
49
|
|
50
|
+
Configure `raw` to get the raw, non-transformed API response. Default to `false`.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
flinks = Flinks.new({
|
54
|
+
customer_id: ENV['FLINKS_CUSTOMER_ID'],
|
55
|
+
raw: true
|
56
|
+
})
|
57
|
+
```
|
58
|
+
|
59
|
+
### Sandbox and Production
|
60
|
+
|
61
|
+
By default, the client uses the sandbox API endpoint: `https://sandbox.flinks.io/v3/`. In production, the API endpoint must be configured with your own:
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
flinks = Flinks.new(customer_id: ENV['FLINKS_CUSTOMER_ID'], api_endpoint: "https://YOURNAME-api.private.fin.ag/v3/")
|
65
|
+
```
|
66
|
+
|
52
67
|
### Endpoints
|
53
68
|
|
54
69
|
#### Authorize
|
@@ -70,8 +85,6 @@ flinks = Flinks.new({
|
|
70
85
|
|
71
86
|
#### Refresh
|
72
87
|
|
73
|
-
- `activate_scheduled_refresh(login_id:)`
|
74
|
-
- `deactivate_scheduled_refresh(login_id:)`
|
75
88
|
- `set_scheduled_refresh(activated, login_id:)`
|
76
89
|
|
77
90
|
#### Statement
|
@@ -79,6 +92,34 @@ flinks = Flinks.new({
|
|
79
92
|
- `statements(options:)`
|
80
93
|
- `statements_async(request_id:)`
|
81
94
|
|
95
|
+
## Errors
|
96
|
+
|
97
|
+
### Client Errors
|
98
|
+
|
99
|
+
| Error | Description |
|
100
|
+
|-------|-------------|
|
101
|
+
| `Flinks::ClientError` | Raised when API returns a 400..499 HTTP status code |
|
102
|
+
| `Flinks::BadRequest` | Raised when API returns a 400 HTTP status code |
|
103
|
+
| `Flinks::Unauthorized` | Raised when API returns a 401 HTTP status code |
|
104
|
+
| `Flinks::Forbidden` | Raised when API returns a 403 HTTP status code |
|
105
|
+
| `Flinks::TooManyRequests` | Raised when API returns a 403 HTTP status code for rate limit exceeded |
|
106
|
+
| `Flinks::NotFound` | Raised when API returns a 404 HTTP status code |
|
107
|
+
| `Flinks::MethodNotAllowed` | Raised when API returns a 405 HTTP status code |
|
108
|
+
| `Flinks::NotAcceptable` | Raised when API returns a 406 HTTP status code |
|
109
|
+
| `Flinks::Conflict` | Raised when API returns a 409 HTTP status code |
|
110
|
+
| `Flinks::UnsupportedMediaType` | Raised when API returns a 415 HTTP status code |
|
111
|
+
| `Flinks::UnprocessableEntity` | Raised when API returns a 422 HTTP status code |
|
112
|
+
|
113
|
+
### Server Errors
|
114
|
+
|
115
|
+
| Error | Description |
|
116
|
+
|-------|-------------|
|
117
|
+
| `Flinks::ServerError` | Raised when API returns a 500..599 HTTP status code |
|
118
|
+
| `Flinks::InternalServerError` | Raised when API returns a 500 HTTP status code |
|
119
|
+
| `Flinks::NotImplemented` | Raised when API returns a 501 HTTP status code |
|
120
|
+
| `Flinks::BadGateway` | Raised when API returns a 502 HTTP status code |
|
121
|
+
| `Flinks::ServiceUnavailable` | Raised when API returns a 503 HTTP status code |
|
122
|
+
|
82
123
|
## Documentation
|
83
124
|
|
84
125
|
See the [API docs](https://sandbox-api.flinks.io).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.2
|
data/flinks.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: flinks 0.
|
5
|
+
# stub: flinks 0.4.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "flinks".freeze
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.4.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Philippe Dionne".freeze]
|
14
|
-
s.date = "2018-
|
14
|
+
s.date = "2018-06-18"
|
15
15
|
s.description = "Flinks financial services API client".freeze
|
16
16
|
s.email = "dionne.phil@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
|
|
48
48
|
]
|
49
49
|
s.homepage = "http://github.com/phildionne/flinks".freeze
|
50
50
|
s.licenses = ["MIT".freeze]
|
51
|
-
s.rubygems_version = "2.7.
|
51
|
+
s.rubygems_version = "2.7.6".freeze
|
52
52
|
s.summary = "Flinks API client".freeze
|
53
53
|
|
54
54
|
if s.respond_to? :specification_version then
|
data/lib/flinks.rb
CHANGED
data/lib/flinks/api/account.rb
CHANGED
data/lib/flinks/api/authorize.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'dry-validation'
|
2
4
|
|
3
5
|
module Flinks
|
@@ -35,6 +37,8 @@ module Flinks
|
|
35
37
|
|
36
38
|
AuthorizeMultipleRequestSchema = Dry::Validation.Schema do
|
37
39
|
required(:login_ids).each(:str?)
|
40
|
+
|
41
|
+
optional(:most_recent_cached).filled(:bool?)
|
38
42
|
end
|
39
43
|
|
40
44
|
# @see https://sandbox-api.flinks.io/Readme/#authorize
|
@@ -62,8 +66,9 @@ module Flinks
|
|
62
66
|
|
63
67
|
# @see https://sandbox-api.flinks.io/Readme/#authorize-multiple
|
64
68
|
# @param login_ids [Array]
|
69
|
+
# @param options [Hash]
|
65
70
|
# @return [Hash]
|
66
|
-
def authorize_multiple(login_ids:)
|
71
|
+
def authorize_multiple(login_ids:, options: {})
|
67
72
|
payload = options.merge(login_ids: login_ids)
|
68
73
|
validate_request!(AuthorizeMultipleRequestSchema, payload)
|
69
74
|
|
data/lib/flinks/api/card.rb
CHANGED
data/lib/flinks/api/refresh.rb
CHANGED
@@ -1,20 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Flinks
|
2
4
|
module API
|
3
5
|
module Refresh
|
4
|
-
|
5
|
-
# @see https://sandbox-api.flinks.io/Readme/#scheduling-background-refresh
|
6
|
-
# @param login_id [String]
|
7
|
-
# @return [Hash]
|
8
|
-
def activate_scheduled_refresh(login_id:)
|
9
|
-
patch("#{customer_id}/BankingServices/ActivateScheduledRefresh/#{login_id}")
|
10
|
-
end
|
11
|
-
|
12
|
-
# @see https://sandbox-api.flinks.io/Readme/#scheduling-background-refresh
|
13
|
-
# @param login_id [String]
|
14
|
-
# @return [Hash]
|
15
|
-
def deactivate_scheduled_refresh(login_id:)
|
16
|
-
patch("#{customer_id}/BankingServices/DeactivateScheduledRefresh/#{login_id}")
|
17
|
-
end
|
18
6
|
|
19
7
|
# @see https://sandbox-api.flinks.io/Readme/#scheduling-background-refresh
|
20
8
|
# @param activated [Boolean]
|
data/lib/flinks/api/statement.rb
CHANGED
data/lib/flinks/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support'
|
2
4
|
require 'active_support/core_ext/object'
|
3
5
|
require 'dry-initializer'
|
@@ -25,6 +27,7 @@ module Flinks
|
|
25
27
|
option :user_agent, default: proc { "Flinks Ruby Gem" }
|
26
28
|
option :on_error, default: proc { proc {} }
|
27
29
|
option :debug, default: proc { false }
|
30
|
+
option :raw, default: proc { false }
|
28
31
|
|
29
32
|
|
30
33
|
private
|
data/lib/flinks/error.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Flinks
|
2
4
|
class Error < StandardError
|
3
5
|
attr_reader :response, :code
|
@@ -6,7 +8,8 @@ module Flinks
|
|
6
8
|
# @return [Flinks::Error]
|
7
9
|
def self.from_response(response)
|
8
10
|
klass = case response.code
|
9
|
-
when
|
11
|
+
when 202 then error_for_202(response)
|
12
|
+
when 400 then error_for_400(response)
|
10
13
|
when 401 then Flinks::Unauthorized
|
11
14
|
when 403 then error_for_403(response)
|
12
15
|
when 404 then Flinks::NotFound
|
@@ -28,6 +31,26 @@ module Flinks
|
|
28
31
|
klass.new(response)
|
29
32
|
end
|
30
33
|
|
34
|
+
# @param response [HTTP::Response]
|
35
|
+
# @return [Flinks::Error]
|
36
|
+
def self.error_for_202(response)
|
37
|
+
if response.parse['FlinksCode'] == 'OPERATION_PENDING'
|
38
|
+
Flinks::OperationPending
|
39
|
+
else
|
40
|
+
Flinks::OperationDispatched
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param response [HTTP::Response]
|
45
|
+
# @return [Flinks::Error]
|
46
|
+
def self.error_for_400(response)
|
47
|
+
if response.parse['FlinksCode'] == 'SESSION_NONEXISTENT'
|
48
|
+
Flinks::SessionNonexistent
|
49
|
+
else
|
50
|
+
Flinks::BadRequest
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
31
54
|
# @param response [HTTP::Response]
|
32
55
|
# @return [Flinks::Error]
|
33
56
|
def self.error_for_403(response)
|
@@ -56,12 +79,21 @@ module Flinks
|
|
56
79
|
end
|
57
80
|
end
|
58
81
|
|
82
|
+
# Raised when API returns a 202 HTTP status code
|
83
|
+
class OperationPending < Error; end
|
84
|
+
|
85
|
+
# Raised when API returns a 202 HTTP status code
|
86
|
+
class OperationDispatched < Error; end
|
87
|
+
|
59
88
|
# Raised when API returns a 400..499 HTTP status code
|
60
89
|
class ClientError < Error; end
|
61
90
|
|
62
91
|
# Raised when API returns a 400 HTTP status code
|
63
92
|
class BadRequest < ClientError; end
|
64
93
|
|
94
|
+
# Raised when API returns a 400 HTTP status code
|
95
|
+
class SessionNonexistent < ClientError; end
|
96
|
+
|
65
97
|
# Raised when API returns a 401 HTTP status code
|
66
98
|
class Unauthorized < ClientError; end
|
67
99
|
|
data/lib/flinks/request.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support/core_ext/hash/indifferent_access'
|
2
4
|
require 'http'
|
3
5
|
|
@@ -72,7 +74,9 @@ module Flinks
|
|
72
74
|
data = response.parse
|
73
75
|
|
74
76
|
# Transform data
|
75
|
-
|
77
|
+
unless raw
|
78
|
+
data.deep_transform_keys { |k| k.underscore }.with_indifferent_access
|
79
|
+
end
|
76
80
|
end
|
77
81
|
end
|
78
82
|
end
|
@@ -55,7 +55,7 @@ describe Flinks::API::Authorize do
|
|
55
55
|
|
56
56
|
it "raises an error" do
|
57
57
|
expect {
|
58
|
-
client.
|
58
|
+
client.authorize(login_id: login_id, options: options)
|
59
59
|
}.to raise_error(ArgumentError)
|
60
60
|
end
|
61
61
|
end
|
@@ -115,4 +115,43 @@ describe Flinks::API::Authorize do
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
118
|
+
|
119
|
+
describe '#authorize_multiple' do
|
120
|
+
let(:login_ids) { ['login_id_1', 'login_id_2'] }
|
121
|
+
|
122
|
+
before do
|
123
|
+
stub_request(:post, /#{api_endpoint}/)
|
124
|
+
.to_return(status: 200, body: "{}", headers: { 'Content-Type'=>'application/json' })
|
125
|
+
end
|
126
|
+
|
127
|
+
it "returns an object" do
|
128
|
+
expect(client.authorize_multiple(login_ids: login_ids)).to be_a(Hash)
|
129
|
+
end
|
130
|
+
|
131
|
+
context "with valid options" do
|
132
|
+
let(:options) do
|
133
|
+
{
|
134
|
+
most_recent_cached: true,
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
138
|
+
it "returns an object" do
|
139
|
+
expect(client.authorize_multiple(login_ids: login_ids, options: options)).to be_a(Hash)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
context "with invalid options" do
|
144
|
+
let(:options) do
|
145
|
+
{
|
146
|
+
most_recent_cached: 'invalid'
|
147
|
+
}
|
148
|
+
end
|
149
|
+
|
150
|
+
it "raises an error" do
|
151
|
+
expect {
|
152
|
+
client.authorize_multiple(login_ids: login_ids, options: options)
|
153
|
+
}.to raise_error(ArgumentError)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
118
157
|
end
|
@@ -5,28 +5,6 @@ describe Flinks::API::Refresh do
|
|
5
5
|
let(:client) { Flinks.new(customer_id: 'customer_id') }
|
6
6
|
let(:login_id) { 'login_id' }
|
7
7
|
|
8
|
-
describe '#activate_scheduled_refresh' do
|
9
|
-
before do
|
10
|
-
stub_request(:patch, /#{api_endpoint}/)
|
11
|
-
.to_return(status: 200, body: "{}", headers: { 'Content-Type'=>'application/json' })
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns an object" do
|
15
|
-
expect(client.activate_scheduled_refresh(login_id: login_id)).to be_a(Hash)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#deactivate_scheduled_refresh' do
|
20
|
-
before do
|
21
|
-
stub_request(:patch, /#{api_endpoint}/)
|
22
|
-
.to_return(status: 200, body: "{}", headers: { 'Content-Type'=>'application/json' })
|
23
|
-
end
|
24
|
-
|
25
|
-
it "returns an object" do
|
26
|
-
expect(client.deactivate_scheduled_refresh(login_id: login_id)).to be_a(Hash)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
8
|
describe '#set_scheduled_refresh' do
|
31
9
|
before do
|
32
10
|
stub_request(:patch, /#{api_endpoint}/)
|
data/spec/lib/client_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philippe Dionne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
218
|
version: '0'
|
219
219
|
requirements: []
|
220
220
|
rubyforge_project:
|
221
|
-
rubygems_version: 2.7.
|
221
|
+
rubygems_version: 2.7.6
|
222
222
|
signing_key:
|
223
223
|
specification_version: 4
|
224
224
|
summary: Flinks API client
|