stew 0.5.3 → 0.6.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.
Files changed (42) hide show
  1. checksums.yaml +6 -6
  2. data/.gitignore +1 -0
  3. data/lib/stew.rb +6 -9
  4. data/lib/stew/community/profile.rb +2 -2
  5. data/lib/stew/community/profile_friends.rb +1 -1
  6. data/lib/stew/community/profile_game.rb +23 -6
  7. data/lib/stew/community/steam_id.rb +6 -21
  8. data/lib/stew/community/steam_id_resolver.rb +34 -0
  9. data/lib/stew/community/web_api_client.rb +29 -0
  10. data/lib/stew/community/web_client.rb +29 -0
  11. data/lib/stew/version.rb +1 -1
  12. data/spec/config.yml.example +1 -0
  13. data/spec/fixtures/profiles/76561197992917668.json +24 -0
  14. data/spec/fixtures/profiles/friends/76561197992917668.json +167 -0
  15. data/spec/fixtures/profiles/friends/76561197994486912.json +8 -0
  16. data/spec/fixtures/profiles/games/76561197992917668.json +789 -0
  17. data/spec/fixtures/profiles/games/76561197994486912.json +5 -0
  18. data/spec/fixtures/profiles/vanity/Phucked.json +6 -0
  19. data/spec/integration/community_web_api_integration_spec.rb +32 -0
  20. data/spec/lib/stew/community/profile_friends_spec.rb +3 -24
  21. data/spec/lib/stew/community/profile_game_spec.rb +20 -12
  22. data/spec/lib/stew/community/profile_games_spec.rb +2 -3
  23. data/spec/lib/stew/community/profile_spec.rb +2 -2
  24. data/spec/lib/stew/community/steam_id_resolver_spec.rb +82 -0
  25. data/spec/lib/stew/community/steam_id_spec.rb +22 -83
  26. data/spec/lib/stew/community/web_api_client_spec.rb +61 -0
  27. data/spec/lib/stew/community/web_client_spec.rb +17 -0
  28. data/spec/spec_helper.rb +12 -0
  29. data/stew.gemspec +7 -5
  30. metadata +98 -92
  31. data/lib/stew/community/community_client.rb +0 -53
  32. data/lib/stew/community/xml_client/xml_client.rb +0 -50
  33. data/lib/stew/community/xml_client/xml_client_response_friends.rb +0 -20
  34. data/lib/stew/community/xml_client/xml_client_response_games.rb +0 -20
  35. data/lib/stew/community/xml_client/xml_client_response_profile.rb +0 -14
  36. data/spec/fixtures/profiles/friends/76561197992917668.yml +0 -36
  37. data/spec/fixtures/profiles/friends/76561197994486912.yml +0 -5
  38. data/spec/fixtures/profiles/games/76561197992917668.yml +0 -616
  39. data/spec/fixtures/profiles/games/76561197994486912.yml +0 -5
  40. data/spec/integration/community_integration_spec.rb +0 -50
  41. data/spec/lib/stew/community/community_client_spec.rb +0 -118
  42. data/spec/lib/stew/community/xml_client/xml_client_spec.rb +0 -36
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Stew::Community::WebClient do
4
+ let(:base_uri){"http://api.steampowered.com"}
5
+
6
+ subject{Stew::Community::WebClient.new(base_uri)}
7
+
8
+ describe ".get" do
9
+ it "performs a request to the expected URL and returns the results" do
10
+ steam_id = 12345
11
+ uri = "/ISteamUser/GetPlayerSummaries/v0002/?key=#{STEAM_API_KEY}&steamids=#{steam_id}"
12
+ stub = stub_request(:get, "http://api.steampowered.com#{uri}")
13
+ subject.get(uri)
14
+ stub.should have_been_requested
15
+ end
16
+ end
17
+ end
@@ -8,6 +8,18 @@ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
8
8
 
9
9
  SimpleCov.start
10
10
 
11
+
12
+ if File.exists?("spec/config.yml") == false
13
+ puts "Error. Please make sure that 'spec/config.yml' exists with the correct values before running the specs. See example file"
14
+ exit
15
+ end
16
+
17
+ config = YAML::load_file("spec/config.yml")
18
+ STEAM_API_KEY = config['steam_api_key']
19
+
20
+ Stew::configure({steam_api_key: STEAM_API_KEY})
21
+
22
+
11
23
  RSpec.configure do |config|
12
24
  config.treat_symbols_as_metadata_keys_with_true_values = true
13
25
  config.run_all_when_everything_filtered = true
@@ -17,6 +17,13 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
+ gem.add_runtime_dependency 'multi_xml'
21
+ gem.add_runtime_dependency 'nokogiri', '>= 1.5.0'
22
+ gem.add_runtime_dependency 'faraday', '>= 0.8.6'
23
+ gem.add_runtime_dependency 'faraday_middleware', '>= 0.9.0'
24
+ gem.add_runtime_dependency 'money', '>= 5.1.0'
25
+
26
+
20
27
  gem.add_development_dependency 'rspec'
21
28
  gem.add_development_dependency 'guard'
