yodlicious 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,237 @@
1
+ require "yodlicious"
2
+ require "yodlicious/config"
3
+
4
+ describe Yodlicious::YodleeApi do
5
+
6
+ context 'Given a new uninitialized YodleeApi objecvt' do
7
+ before {
8
+ Yodlicious::Config.base_url=nil
9
+ Yodlicious::Config.cobranded_username=nil
10
+ Yodlicious::Config.cobranded_password=nil
11
+ Yodlicious::Config.proxy_url=nil
12
+ }
13
+ subject { Yodlicious::YodleeApi.new }
14
+
15
+ it 'should return nil for cobranded_auth' do
16
+ expect(subject.cobranded_auth).to be_nil
17
+ end
18
+
19
+ it 'should return nil for user_auth' do
20
+ expect(subject.user_auth).to be_nil
21
+ end
22
+
23
+ it 'should return nil for session_token' do
24
+ expect(subject.cobranded_session_token).to be_nil
25
+ end
26
+
27
+ it 'should return nil for user_session_token' do
28
+ expect(subject.user_session_token).to be_nil
29
+ end
30
+
31
+ it 'should return a translator' do
32
+ expect(subject.translator).not_to be_nil
33
+ end
34
+ end
35
+
36
+ context 'Given a Yodlicious::Config with nil configuration' do
37
+ context 'When a new YodleeApi instance is created with no configuration' do
38
+ before {
39
+ Yodlicious::Config.base_url=nil
40
+ Yodlicious::Config.cobranded_username=nil
41
+ Yodlicious::Config.cobranded_password=nil
42
+ Yodlicious::Config.proxy_url=nil
43
+ }
44
+ subject { Yodlicious::YodleeApi.new }
45
+
46
+ it 'no base_url set' do
47
+ expect(subject.base_url).to be_nil
48
+ end
49
+
50
+ it 'no cobranded_username is set' do
51
+ expect(subject.cobranded_username).to be_nil
52
+ end
53
+
54
+ it 'no cobranded_password is set' do
55
+ expect(subject.cobranded_password).to be_nil
56
+ end
57
+
58
+ it 'no proxy_url is set' do
59
+ expect(subject.proxy_url).to be_nil
60
+ end
61
+
62
+ it 'empty proxy_opts are created' do
63
+ expect(subject.proxy_opts).to eq({})
64
+ end
65
+
66
+ it 'no socks proxy is used' do
67
+ expect(subject.use_socks?).to eq(false)
68
+ end
69
+ end
70
+ end
71
+
72
+ context 'Given a Yodlicious::Config with a configuration' do
73
+ context 'When a new YodleeApi instance is created with the global configuration set' do
74
+ before {
75
+ Yodlicious::Config.base_url='base url'
76
+ Yodlicious::Config.cobranded_username='user name'
77
+ Yodlicious::Config.cobranded_password='password'
78
+ Yodlicious::Config.proxy_url='socks5h://somehostname'
79
+ }
80
+ subject { Yodlicious::YodleeApi.new }
81
+
82
+ it 'base_url set' do
83
+ expect(subject.base_url).to eq('base url')
84
+ end
85
+
86
+ it 'cobranded_username is set' do
87
+ expect(subject.cobranded_username).to eq('user name')
88
+ end
89
+
90
+ it 'cobranded_password is set' do
91
+ expect(subject.cobranded_password).to eq('password')
92
+ end
93
+
94
+ it 'proxy_url is set' do
95
+ expect(subject.proxy_url).to eq('socks5h://somehostname')
96
+ end
97
+
98
+ it 'proxy_opts are created' do
99
+ expect(subject.proxy_opts).to eq({ socks: true, uri: URI.parse('socks5h://somehostname') })
100
+ end
101
+
102
+ it 'socks proxy is used' do
103
+ expect(subject.use_socks?).to eq(true)
104
+ end
105
+ end
106
+ end
107
+
108
+ context 'Given a Yodlicious::Config with nil configuration' do
109
+ context 'When a new YodleeApi instance is created and provided a configuration' do
110
+ before {
111
+ Yodlicious::Config.base_url=nil
112
+ Yodlicious::Config.cobranded_username=nil
113
+ Yodlicious::Config.cobranded_password=nil
114
+ Yodlicious::Config.proxy_url=nil
115
+ }
116
+ let(:config) {
117
+ {
118
+ base_url: "https://rest.developer.yodlee.com/services/srest/restserver/v1.0",
119
+ cobranded_username: "some_username",
120
+ cobranded_password: "some_password",
121
+ proxy_url: "socks5h://127.0.0.1:1080"
122
+ }
123
+ }
124
+
125
+ subject { Yodlicious::YodleeApi.new(config) }
126
+
127
+ it 'the provided base url is set' do
128
+ expect(subject.base_url).to eq(config[:base_url])
129
+ end
130
+
131
+ it 'the provided cobranded_username is set' do
132
+ expect(subject.cobranded_username).to eq(config[:cobranded_username])
133
+ end
134
+
135
+ it 'the provided cobranded_password is set' do
136
+ expect(subject.cobranded_password).to eq(config[:cobranded_password])
137
+ end
138
+
139
+ it 'the provided proxy_url is set' do
140
+ expect(subject.proxy_url).to eq(config[:proxy_url])
141
+ end
142
+
143
+ it 'the provided proxy_opts are created' do
144
+ proxy_opts = {
145
+ socks: true,
146
+ uri: URI.parse(config[:proxy_url])
147
+ }
148
+ expect(subject.proxy_opts).to eq(proxy_opts)
149
+ end
150
+
151
+ it 'the provided socks proxy is used' do
152
+ expect(subject.use_socks?).to eq(true)
153
+ end
154
+ end
155
+ end
156
+
157
+ context 'Given a Yodlicious::Config with set config values' do
158
+ context 'When a new YodleeApi instance is created and provided a configuration' do
159
+ before {
160
+ Yodlicious::Config.base_url='base url'
161
+ Yodlicious::Config.cobranded_username='user name'
162
+ Yodlicious::Config.cobranded_password='password'
163
+ Yodlicious::Config.proxy_url='socks5h://somehostname'
164
+ }
165
+ let(:config) {
166
+ {
167
+ base_url: "https://rest.developer.yodlee.com/services/srest/restserver/v1.0",
168
+ cobranded_username: "some_username",
169
+ cobranded_password: "some_password",
170
+ proxy_url: "socks5h://127.0.0.1:1080"
171
+ }
172
+ }
173
+
174
+ subject { Yodlicious::YodleeApi.new(config) }
175
+
176
+ it 'the provided base url is set' do
177
+ expect(subject.base_url).to eq(config[:base_url])
178
+ end
179
+
180
+ it 'the provided cobranded_username is set' do
181
+ expect(subject.cobranded_username).to eq(config[:cobranded_username])
182
+ end
183
+
184
+ it 'the provided cobranded_password is set' do
185
+ expect(subject.cobranded_password).to eq(config[:cobranded_password])
186
+ end
187
+
188
+ it 'the provided proxy_url is set' do
189
+ expect(subject.proxy_url).to eq(config[:proxy_url])
190
+ end
191
+
192
+ it 'the provided proxy_opts are created' do
193
+ proxy_opts = {
194
+ socks: true,
195
+ uri: URI.parse(config[:proxy_url])
196
+ }
197
+ expect(subject.proxy_opts).to eq(proxy_opts)
198
+ end
199
+
200
+ it 'the provided socks proxy is used' do
201
+ expect(subject.use_socks?).to eq(true)
202
+ end
203
+ end
204
+ end
205
+
206
+ context 'Given a Yodlicious::Config with nil config values' do
207
+ context 'When a new YodleeApi instance is configured with no proxy_url' do
208
+ before {
209
+ Yodlicious::Config.base_url=nil
210
+ Yodlicious::Config.cobranded_username=nil
211
+ Yodlicious::Config.cobranded_password=nil
212
+ Yodlicious::Config.proxy_url=nil
213
+ }
214
+ let(:config) {
215
+ {
216
+ base_url: "https://rest.developer.yodlee.com/services/srest/restserver/v1.0",
217
+ cobranded_username: "some_username",
218
+ cobranded_password: "some_password"
219
+ }
220
+ }
221
+
222
+ subject { Yodlicious::YodleeApi.new(config) }
223
+
224
+ it 'no proxy_url is set' do
225
+ expect(subject.proxy_url).to be_nil
226
+ end
227
+
228
+ it 'no proxy_opts are created' do
229
+ expect(subject.proxy_opts).to eq({})
230
+ end
231
+
232
+ it 'the socks proxy is not used' do
233
+ expect(subject.use_socks?).to eq(false)
234
+ end
235
+ end
236
+ end
237
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'yodlicious/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "yodlicious"
8
+ spec.version = Yodlicious::VERSION
9
+ spec.authors = ["Drew Nichols"]
10
+ spec.email = ["drew@liftforward.com"]
11
+ spec.summary = "Yodlee API Client Gem"
12
+ spec.description = "Delicious Yodlee API Client Gem"
13
+ spec.homepage = "https://github.com/liftforward/yodlicious"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.2"
24
+
25
+ spec.add_runtime_dependency "faraday", '~> 0.9.1', '>= 0.9.1'
26
+ spec.add_runtime_dependency "socksify", '~> 1.6.0', '>= 1.6.0'
27
+
28
+ # gem 'faraday', '0.9.0'
29
+ # gem 'socksify', '1.5.0'
30
+
31
+ spec.required_ruby_version = '>= 1.9.3'
32
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yodlicious
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Drew Nichols
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: faraday
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.1
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.9.1
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: 0.9.1
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.9.1
75
+ - !ruby/object:Gem::Dependency
76
+ name: socksify
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 1.6.0
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 1.6.0
85
+ type: :runtime
86
+ prerelease: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: 1.6.0
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 1.6.0
95
+ description: Delicious Yodlee API Client Gem
96
+ email:
97
+ - drew@liftforward.com
98
+ executables: []
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - ".gitignore"
103
+ - ".rspec"
104
+ - Gemfile
105
+ - LICENSE.txt
106
+ - README.md
107
+ - Rakefile
108
+ - lib/yodlicious.rb
109
+ - lib/yodlicious/config.rb
110
+ - lib/yodlicious/parameter_translator.rb
111
+ - lib/yodlicious/response.rb
112
+ - lib/yodlicious/version.rb
113
+ - lib/yodlicious/yodlicious.rb
114
+ - spec/integration_spec.rb
115
+ - spec/spec_helper.rb
116
+ - spec/unit/config_spec.rb
117
+ - spec/unit/parameter_translator_spec.rb
118
+ - spec/unit/response_spec.rb
119
+ - spec/unit/yodlicious_spec.rb
120
+ - yodlicious.gemspec
121
+ homepage: https://github.com/liftforward/yodlicious
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: 1.9.3
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.2.2
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Yodlee API Client Gem
145
+ test_files:
146
+ - spec/integration_spec.rb
147
+ - spec/spec_helper.rb
148
+ - spec/unit/config_spec.rb
149
+ - spec/unit/parameter_translator_spec.rb
150
+ - spec/unit/response_spec.rb
151
+ - spec/unit/yodlicious_spec.rb