rsteamshot 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +118 -0
- data/Rakefile +14 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/README_md.html +233 -0
- data/docs/Rsteamshot/App/BadAppsFile.html +106 -0
- data/docs/Rsteamshot/App.html +466 -0
- data/docs/Rsteamshot/Screenshot.html +562 -0
- data/docs/Rsteamshot/ScreenshotPage.html +347 -0
- data/docs/Rsteamshot/ScreenshotPaginator.html +307 -0
- data/docs/Rsteamshot/User.html +309 -0
- data/docs/Rsteamshot.html +147 -0
- data/docs/created.rid +9 -0
- data/docs/css/fonts.css +167 -0
- data/docs/css/rdoc.css +590 -0
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +242 -0
- data/docs/js/darkfish.js +161 -0
- data/docs/js/jquery.js +4 -0
- data/docs/js/navigation.js +142 -0
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +109 -0
- data/docs/js/search_index.js +1 -0
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -0
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +179 -0
- data/lib/rsteamshot/app.rb +213 -0
- data/lib/rsteamshot/screenshot.rb +224 -0
- data/lib/rsteamshot/screenshot_page.rb +62 -0
- data/lib/rsteamshot/screenshot_paginator.rb +77 -0
- data/lib/rsteamshot/user.rb +77 -0
- data/lib/rsteamshot/version.rb +4 -0
- data/lib/rsteamshot.rb +15 -0
- data/rsteamshot.gemspec +32 -0
- metadata +215 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2df4b5cbfb101609d488608c64082ba3efbf7ca7
|
4
|
+
data.tar.gz: 61f626e133760e3a8a35b2913d83cf82ff28e629
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 921fa912f08df89c69573eb4d75ca86c66ec0081404ce057d1b1342f06a0ff0c2e8355f308f1a71fe0235671b8d3bf8fc581172dc1c24315aaca169995cbf37c
|
7
|
+
data.tar.gz: c3a1897f6135cdbf01313ae5e1c2670eac372478ac884d38fd563e133a2d09fa7030c09bfbf5172223b2bbd38a3128f4a6800f48246d082cacbaa814c9a2d543
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at cheshire137@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Sarah Vessels
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
# Rsteamshot
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/cheshire137/rsteamshot.svg?branch=master)](https://travis-ci.org/cheshire137/rsteamshot)
|
4
|
+
|
5
|
+
Rsteamshot is a Ruby gem for getting screenshots a user has uploaded to their Steam profile, as well as screenshots uploaded for a particular game. You can find the newest screenshots as well as the most popular screenshots. Screenshots can be paginated.
|
6
|
+
|
7
|
+
There's no Steam API that I know of that provides this screenshot data, so this gem works by using [Mechanize](https://github.com/sparklemotion/mechanize) to do web scraping on [steamcommunity.com](http://steamcommunity.com/).
|
8
|
+
|
9
|
+
[View source on GitHub](https://github.com/cheshire137/rsteamshot)
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'rsteamshot'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install rsteamshot
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# Get screenshots uploaded by a Steam user:
|
31
|
+
steam_user_name = 'cheshire137'
|
32
|
+
user = Rsteamshot::User.new(steam_user_name, per_page: 10)
|
33
|
+
order = 'newestfirst' # also: score, oldestfirst
|
34
|
+
screenshots = user.screenshots(order: order)
|
35
|
+
screenshots += user.screenshots(order: order, page: 2)
|
36
|
+
|
37
|
+
# Find a Steam app by name:
|
38
|
+
apps_path = 'apps-list.json'
|
39
|
+
Rsteamshot::App.download_apps_list(apps_path)
|
40
|
+
apps = Rsteamshot::App.search('witcher 3', apps_path)
|
41
|
+
app = apps.first
|
42
|
+
|
43
|
+
# Filter a user's screenshots to those for a particular app:
|
44
|
+
alice_screenshots = user.screenshots(app_id: '19680')
|
45
|
+
|
46
|
+
# Initialize an app directly if you know its ID:
|
47
|
+
app_id = '377160'
|
48
|
+
app = Rsteamshot::App.new(id: app_id, per_page: 10)
|
49
|
+
|
50
|
+
# Get screenshots uploaded for a Steam game:
|
51
|
+
order = 'mostrecent' # also: toprated, trendday, trendweek, trendthreemonths, trendsixmonths,
|
52
|
+
# trendyear
|
53
|
+
screenshots = app.screenshots(order: order)
|
54
|
+
screenshots += app.screenshots(order: order, page: 2)
|
55
|
+
|
56
|
+
# Search an app's screenshots:
|
57
|
+
dog_screenshots = app.screenshots(query: 'dog', order: 'trendweek')
|
58
|
+
|
59
|
+
# Data available for each screenshot:
|
60
|
+
screenshots.each do |screenshot|
|
61
|
+
screenshot.title
|
62
|
+
# => "Lovely sunset in Toussaint"
|
63
|
+
|
64
|
+
screenshot.details_url
|
65
|
+
# => "http://steamcommunity.com/sharedfiles/filedetails/?id=737284878"
|
66
|
+
|
67
|
+
screenshot.full_size_url
|
68
|
+
# => "https://steamuserimages-a.akamaihd.net/ugc/1621679306978373648/FACBF0285AFB413467E0E76371E8796D8E8C263D/"
|
69
|
+
|
70
|
+
screenshot.medium_url
|
71
|
+
# => "https://steamuserimages-a.akamaihd.net/ugc/1621679306978373648/FACBF0285AFB413467E0E76371E8796D8E8C263D/?interpolation=lanczos-none&output-format=jpeg&output-quality=95&fit=inside|1024:576&composite-to%3D%2A%2C%2A%7C1024%3A576&background-color=black"
|
72
|
+
|
73
|
+
screenshot.user_name
|
74
|
+
# => "cheshire137"
|
75
|
+
|
76
|
+
screenshot.user_url
|
77
|
+
# => "http://steamcommunity.com/id/cheshire137"
|
78
|
+
|
79
|
+
screenshot.date
|
80
|
+
# => #<DateTime: 2016-08-03T20:54:00+00:00 ((2457604j,75240s,0n),+0s,2299161j)>
|
81
|
+
|
82
|
+
screenshot.file_size
|
83
|
+
# => "0.367 MB"
|
84
|
+
|
85
|
+
screenshot.width
|
86
|
+
# => 1920
|
87
|
+
|
88
|
+
screenshot.height
|
89
|
+
# => 1080
|
90
|
+
|
91
|
+
screenshot.like_count
|
92
|
+
# => 0
|
93
|
+
|
94
|
+
screenshot.comment_count
|
95
|
+
# => 0
|
96
|
+
|
97
|
+
# Utility methods:
|
98
|
+
screenshot.to_h
|
99
|
+
# => {:details_url=>"http://steamcommunity.com/sharedfiles/filedetails/?id=737284878", :title=>...
|
100
|
+
|
101
|
+
screenshot.to_json
|
102
|
+
# => "{\n \"details_url\": \"http://steamcommunity.com/sharedfiles/filedetails/?id=737284878\",
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
106
|
+
## Development
|
107
|
+
|
108
|
+
After checking out [the repo](https://github.com/cheshire137/rsteamshot), run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
109
|
+
|
110
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
111
|
+
|
112
|
+
## Contributing
|
113
|
+
|
114
|
+
[Bug reports](https://github.com/cheshire137/rsteamshot/issues) and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
115
|
+
|
116
|
+
## License
|
117
|
+
|
118
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rdoc/task'
|
4
|
+
|
5
|
+
RDoc::Task.new do |rdoc|
|
6
|
+
rdoc.main = 'README.md'
|
7
|
+
rdoc.rdoc_files.include('README.md', 'lib/**/*.rb')
|
8
|
+
rdoc.rdoc_dir = 'docs'
|
9
|
+
rdoc.markup = 'tomdoc'
|
10
|
+
end
|
11
|
+
|
12
|
+
RSpec::Core::RakeTask.new(:spec)
|
13
|
+
|
14
|
+
task :default => :spec
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rsteamshot"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/docs/README_md.html
ADDED
@@ -0,0 +1,233 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>README - 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="file">
|
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
|
+
<div class="nav-section">
|
56
|
+
<h3>Table of Contents</h3>
|
57
|
+
|
58
|
+
<ul class="link-list" role="directory">
|
59
|
+
<li><a href="#label-Rsteamshot">Rsteamshot</a>
|
60
|
+
<li><a href="#label-Installation">Installation</a>
|
61
|
+
<li><a href="#label-Usage">Usage</a>
|
62
|
+
<li><a href="#label-Development">Development</a>
|
63
|
+
<li><a href="#label-Contributing">Contributing</a>
|
64
|
+
<li><a href="#label-License">License</a>
|
65
|
+
</ul>
|
66
|
+
</div>
|
67
|
+
|
68
|
+
|
69
|
+
<div id="project-metadata">
|
70
|
+
<div id="fileindex-section" class="nav-section">
|
71
|
+
<h3>Pages</h3>
|
72
|
+
|
73
|
+
<ul class="link-list">
|
74
|
+
|
75
|
+
<li><a href="./README_md.html">README</a>
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<main role="main" aria-label="Page README.md">
|
84
|
+
|
85
|
+
<h1 id="label-Rsteamshot"><a href="Rsteamshot.html">Rsteamshot</a><span><a href="#label-Rsteamshot">¶</a> <a href="#top">↑</a></span></h1>
|
86
|
+
|
87
|
+
<p><a href="https://travis-ci.org/cheshire137/rsteamshot"><img
|
88
|
+
src="https://travis-ci.org/cheshire137/rsteamshot.svg?branch=master"></a></p>
|
89
|
+
|
90
|
+
<p><a href="Rsteamshot.html">Rsteamshot</a> is a Ruby gem for getting
|
91
|
+
screenshots a user has uploaded to their Steam profile, as well as
|
92
|
+
screenshots uploaded for a particular game. You can find the newest
|
93
|
+
screenshots as well as the most popular screenshots. Screenshots can be
|
94
|
+
paginated.</p>
|
95
|
+
|
96
|
+
<p>There's no Steam API that I know of that provides this screenshot data,
|
97
|
+
so this gem works by using <a
|
98
|
+
href="https://github.com/sparklemotion/mechanize">Mechanize</a> to do web
|
99
|
+
scraping on <a href="http://steamcommunity.com/">steamcommunity.com</a>.</p>
|
100
|
+
|
101
|
+
<p><a href="https://github.com/cheshire137/rsteamshot">View source on
|
102
|
+
GitHub</a></p>
|
103
|
+
|
104
|
+
<h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#top">↑</a></span></h2>
|
105
|
+
|
106
|
+
<p>Add this line to your application's Gemfile:</p>
|
107
|
+
|
108
|
+
<pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-string">'rsteamshot'</span>
|
109
|
+
</pre>
|
110
|
+
|
111
|
+
<p>And then execute:</p>
|
112
|
+
|
113
|
+
<pre>$ bundle</pre>
|
114
|
+
|
115
|
+
<p>Or install it yourself as:</p>
|
116
|
+
|
117
|
+
<pre>$ gem install rsteamshot</pre>
|
118
|
+
|
119
|
+
<h2 id="label-Usage">Usage<span><a href="#label-Usage">¶</a> <a href="#top">↑</a></span></h2>
|
120
|
+
|
121
|
+
<pre class="ruby"><span class="ruby-comment"># Get screenshots uploaded by a Steam user:</span>
|
122
|
+
<span class="ruby-identifier">steam_user_name</span> = <span class="ruby-string">'cheshire137'</span>
|
123
|
+
<span class="ruby-identifier">user</span> = <span class="ruby-constant">Rsteamshot</span><span class="ruby-operator">::</span><span class="ruby-constant">User</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">steam_user_name</span>, <span class="ruby-identifier">per_page</span><span class="ruby-operator">:</span> <span class="ruby-value">10</span>)
|
124
|
+
<span class="ruby-identifier">order</span> = <span class="ruby-string">'newestfirst'</span> <span class="ruby-comment"># also: score, oldestfirst</span>
|
125
|
+
<span class="ruby-identifier">screenshots</span> = <span class="ruby-identifier">user</span>.<span class="ruby-identifier">screenshots</span>(<span class="ruby-identifier">order</span><span class="ruby-operator">:</span> <span class="ruby-identifier">order</span>)
|
126
|
+
<span class="ruby-identifier">screenshots</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">screenshots</span>(<span class="ruby-identifier">order</span><span class="ruby-operator">:</span> <span class="ruby-identifier">order</span>, <span class="ruby-identifier">page</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>)
|
127
|
+
|
128
|
+
<span class="ruby-comment"># Find a Steam app by name:</span>
|
129
|
+
<span class="ruby-identifier">apps_path</span> = <span class="ruby-string">'apps-list.json'</span>
|
130
|
+
<span class="ruby-constant">Rsteamshot</span><span class="ruby-operator">::</span><span class="ruby-constant">App</span>.<span class="ruby-identifier">download_apps_list</span>(<span class="ruby-identifier">apps_path</span>)
|
131
|
+
<span class="ruby-identifier">apps</span> = <span class="ruby-constant">Rsteamshot</span><span class="ruby-operator">::</span><span class="ruby-constant">App</span>.<span class="ruby-identifier">search</span>(<span class="ruby-string">'witcher 3'</span>, <span class="ruby-identifier">apps_path</span>)
|
132
|
+
<span class="ruby-identifier">app</span> = <span class="ruby-identifier">apps</span>.<span class="ruby-identifier">first</span>
|
133
|
+
|
134
|
+
<span class="ruby-comment"># Filter a user's screenshots to those for a particular app:</span>
|
135
|
+
<span class="ruby-identifier">alice_screenshots</span> = <span class="ruby-identifier">user</span>.<span class="ruby-identifier">screenshots</span>(<span class="ruby-identifier">app_id</span><span class="ruby-operator">:</span> <span class="ruby-string">'19680'</span>)
|
136
|
+
|
137
|
+
<span class="ruby-comment"># Initialize an app directly if you know its ID:</span>
|
138
|
+
<span class="ruby-identifier">app_id</span> = <span class="ruby-string">'377160'</span>
|
139
|
+
<span class="ruby-identifier">app</span> = <span class="ruby-constant">Rsteamshot</span><span class="ruby-operator">::</span><span class="ruby-constant">App</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">app_id</span>, <span class="ruby-identifier">per_page</span><span class="ruby-operator">:</span> <span class="ruby-value">10</span>)
|
140
|
+
|
141
|
+
<span class="ruby-comment"># Get screenshots uploaded for a Steam game:</span>
|
142
|
+
<span class="ruby-identifier">order</span> = <span class="ruby-string">'mostrecent'</span> <span class="ruby-comment"># also: toprated, trendday, trendweek, trendthreemonths, trendsixmonths,</span>
|
143
|
+
<span class="ruby-comment"># trendyear</span>
|
144
|
+
<span class="ruby-identifier">screenshots</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">screenshots</span>(<span class="ruby-identifier">order</span><span class="ruby-operator">:</span> <span class="ruby-identifier">order</span>)
|
145
|
+
<span class="ruby-identifier">screenshots</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">app</span>.<span class="ruby-identifier">screenshots</span>(<span class="ruby-identifier">order</span><span class="ruby-operator">:</span> <span class="ruby-identifier">order</span>, <span class="ruby-identifier">page</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>)
|
146
|
+
|
147
|
+
<span class="ruby-comment"># Search an app's screenshots:</span>
|
148
|
+
<span class="ruby-identifier">dog_screenshots</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">screenshots</span>(<span class="ruby-identifier">query</span><span class="ruby-operator">:</span> <span class="ruby-string">'dog'</span>, <span class="ruby-identifier">order</span><span class="ruby-operator">:</span> <span class="ruby-string">'trendweek'</span>)
|
149
|
+
|
150
|
+
<span class="ruby-comment"># Data available for each screenshot:</span>
|
151
|
+
<span class="ruby-identifier">screenshots</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">screenshot</span><span class="ruby-operator">|</span>
|
152
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">title</span>
|
153
|
+
<span class="ruby-comment"># => "Lovely sunset in Toussaint"</span>
|
154
|
+
|
155
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">details_url</span>
|
156
|
+
<span class="ruby-comment"># => "http://steamcommunity.com/sharedfiles/filedetails/?id=737284878"</span>
|
157
|
+
|
158
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">full_size_url</span>
|
159
|
+
<span class="ruby-comment"># => "https://steamuserimages-a.akamaihd.net/ugc/1621679306978373648/FACBF0285AFB413467E0E76371E8796D8E8C263D/"</span>
|
160
|
+
|
161
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">medium_url</span>
|
162
|
+
<span class="ruby-comment"># => "https://steamuserimages-a.akamaihd.net/ugc/1621679306978373648/FACBF0285AFB413467E0E76371E8796D8E8C263D/?interpolation=lanczos-none&output-format=jpeg&output-quality=95&fit=inside|1024:576&composite-to%3D%2A%2C%2A%7C1024%3A576&background-color=black"</span>
|
163
|
+
|
164
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">user_name</span>
|
165
|
+
<span class="ruby-comment"># => "cheshire137"</span>
|
166
|
+
|
167
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">user_url</span>
|
168
|
+
<span class="ruby-comment"># => "http://steamcommunity.com/id/cheshire137"</span>
|
169
|
+
|
170
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">date</span>
|
171
|
+
<span class="ruby-comment"># => #<DateTime: 2016-08-03T20:54:00+00:00 ((2457604j,75240s,0n),+0s,2299161j)></span>
|
172
|
+
|
173
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">file_size</span>
|
174
|
+
<span class="ruby-comment"># => "0.367 MB"</span>
|
175
|
+
|
176
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">width</span>
|
177
|
+
<span class="ruby-comment"># => 1920</span>
|
178
|
+
|
179
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">height</span>
|
180
|
+
<span class="ruby-comment"># => 1080</span>
|
181
|
+
|
182
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">like_count</span>
|
183
|
+
<span class="ruby-comment"># => 0</span>
|
184
|
+
|
185
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">comment_count</span>
|
186
|
+
<span class="ruby-comment"># => 0</span>
|
187
|
+
|
188
|
+
<span class="ruby-comment"># Utility methods:</span>
|
189
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">to_h</span>
|
190
|
+
<span class="ruby-comment"># => {:details_url=>"http://steamcommunity.com/sharedfiles/filedetails/?id=737284878", :title=>...</span>
|
191
|
+
|
192
|
+
<span class="ruby-identifier">screenshot</span>.<span class="ruby-identifier">to_json</span>
|
193
|
+
<span class="ruby-comment"># => "{\n \"details_url\": \"http://steamcommunity.com/sharedfiles/filedetails/?id=737284878\",</span>
|
194
|
+
<span class="ruby-keyword">end</span>
|
195
|
+
</pre>
|
196
|
+
|
197
|
+
<h2 id="label-Development">Development<span><a href="#label-Development">¶</a> <a href="#top">↑</a></span></h2>
|
198
|
+
|
199
|
+
<p>After checking out <a href="https://github.com/cheshire137/rsteamshot">the
|
200
|
+
repo</a>, run <code>bin/setup</code> to install dependencies. Then, run
|
201
|
+
<code>rake spec</code> to run the tests. You can also run
|
202
|
+
<code>bin/console</code> for an interactive prompt that will allow you to
|
203
|
+
experiment.</p>
|
204
|
+
|
205
|
+
<p>To install this gem onto your local machine, run <code>bundle exec rake
|
206
|
+
install</code>. To release a new version, update the version number in
|
207
|
+
<code>version.rb</code>, and then run <code>bundle exec rake
|
208
|
+
release</code>, which will create a git tag for the version, push git
|
209
|
+
commits and tags, and push the <code>.gem</code> file to <a
|
210
|
+
href="https://rubygems.org">rubygems.org</a>.</p>
|
211
|
+
|
212
|
+
<h2 id="label-Contributing">Contributing<span><a href="#label-Contributing">¶</a> <a href="#top">↑</a></span></h2>
|
213
|
+
|
214
|
+
<p><a href="https://github.com/cheshire137/rsteamshot/issues">Bug reports</a>
|
215
|
+
and pull requests are welcome. This project is intended to be a safe,
|
216
|
+
welcoming space for collaboration, and contributors are expected to adhere
|
217
|
+
to the <a href="http://contributor-covenant.org">Contributor Covenant</a>
|
218
|
+
code of conduct.</p>
|
219
|
+
|
220
|
+
<h2 id="label-License">License<span><a href="#label-License">¶</a> <a href="#top">↑</a></span></h2>
|
221
|
+
|
222
|
+
<p>The gem is available as open source under the terms of the <a
|
223
|
+
href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
|
224
|
+
</main>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
<footer id="validator-badges" role="contentinfo">
|
229
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
230
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
231
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
232
|
+
</footer>
|
233
|
+
|
@@ -0,0 +1,106 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Rsteamshot::App::BadAppsFile - 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
|
+
|
58
|
+
<div id="parent-class-section" class="nav-section">
|
59
|
+
<h3>Parent</h3>
|
60
|
+
|
61
|
+
|
62
|
+
<p class="link">StandardError
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
</div>
|
70
|
+
</nav>
|
71
|
+
|
72
|
+
<main role="main" aria-labelledby="class-Rsteamshot::App::BadAppsFile">
|
73
|
+
<h1 id="class-Rsteamshot::App::BadAppsFile" class="class">
|
74
|
+
class Rsteamshot::App::BadAppsFile
|
75
|
+
</h1>
|
76
|
+
|
77
|
+
<section class="description">
|
78
|
+
|
79
|
+
<p>Exception thrown by Rsteamshot::App#search when the given file is not a
|
80
|
+
valid file containing Steam apps.</p>
|
81
|
+
|
82
|
+
</section>
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
</section>
|
98
|
+
</main>
|
99
|
+
|
100
|
+
|
101
|
+
<footer id="validator-badges" role="contentinfo">
|
102
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
103
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
104
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
105
|
+
</footer>
|
106
|
+
|