22
29
  gem.add_development_dependency 'guard-rspec'
@@ -30,9 +37,4 @@ Gem::Specification.new do |gem|
30
37
  gem.add_development_dependency 'yard'
31
38
  gem.add_development_dependency 'rdiscount'
32
39
 
33
- gem.add_runtime_dependency 'multi_xml'
34
- gem.add_runtime_dependency 'nokogiri'
35
- gem.add_runtime_dependency 'faraday'
36
- gem.add_runtime_dependency 'faraday_middleware'
37
- gem.add_runtime_dependency 'money'
38
40
  end
metadata CHANGED
@@ -1,251 +1,251 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Magnus Skog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-08 00:00:00.000000000 Z
11
+ date: 2013-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: multi_xml
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :development
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: guard
28
+ name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
33
+ version: 1.5.0
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 1.5.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: guard-rspec
42
+ name: faraday
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
47
+ version: 0.8.6
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.8.6
55
55
  - !ruby/object:Gem::Dependency
56
- name: vcr
56
+ name: faraday_middleware
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
61
+ version: 0.9.0
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.9.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: webmock
70
+ name: money
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
75
+ version: 5.1.0
76
+ type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 5.1.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: ci_reporter
84
+ name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rake
98
+ name: guard
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: simplecov
112
+ name: guard-rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
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
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: simplecov-rcov
126
+ name: vcr
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ! '>='
129
+ - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ! '>='
136
+ - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: rb-inotify
140
+ name: webmock
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ! '>='
143
+ - - '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ! '>='
150
+ - - '>='
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: yard
154
+ name: ci_reporter
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ! '>='
157
+ - - '>='
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ! '>='
164
+ - - '>='
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
- name: rdiscount
168
+ name: rake
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ! '>='
171
+ - - '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ! '>='
178
+ - - '>='
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
- name: multi_xml
182
+ name: simplecov
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ! '>='
185
+ - - '>='
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
- type: :runtime
188
+ type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ! '>='
192
+ - - '>='
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
- name: nokogiri
196
+ name: simplecov-rcov
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ! '>='
199
+ - - '>='
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
- type: :runtime
202
+ type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ! '>='
206
+ - - '>='
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  - !ruby/object:Gem::Dependency
210
- name: faraday
210
+ name: rb-inotify
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - ! '>='
213
+ - - '>='
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
- type: :runtime
216
+ type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - ! '>='
220
+ - - '>='
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  - !ruby/object:Gem::Dependency
224
- name: faraday_middleware
224
+ name: yard
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
- - - ! '>='
227
+ - - '>='
228
228
  - !ruby/object:Gem::Version
229
229
  version: '0'
230
- type: :runtime
230
+ type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - ! '>='
234
+ - - '>='
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  - !ruby/object:Gem::Dependency
238
- name: money
238
+ name: rdiscount
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - ! '>='
241
+ - - '>='
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
- type: :runtime
244
+ type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
- - - ! '>='
248
+ - - '>='
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
251
  description: Accesses the Steam Community API as well as the Store. Can show games
@@ -264,16 +264,14 @@ files:
264
264
  - README.md
265
265
  - Rakefile
266
266
  - lib/stew.rb
267
- - lib/stew/community/community_client.rb
268
267
  - lib/stew/community/profile.rb
269
268
  - lib/stew/community/profile_friends.rb
270
269
  - lib/stew/community/profile_game.rb
271
270
  - lib/stew/community/profile_games.rb
272
271
  - lib/stew/community/steam_id.rb
273
- - lib/stew/community/xml_client/xml_client.rb
274
- - lib/stew/community/xml_client/xml_client_response_friends.rb
275
- - lib/stew/community/xml_client/xml_client_response_games.rb
276
- - lib/stew/community/xml_client/xml_client_response_profile.rb
272
+ - lib/stew/community/steam_id_resolver.rb
273
+ - lib/stew/community/web_api_client.rb
274
+ - lib/stew/community/web_client.rb
277
275
  - lib/stew/store/app.rb
278
276
  - lib/stew/store/app_offer.rb
279
277
  - lib/stew/store/app_offer_sale.rb
@@ -284,13 +282,16 @@ files:
284
282
  - lib/stew/store/store_client.rb
285
283
  - lib/stew/store/web_client.rb
286
284
  - lib/stew/version.rb
285
+ - spec/config.yml.example
287
286
  - spec/fixtures/profiles/4d.txt
287
+ - spec/fixtures/profiles/76561197992917668.json
288
288
  - spec/fixtures/profiles/76561197992917668.txt
289
289
  - spec/fixtures/profiles/76561197992917668.yml
290
- - spec/fixtures/profiles/friends/76561197992917668.yml
291
- - spec/fixtures/profiles/friends/76561197994486912.yml
292
- - spec/fixtures/profiles/games/76561197992917668.yml
293
- - spec/fixtures/profiles/games/76561197994486912.yml
290
+ - spec/fixtures/profiles/friends/76561197992917668.json
291
+ - spec/fixtures/profiles/friends/76561197994486912.json
292
+ - spec/fixtures/profiles/games/76561197992917668.json
293
+ - spec/fixtures/profiles/games/76561197994486912.json
294
+ - spec/fixtures/profiles/vanity/Phucked.json
294
295
  - spec/fixtures/store/apps/16870.txt
