flinks 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Flinks::API::Card do
4
+ let(:api_endpoint) { Flinks::Client.dry_initializer.definitions[:api_endpoint].default.call }
5
+ let(:client) { Flinks.new(customer_id: 'customer_id') }
6
+ let(:card_id) { 'card_id' }
7
+
8
+ describe '#delete_card' do
9
+ before do
10
+ stub_request(:get, /#{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.delete_card(card_id: card_id)).to be_a(Hash)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe Flinks::API::Refresh do
4
+ let(:api_endpoint) { Flinks::Client.dry_initializer.definitions[:api_endpoint].default.call }
5
+ let(:client) { Flinks.new(customer_id: 'customer_id') }
6
+ let(:login_id) { 'login_id' }
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
+ describe '#set_scheduled_refresh' do
31
+ before do
32
+ stub_request(:patch, /#{api_endpoint}/)
33
+ .to_return(status: 200, body: "{}", headers: { 'Content-Type'=>'application/json' })
34
+ end
35
+
36
+ it "returns an object" do
37
+ expect(client.set_scheduled_refresh(true, login_id: login_id)).to be_a(Hash)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe Flinks::API::Statement do
4
+ let(:api_endpoint) { Flinks::Client.dry_initializer.definitions[:api_endpoint].default.call }
5
+ let(:client) { Flinks.new(customer_id: 'customer_id') }
6
+ let(:request_id) { 'request_id' }
7
+
8
+ describe '#statements' do
9
+ before do
10
+ stub_request(:post, /#{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.statements).to be_a(Hash)
16
+ end
17
+
18
+ context "with valid options" do
19
+ let(:options) do
20
+ {
21
+ accounts_filter: ['string'],
22
+ number_of_statements: 'MostRecent',
23
+ most_recent: true,
24
+ most_recent_cached: true
25
+ }
26
+ end
27
+
28
+ it "returns an object" do
29
+ expect(client.statements(options: options)).to be_a(Hash)
30
+ end
31
+ end
32
+
33
+ context "with invalid options" do
34
+ let(:options) do
35
+ {
36
+ accounts_filter: 'invalid',
37
+ number_of_statements: 'invalid',
38
+ most_recent: 'invalid',
39
+ most_recent_cached: 'invalid'
40
+ }
41
+ end
42
+
43
+ it "raises an error" do
44
+ expect {
45
+ client.statements(options: options)
46
+ }.to raise_error(ArgumentError)
47
+ end
48
+ end
49
+ end
50
+
51
+ describe '#statements_async' do
52
+ before do
53
+ stub_request(:get, /#{api_endpoint}/)
54
+ .to_return(status: 200, body: "{}", headers: { 'Content-Type'=>'application/json' })
55
+ end
56
+
57
+ it "returns an object" do
58
+ expect(client.statements_async(request_id: request_id)).to be_a(Hash)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Flinks::Client do
4
+
5
+ describe "#initialize" do
6
+ it "without required arguments" do
7
+ expect { Flinks::Client.new }.to raise_error KeyError
8
+ end
9
+
10
+ it "with required arguments" do
11
+ client = Flinks::Client.new(customer_id: 'token')
12
+ expect(client.customer_id).to eq('token')
13
+ end
14
+
15
+ it "sets defaults" do
16
+ client = Flinks::Client.new(customer_id: 'token')
17
+ expect(client.api_endpoint).not_to be_nil
18
+ expect(client.user_agent).not_to be_nil
19
+ expect(client.on_error).not_to be_nil
20
+ expect(client.debug).not_to be_nil
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,12 @@
1
+ require 'rspec'
2
+ require 'webmock/rspec'
3
+
4
+ require 'flinks'
5
+
6
+ Dir[File.dirname(__FILE__) + '/shared/**/*.rb'].each { |file| require file }
7
+
8
+ RSpec.configure do |config|
9
+ config.filter_run focus: true
10
+ config.filter_run_excluding skip: true
11
+ config.run_all_when_everything_filtered = true
12
+ end
metadata ADDED
@@ -0,0 +1,236 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flinks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Philippe Dionne
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: http
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dry-validation
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.11'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-inflector
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dry-initializer
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.4'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: shoulda
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rdoc
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.12'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.12'
125
+ - !ruby/object:Gem::Dependency
126
+ name: bundler
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: juwelier
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 2.1.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 2.1.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: webmock
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ description: Flinks financial services API client
182
+ email: dionne.phil@gmail.com
183
+ executables: []
184
+ extensions: []
185
+ extra_rdoc_files:
186
+ - LICENSE.txt
187
+ - README.md
188
+ files:
189
+ - ".document"
190
+ - Gemfile
191
+ - Gemfile.lock
192
+ - LICENSE.txt
193
+ - README.md
194
+ - Rakefile
195
+ - VERSION
196
+ - flinks.gemspec
197
+ - lib/flinks.rb
198
+ - lib/flinks/api/account.rb
199
+ - lib/flinks/api/card.rb
200
+ - lib/flinks/api/refresh.rb
201
+ - lib/flinks/api/statement.rb
202
+ - lib/flinks/client.rb
203
+ - lib/flinks/error.rb
204
+ - lib/flinks/request.rb
205
+ - lib/flinks/version.rb
206
+ - spec/lib/api/account.rb
207
+ - spec/lib/api/card.rb
208
+ - spec/lib/api/refresh.rb
209
+ - spec/lib/api/statement.rb
210
+ - spec/lib/client_spec.rb
211
+ - spec/spec_helper.rb
212
+ homepage: http://github.com/phildionne/flinks
213
+ licenses:
214
+ - MIT
215
+ metadata: {}
216
+ post_install_message:
217
+ rdoc_options: []
218
+ require_paths:
219
+ - lib
220
+ required_ruby_version: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: '0'
225
+ required_rubygems_version: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ requirements: []
231
+ rubyforge_project:
232
+ rubygems_version: 2.7.3
233
+ signing_key:
234
+ specification_version: 4
235
+ summary: Flinks API client
236
+ test_files: []