rsteamshot 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +35 -10
  4. data/lib/rsteamshot.rb +14 -0
  5. data/lib/rsteamshot/app.rb +126 -40
  6. data/lib/rsteamshot/configuration.rb +7 -0
  7. data/lib/rsteamshot/screenshot.rb +51 -0
  8. data/lib/rsteamshot/user.rb +23 -6
  9. data/lib/rsteamshot/version.rb +1 -1
  10. data/rsteamshot.gemspec +5 -0
  11. metadata +7 -56
  12. data/docs/README_md.html +0 -233
  13. data/docs/Rsteamshot.html +0 -147
  14. data/docs/Rsteamshot/App.html +0 -466
  15. data/docs/Rsteamshot/App/BadAppsFile.html +0 -106
  16. data/docs/Rsteamshot/Screenshot.html +0 -562
  17. data/docs/Rsteamshot/ScreenshotPage.html +0 -347
  18. data/docs/Rsteamshot/ScreenshotPaginator.html +0 -307
  19. data/docs/Rsteamshot/User.html +0 -309
  20. data/docs/created.rid +0 -9
  21. data/docs/css/fonts.css +0 -167
  22. data/docs/css/rdoc.css +0 -590
  23. data/docs/fonts/Lato-Light.ttf +0 -0
  24. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  25. data/docs/fonts/Lato-Regular.ttf +0 -0
  26. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  27. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  28. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  29. data/docs/images/add.png +0 -0
  30. data/docs/images/arrow_up.png +0 -0
  31. data/docs/images/brick.png +0 -0
  32. data/docs/images/brick_link.png +0 -0
  33. data/docs/images/bug.png +0 -0
  34. data/docs/images/bullet_black.png +0 -0
  35. data/docs/images/bullet_toggle_minus.png +0 -0
  36. data/docs/images/bullet_toggle_plus.png +0 -0
  37. data/docs/images/date.png +0 -0
  38. data/docs/images/delete.png +0 -0
  39. data/docs/images/find.png +0 -0
  40. data/docs/images/loadingAnimation.gif +0 -0
  41. data/docs/images/macFFBgHack.png +0 -0
  42. data/docs/images/package.png +0 -0
  43. data/docs/images/page_green.png +0 -0
  44. data/docs/images/page_white_text.png +0 -0
  45. data/docs/images/page_white_width.png +0 -0
  46. data/docs/images/plugin.png +0 -0
  47. data/docs/images/ruby.png +0 -0
  48. data/docs/images/tag_blue.png +0 -0
  49. data/docs/images/tag_green.png +0 -0
  50. data/docs/images/transparent.png +0 -0
  51. data/docs/images/wrench.png +0 -0
  52. data/docs/images/wrench_orange.png +0 -0
  53. data/docs/images/zoom.png +0 -0
  54. data/docs/index.html +0 -242
  55. data/docs/js/darkfish.js +0 -161
  56. data/docs/js/jquery.js +0 -4
  57. data/docs/js/navigation.js +0 -142
  58. data/docs/js/navigation.js.gz +0 -0
  59. data/docs/js/search.js +0 -109
  60. data/docs/js/search_index.js +0 -1
  61. data/docs/js/search_index.js.gz +0 -0
  62. data/docs/js/searcher.js +0 -229
  63. data/docs/js/searcher.js.gz +0 -0
  64. data/docs/table_of_contents.html +0 -179