295
296
  - spec/fixtures/store/apps/211400_offers_sale.txt
296
297
  - spec/fixtures/store/apps/211400_sale.txt
@@ -306,16 +307,17 @@ files:
306
307
  - spec/fixtures/store/sales/sale.txt
307
308
  - spec/fixtures/store/sales/sales.txt
308
309
  - spec/integration/broken_sales_integration_spec.rb
309
- - spec/integration/community_integration_spec.rb
310
+ - spec/integration/community_web_api_integration_spec.rb
310
311
  - spec/integration/sales_integration_spec.rb
311
312
  - spec/integration/store_integration_spec.rb
312
- - spec/lib/stew/community/community_client_spec.rb
313
313
  - spec/lib/stew/community/profile_friends_spec.rb
314
314
  - spec/lib/stew/community/profile_game_spec.rb
315
315
  - spec/lib/stew/community/profile_games_spec.rb
316
316
  - spec/lib/stew/community/profile_spec.rb
317
+ - spec/lib/stew/community/steam_id_resolver_spec.rb
317
318
  - spec/lib/stew/community/steam_id_spec.rb
318
- - spec/lib/stew/community/xml_client/xml_client_spec.rb
319
+ - spec/lib/stew/community/web_api_client_spec.rb
320
+ - spec/lib/stew/community/web_client_spec.rb
319
321
  - spec/lib/stew/store/app_offer_sale_spec.rb
320
322
  - spec/lib/stew/store/app_offer_spec.rb
321
323
  - spec/lib/stew/store/app_offers_spec.rb
@@ -337,12 +339,12 @@ require_paths:
337
339
  - lib
338
340
  required_ruby_version: !ruby/object:Gem::Requirement
339
341
  requirements:
340
- - - ! '>='
342
+ - - '>='
341
343
  - !ruby/object:Gem::Version
342
344
  version: '0'
343
345
  required_rubygems_version: !ruby/object:Gem::Requirement
344
346
  requirements:
345
- - - ! '>='
347
+ - - '>='
346
348
  - !ruby/object:Gem::Version
347
349
  version: '0'
348
350
  requirements: []
@@ -352,13 +354,16 @@ signing_key:
352
354
  specification_version: 4
353
355
  summary: A client for the Steam Gaming service.
354
356
  test_files:
357
+ - spec/config.yml.example
355
358
  - spec/fixtures/profiles/4d.txt
359
+ - spec/fixtures/profiles/76561197992917668.json
356
360
  - spec/fixtures/profiles/76561197992917668.txt
357
361
  - spec/fixtures/profiles/76561197992917668.yml
358
- - spec/fixtures/profiles/friends/76561197992917668.yml
359
- - spec/fixtures/profiles/friends/76561197994486912.yml
360
- - spec/fixtures/profiles/games/76561197992917668.yml
361
- - spec/fixtures/profiles/games/76561197994486912.yml
362
+ - spec/fixtures/profiles/friends/76561197992917668.json
363
+ - spec/fixtures/profiles/friends/76561197994486912.json
364
+ - spec/fixtures/profiles/games/76561197992917668.json
365
+ - spec/fixtures/profiles/games/76561197994486912.json
366
+ - spec/fixtures/profiles/vanity/Phucked.json
362
367
  - spec/fixtures/store/apps/16870.txt
363
368
  - spec/fixtures/store/apps/211400_offers_sale.txt
364
369
  - spec/fixtures/store/apps/211400_sale.txt
@@ -374,16 +379,17 @@ test_files:
374
379
  - spec/fixtures/store/sales/sale.txt
375
380
  - spec/fixtures/store/sales/sales.txt
376
381
  - spec/integration/broken_sales_integration_spec.rb
377
- - spec/integration/community_integration_spec.rb
382
+ - spec/integration/community_web_api_integration_spec.rb
378
383
  - spec/integration/sales_integration_spec.rb
379
384
  - spec/integration/store_integration_spec.rb
380
- - spec/lib/stew/community/community_client_spec.rb
381
385
  - spec/lib/stew/community/profile_friends_spec.rb
382
386
  - spec/lib/stew/community/profile_game_spec.rb
383
387
  - spec/lib/stew/community/profile_games_spec.rb
384
388
  - spec/lib/stew/community/profile_spec.rb
389
+ - spec/lib/stew/community/steam_id_resolver_spec.rb
385
390
  - spec/lib/stew/community/steam_id_spec.rb
386
- - spec/lib/stew/community/xml_client/xml_client_spec.rb
391
+ - spec/lib/stew/community/web_api_client_spec.rb
392
+ - spec/lib/stew/community/web_client_spec.rb
387
393
  - spec/lib/stew/store/app_offer_sale_spec.rb
388
394
  - spec/lib/stew/store/app_offer_spec.rb
389
395
  - spec/lib/stew/store/app_offers_spec.rb