@@ -1,466 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class Rsteamshot::App - RDoc Documentation</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- var index_rel_prefix = "../";
12
- </script>
13
-
14
- <script src="../js/jquery.js"></script>
15
- <script src="../js/darkfish.js"></script>
16
-
17
- <link href="../css/fonts.css" rel="stylesheet">
18
- <link href="../css/rdoc.css" rel="stylesheet">
19
-
20
-
21
-
22
- <body id="top" role="document" class="class">
23
- <nav role="navigation">
24
- <div id="project-navigation">
25
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
- <h2>
27
- <a href="../index.html" rel="home">Home</a>
28
- </h2>
29
-
30
- <div id="table-of-contents-navigation">
31
- <a href="../table_of_contents.html#pages">Pages</a>
32
- <a href="../table_of_contents.html#classes">Classes</a>
33
- <a href="../table_of_contents.html#methods">Methods</a>
34
- </div>
35
- </div>
36
-
37
- <div id="search-section" role="search" class="project-section initially-hidden">
38
- <form action="#" method="get" accept-charset="utf-8">
39
- <div id="search-field-wrapper">
40
- <input id="search-field" role="combobox" aria-label="Search"
41
- aria-autocomplete="list" aria-controls="search-results"
42
- type="text" name="search" placeholder="Search" spellcheck="false"
43
- title="Type to search, Up and Down to navigate, Enter to load">
44
- </div>
45
-
46
- <ul id="search-results" aria-label="Search Results"
47
- aria-busy="false" aria-expanded="false"
48
- aria-atomic="false" class="initially-hidden"></ul>
49
- </form>
50
- </div>
51
-
52
- </div>
53
-
54
-
55
-
56
- <div id="class-metadata">
57
- <div id="sections-section" class="nav-section">
58
- <h3>Sections</h3>
59
-
60
- <ul class="link-list" role="directory">
61
-
62
- <li><a href="#5Buntitled-5D"></a></li>
63
-
64
- <li><a href="#Public">Public</a></li>
65
-
66
- </ul>
67
- </div>
68
-
69
- <div id="parent-class-section" class="nav-section">
70
- <h3>Parent</h3>
71
-
72
-
73
- <p class="link">Object
74
-
75
- </div>
76
-
77
-
78
-
79
- <!-- Method Quickref -->
80
- <div id="method-list-section" class="nav-section">
81
- <h3>Methods</h3>
82
-
83
- <ul class="link-list" role="directory">
84
-
85
- <li ><a href="#method-c-download_apps_list">::download_apps_list</a>
86
-
87
- <li ><a href="#method-c-new">::new</a>
88
-
89
- <li ><a href="#method-c-search">::search</a>
90
-
91
- <li ><a href="#method-i-screenshots">#screenshots</a>
92
-
93
- </ul>
94
- </div>
95
-
96
- </div>
97
- </nav>
98
-
99
- <main role="main" aria-labelledby="class-Rsteamshot::App">
100
- <h1 id="class-Rsteamshot::App" class="class">
101
- class Rsteamshot::App
102
- </h1>
103
-
104
- <section class="description">
105
-
106
- <p>Represents a Steam app, like a video game. Used to fetch the screenshots
107
- that were taken in that app that Steam users have uploaded.</p>
108
-
109
- </section>
110
-
111
-
112
-
113
-
114
- <section id="5Buntitled-5D" class="documentation-section">
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
- </section>
125
-
126
-
127
-
128
- <section id="Public" class="documentation-section">
129
-
130
- <header class="documentation-section-title">
131
- <h2>
132
- Public
133
- </h2>
134
- <span class="section-click-top">
135
- <a href="#top">&uarr; top</a>
136
- </span>
137
- </header>
138
-
139
-
140
-
141
-
142
-
143
- <section class="constants-list">
144
- <header>
145
- <h3>Constants</h3>
146
- </header>
147
- <dl>
148
-
149
- <dt id="APPS_LIST_URL">APPS_LIST_URL
150
-
151
- <dd><p>The API URL to get a list of apps on Steam.</p>
152
-
153
-
154
- <dt id="MAX_PER_PAGE">MAX_PER_PAGE
155
-
156
- <dd><p>You can fetch this many screenshots at once.</p>
157
-
158
-
159
- <dt id="VALID_ORDERS">VALID_ORDERS
160
-
161
- <dd><p>How to sort screenshots when they are being retrieved.</p>
162
-
163
-
164
- </dl>
165
- </section>
166
-
167
-
168
-
169
- <section class="attribute-method-details" class="method-section">
170
- <header>
171
- <h3>Attributes</h3>
172
- </header>
173
-
174
-
175
- <div id="attribute-i-id" class="method-detail">
176
- <div class="method-heading attribute-method-heading">
177
- <span class="method-name">id</span><span
178
- class="attribute-access-type">[R]</span>
179
- </div>
180
-
181
- <div class="method-description">
182
-
183
- <h3 id="attribute-i-id-label-Returns">Returns<span><a href="#attribute-i-id-label-Returns">&para;</a> <a href="#top">&uarr;</a></span></h3>
184
-
185
- <p>Returns the ID of the Steam app as an Integer or String.</p>
186
-
187
- </div>
188
- </div>
189
-
190
- <div id="attribute-i-name" class="method-detail">
191
- <div class="method-heading attribute-method-heading">
192
- <span class="method-name">name</span><span
193
- class="attribute-access-type">[R]</span>
194
- </div>
195
-
196
- <div class="method-description">
197
-
198
- <h3 id="attribute-i-name-label-Returns">Returns<span><a href="#attribute-i-name-label-Returns">&para;</a> <a href="#top">&uarr;</a></span></h3>
199
-
200
- <p>Returns the String name of the Steam app, or nil.</p>
201
-
202
- </div>
203
- </div>
204
-
205
- </section>
206
-
207
-
208
-
209
- <section id="public-class-Public-method-details" class="method-section">
210
- <header>
211
- <h3>Public Class Methods</h3>
212
- </header>
213
-
214
-
215
- <div id="method-c-download_apps_list" class="method-detail ">
216
-
217
- <div class="method-heading">
218
- <span class="method-name">download_apps_list</span><span
219
- class="method-args">(path)</span>
220
-
221
- <span class="method-click-advice">click to toggle source</span>
222
-
223
- </div>
224
-
225
-
226
- <div class="method-description">
227
-
228
- <p>Writes a JSON file at the given location with the latest list of apps on
229
- Steam.</p>
230
- <dl class="rdoc-list note-list"><dt>path
231
- <dd>
232
- <p>a String file path</p>
233
- </dd></dl>
234
-
235
- <h3 id="method-c-download_apps_list-label-Returns">Returns<span><a href="#method-c-download_apps_list-label-Returns">&para;</a> <a href="#top">&uarr;</a></span></h3>
236
-
237
- <p>Returns nothing.</p>
238
-
239
-
240
-
241
-
242
- <div class="method-source-code" id="download_apps_list-source">
243
- <pre><span class="ruby-comment"># File lib/rsteamshot/app.rb, line 30</span>
244
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">download_apps_list</span>(<span class="ruby-identifier">path</span>)
245
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">path</span>, <span class="ruby-string">&#39;w&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
246
- <span class="ruby-constant">IO</span>.<span class="ruby-identifier">copy_stream</span>(<span class="ruby-identifier">open</span>(<span class="ruby-constant">APPS_LIST_URL</span>), <span class="ruby-identifier">file</span>)
247
- <span class="ruby-keyword">end</span>
248
- <span class="ruby-keyword">end</span></pre>
249
- </div>
250
-
251
- </div>
252
-
253
-
254
-
255
-
256
- </div>
257
-
258
-
259
- <div id="method-c-new" class="method-detail ">
260
-
261
- <div class="method-heading">
262
- <span class="method-name">new</span><span
263
- class="method-args">(attrs = {})</span>
264
-
265
- <span class="method-click-advice">click to toggle source</span>
266
-
267
- </div>
268
-
269
-
270
- <div class="method-description">
271
-
272
- <p>Initialize a Steam app with the given attributes.</p>
273
- <dl class="rdoc-list note-list"><dt>attrs
274
- <dd>
275
- <p>the Hash of attributes for this app</p>
276
- <dl class="rdoc-list note-list"><dt>:id
277
- <dd>
278
- <p>the String or Integer app ID</p>
279
- </dd><dt>:name
280
- <dd>
281
- <p>the String name of the app</p>
282
- </dd><dt>:per_page
283
- <dd>
284
- <p>how many results to get in each page; defaults to 10; valid range: 1-50;
285
- Integer</p>
286
- </dd></dl>
287
- </dd></dl>
288
-
289
-
290
-
291
-
292
- <div class="method-source-code" id="new-source">
293
- <pre><span class="ruby-comment"># File lib/rsteamshot/app.rb, line 89</span>
294
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attrs</span> = {})
295
- <span class="ruby-identifier">per_page</span> = <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:per_page</span>)
296
-
297
- <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">&quot;@#{key}&quot;</span>, <span class="ruby-identifier">value</span>) }
298
-
299
- <span class="ruby-identifier">process_html</span> = <span class="ruby-operator">-</span><span class="ruby-operator">&gt;</span>(<span class="ruby-identifier">html</span>) <span class="ruby-keyword">do</span>
300
- <span class="ruby-identifier">cards_from</span>(<span class="ruby-identifier">html</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">card</span><span class="ruby-operator">|</span> <span class="ruby-identifier">screenshot_from</span>(<span class="ruby-identifier">card</span>) }
301
- <span class="ruby-keyword">end</span>
302
- <span class="ruby-ivar">@paginator</span> = <span class="ruby-constant">ScreenshotPaginator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">process_html</span>, <span class="ruby-identifier">max_per_page</span><span class="ruby-operator">:</span> <span class="ruby-constant">MAX_PER_PAGE</span>,
303
- <span class="ruby-identifier">per_page</span><span class="ruby-operator">:</span> <span class="ruby-identifier">per_page</span>, <span class="ruby-identifier">steam_per_page</span><span class="ruby-operator">:</span> <span class="ruby-identifier">per_page</span>)
304
- <span class="ruby-keyword">end</span></pre>
305
- </div>
306
-
307
- </div>
308
-
309
-
310
-
311
-
312
- </div>
313
-
314
-
315
- <div id="method-c-search" class="method-detail ">
316
-
317
- <div class="method-heading">
318
- <span class="method-name">search</span><span
319
- class="method-args">(raw_query, apps_list_path)</span>
320
-
321
- <span class="method-click-advice">click to toggle source</span>
322
-
323
- </div>
324
-
325
-
326
- <div class="method-description">
327
-
328
- <p>Find Steam apps by name.</p>
329
- <dl class="rdoc-list note-list"><dt>raw_query
330
- <dd>
331
- <p>a String search query for an app or game on Steam</p>
332
- </dd><dt>apps_list_path
333
- <dd>
334
- <p>a String file path to the JSON file produced by download_apps_list</p>
335
- </dd></dl>
336
-
337
- <h3 id="method-c-search-label-Returns">Returns<span><a href="#method-c-search-label-Returns">&para;</a> <a href="#top">&uarr;</a></span></h3>
338
-
339
- <p>Returns an Array of Rsteamshot::Apps.</p>
340
-
341
-
342
-
343
-
344
- <div class="method-source-code" id="search-source">
345
- <pre><span class="ruby-comment"># File lib/rsteamshot/app.rb, line 42</span>
346
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">search</span>(<span class="ruby-identifier">raw_query</span>, <span class="ruby-identifier">apps_list_path</span>)
347
- <span class="ruby-keyword">return</span> [] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">raw_query</span>
348
-
349
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">apps_list_path</span>
350
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadAppsFile</span>, <span class="ruby-string">&#39;no path given to JSON apps list from Steam&#39;</span>
351
- <span class="ruby-keyword">end</span>
352
-
353
- <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">apps_list_path</span>)
354
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadAppsFile</span>, <span class="ruby-node">&quot;#{apps_list_path} is not a file&quot;</span>
355
- <span class="ruby-keyword">end</span>
356
-
357
- <span class="ruby-identifier">json</span> = <span class="ruby-keyword">begin</span>
358
- <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">apps_list_path</span>))
359
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">JSON</span><span class="ruby-operator">::</span><span class="ruby-constant">ParserError</span>
360
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadAppsFile</span>, <span class="ruby-node">&quot;#{apps_list_path} is not a valid JSON file&quot;</span>
361
- <span class="ruby-keyword">end</span>
362
-
363
- <span class="ruby-identifier">applist</span> = <span class="ruby-identifier">json</span>[<span class="ruby-string">&#39;applist&#39;</span>]
364
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">applist</span>
365
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadAppsFile</span>, <span class="ruby-node">&quot;#{apps_list_path} does not have expected JSON format&quot;</span>
366
- <span class="ruby-keyword">end</span>
367
-
368
- <span class="ruby-identifier">apps</span> = <span class="ruby-identifier">applist</span>[<span class="ruby-string">&#39;apps&#39;</span>]
369
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">apps</span>
370
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">BadAppsFile</span>, <span class="ruby-node">&quot;#{apps_list_path} does not have expected JSON format&quot;</span>
371
- <span class="ruby-keyword">end</span>
372
-
373
- <span class="ruby-identifier">query</span> = <span class="ruby-identifier">raw_query</span>.<span class="ruby-identifier">downcase</span>
374
- <span class="ruby-identifier">results</span> = []
375
- <span class="ruby-identifier">apps</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">data</span><span class="ruby-operator">|</span>
376
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">data</span>[<span class="ruby-string">&#39;name&#39;</span>]
377
-
378
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span>[<span class="ruby-string">&#39;name&#39;</span>].<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">query</span>)
379
- <span class="ruby-identifier">results</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">new</span>(<span class="ruby-identifier">id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">data</span>[<span class="ruby-string">&#39;appid&#39;</span>], <span class="ruby-identifier">name</span><span class="ruby-operator">:</span> <span class="ruby-identifier">data</span>[<span class="ruby-string">&#39;name&#39;</span>])
380
- <span class="ruby-keyword">end</span>
381
- <span class="ruby-keyword">end</span>
382
-
383
- <span class="ruby-identifier">results</span>
384
- <span class="ruby-keyword">end</span></pre>
385
- </div>
386
-
387
- </div>
388
-
389
-
390
-
391
-
392
- </div>
393
-
394
-
395
- </section>
396
-
397
- <section id="public-instance-Public-method-details" class="method-section">
398
- <header>
399
- <h3>Public Instance Methods</h3>
400
- </header>
401
-
402
-
403
- <div id="method-i-screenshots" class="method-detail ">
404
-
405
- <div class="method-heading">
406
- <span class="method-name">screenshots</span><span
407
- class="method-args">(order: nil, page: 1, query: nil)</span>
408
-
409
- <span class="method-click-advice">click to toggle source</span>
410
-
411
- </div>
412
-
413
-
414
- <div class="method-description">
415
-
416
- <p>Fetch a list of the newest uploaded screenshots for this app on Steam.</p>
417
- <dl class="rdoc-list note-list"><dt>order
418
- <dd>
419
- <p>String specifying which screenshots should be retrieved; choose from
420
- mostrecent, toprated, trendday, trendweek, trendthreemonths,
421
- trendsixmonths, and trendyear; defaults to mostrecent</p>
422
- </dd><dt>page
423
- <dd>
424
- <p>which page of results to fetch; defaults to 1; Integer</p>
425
- </dd><dt>query
426
- <dd>
427
- <p>a String of text for searching screenshots</p>
428
- </dd></dl>
429
-
430
- <h3 id="method-i-screenshots-label-Returns">Returns<span><a href="#method-i-screenshots-label-Returns">&para;</a> <a href="#top">&uarr;</a></span></h3>
431
-
432
- <p>Returns an Array of Rsteamshot::Screenshots.</p>
433
-
434
-
435
-
436
-
437
- <div class="method-source-code" id="screenshots-source">
438
- <pre><span class="ruby-comment"># File lib/rsteamshot/app.rb, line 110</span>
439
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">screenshots</span>(<span class="ruby-identifier">order</span><span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">page</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">query</span><span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>)
440
- <span class="ruby-keyword">return</span> [] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">id</span>
441
-
442
- <span class="ruby-identifier">url</span> = <span class="ruby-identifier">steam_url</span>(<span class="ruby-identifier">order</span>, <span class="ruby-identifier">query</span>, <span class="ruby-ivar">@paginator</span>.<span class="ruby-identifier">per_page</span>)
443
- <span class="ruby-ivar">@paginator</span>.<span class="ruby-identifier">screenshots</span>(<span class="ruby-identifier">page</span><span class="ruby-operator">:</span> <span class="ruby-identifier">page</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">url</span>)
444
- <span class="ruby-keyword">end</span></pre>
445
- </div>
446
-
447
- </div>
448
-
449
-
450
-
451
-
452
- </div>
453
-
454
-
455
- </section>
456
-
457
- </section>
458
- </main>
459
-
460
-
461
- <footer id="validator-badges" role="contentinfo">
462
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
463
- <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
464
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
465
- </footer>
466
-