reddit_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/example_responses/comments.rb +46 -0
- data/lib/example_responses/posts.rb +67 -0
- data/lib/example_responses/subreddits.rb +53 -0
- data/lib/reddit_api/client.rb +141 -0
- data/lib/reddit_api/comment.rb +22 -0
- data/lib/reddit_api/comments.rb +51 -0
- data/lib/reddit_api/null_response.rb +10 -0
- data/lib/reddit_api/post.rb +24 -0
- data/lib/reddit_api/posts.rb +45 -0
- data/lib/reddit_api/resource_type_prefixes.rb +6 -0
- data/lib/reddit_api/subreddit.rb +25 -0
- data/lib/reddit_api/subreddits.rb +34 -0
- data/lib/reddit_api/user.rb +16 -0
- data/lib/reddit_api/users.rb +62 -0
- data/lib/reddit_api/version.rb +3 -0
- data/lib/reddit_api.rb +16 -0
- data/reddit_api.gemspec +39 -0
- metadata +156 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 534315886359d1f8cd0b3ff3f5c10491e6bfa054
|
4
|
+
data.tar.gz: 4127d3e358af94f0ffbb9efca924e4130142d7b8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cf17e29d9e1f191ad92b10d69fd3fd84b4fc359052a4aaf4166fc250ec8bb6b980010f058a18d461a896c3848fb68166fb285b312c9896da848e2da469fb0c5c
|
7
|
+
data.tar.gz: 86dec1f544fb1b4bbbba71283f224867210ea2ff31e530095cea8f5f33a840bba166b8ffeff8fd0996c51870c3b683044629d8f624efd2305e6a1faf9053d07a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
3
|
+
require "guard/rspec/dsl"
|
4
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
5
|
+
|
6
|
+
# RSpec files
|
7
|
+
rspec = dsl.rspec
|
8
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
9
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
10
|
+
watch(rspec.spec_files)
|
11
|
+
|
12
|
+
# Ruby files
|
13
|
+
ruby = dsl.ruby
|
14
|
+
watch(%r{^lib/reddit_api/(.+)\.rb$}) do |m|
|
15
|
+
"spec/#{m[1]}_spec.rb"
|
16
|
+
end
|
17
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
18
|
+
|
19
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Anthony Fuentes
|
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,40 @@
|
|
1
|
+
# RedditApi
|
2
|
+
|
3
|
+
Communicate with the Reddit API painlessly.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'reddit_api'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install reddit_api
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
1. Get Reddit API credentials by following the guide
|
24
|
+
[here](https://www.reddit.com/prefs/apps)
|
25
|
+
2. Load Reddit API credentials into the environment
|
26
|
+
* Expected names can be found in RedditApi::Client
|
27
|
+
3. Create instances of the RedditApi sub-api objects and make requests
|
28
|
+
|
29
|
+
## Resources
|
30
|
+
|
31
|
+
* [Reddit API Documentation](https://www.reddit.com/dev/api/)
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/anthonyfuentes/reddit_api.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
40
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "reddit_api"
|
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
|
data/bin/setup
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Received 2-15-2017
|
2
|
+
|
3
|
+
[{
|
4
|
+
"kind"=>"t1",
|
5
|
+
"data"=>{
|
6
|
+
"subreddit_id"=>"t5_2r0ij",
|
7
|
+
"edited"=>false,
|
8
|
+
"banned_by"=>nil,
|
9
|
+
"removal_reason"=>nil,
|
10
|
+
"link_id"=>"t3_5q4qmg",
|
11
|
+
"link_author"=>"spez",
|
12
|
+
"likes"=>nil,
|
13
|
+
"replies"=>"",
|
14
|
+
"user_reports"=>[],
|
15
|
+
"saved"=>false,
|
16
|
+
"id"=>"dcwe4m6",
|
17
|
+
"gilded"=>0,
|
18
|
+
"archived"=>false,
|
19
|
+
"report_reasons"=>nil,
|
20
|
+
"author"=>"spez",
|
21
|
+
"parent_id"=>"t1_dcwceu5",
|
22
|
+
"score"=>115,
|
23
|
+
"approved_by"=>nil,
|
24
|
+
"over_18"=>false,
|
25
|
+
"controversiality"=>0,
|
26
|
+
"body"=>"If Reddit could be killed, it'd be dead by now.",
|
27
|
+
"link_title"=>"Out with 2016, in with 2017",
|
28
|
+
"author_flair_css_class"=>nil,
|
29
|
+
"downs"=>0,
|
30
|
+
"body_html"=>"<div class=...",
|
31
|
+
"quarantine"=>false,
|
32
|
+
"subreddit"=>"announcements",
|
33
|
+
"name"=>"t1_dcwe4m6",
|
34
|
+
"score_hidden"=>false,
|
35
|
+
"stickied"=>false,
|
36
|
+
"created"=>1485401335.0,
|
37
|
+
"author_flair_text"=>nil,
|
38
|
+
"link_url"=>"https://www.reddit....",
|
39
|
+
"created_utc"=>1485372535.0,
|
40
|
+
"distinguished"=>"admin",
|
41
|
+
"mod_reports"=>[],
|
42
|
+
"num_reports"=>nil,
|
43
|
+
"ups"=>115}
|
44
|
+
},
|
45
|
+
{"kind"=>"t1", "data"=>{"subreddit_id"=>"t5_2r0ij", "edited"=>false, "banned_by"=>nil, "removal_reason"=>nil, "link_id"=>"t3_5q4qmg", "link_author"=>"spez", "likes"=>nil, "replies"=>"", "user_reports"=>[], "saved"=>false, "id"=>"dcwe4m6", "gilded"=>0, "archived"=>false, "report_reasons"=>nil, "author"=>"spez", "parent_id"=>"t1_dcwceu5", "score"=>115, "approved_by"=>nil, "over_18"=>false, "controversiality"=>0, "body"=>"If Reddit could be killed, it'd be dead by now.", "link_title"=>"Out with 2016, in with 2017", "author_flair_css_class"=>nil, "downs"=>0, "body_html"=>"<div class=\"md\"><p>If Reddit could be killed, it&#39;d be dead by now.</p>\n</div>", "quarantine"=>false, "subreddit"=>"announcements", "name"=>"t1_dcwe4m6", "score_hidden"=>false, "stickied"=>false, "created"=>1485401335.0, "author_flair_text"=>nil, "link_url"=>"https://www.reddit.com/r/announcements/comments/5q4qmg/out_with_2016_in_with_2017/", "created_utc"=>1485372535.0, "distinguished"=>"admin", "mod_reports"=>[], "num_reports"=>nil, "ups"=>115}}
|
46
|
+
]
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Received 2-14-2017
|
2
|
+
|
3
|
+
[{
|
4
|
+
"kind" => "t3",
|
5
|
+
"data" => {
|
6
|
+
"contest_mode" => false,
|
7
|
+
"banned_by" => nil,
|
8
|
+
"domain" => "self.AskReddit",
|
9
|
+
"subreddit" => "AskReddit",
|
10
|
+
"selftext_html" => "<!--...",
|
11
|
+
"selftext" => "[Valentine's Day](htt...",
|
12
|
+
"likes" => nil,
|
13
|
+
"suggested_sort" => "new",
|
14
|
+
"user_reports" => [],
|
15
|
+
"secure_media" => nil,
|
16
|
+
"link_flair_text" => "Mega Thread",
|
17
|
+
"id" => "5tvb1v",
|
18
|
+
"gilded" => 0,
|
19
|
+
"secure_media_embed" => {},
|
20
|
+
"clicked" => false,
|
21
|
+
"report_reasons" => nil,
|
22
|
+
"author" => "enantiodromia_",
|
23
|
+
"saved" => false,
|
24
|
+
"mod_reports" => [],
|
25
|
+
"name" => "t3_5tvb1v",
|
26
|
+
"score" => 638,
|
27
|
+
"approved_by" => nil,
|
28
|
+
"over_18" => false,
|
29
|
+
"removal_reason" => nil,
|
30
|
+
"hidden" => false,
|
31
|
+
"thumbnail" => "",
|
32
|
+
"subreddit_id" => "t5_2qh1i",
|
33
|
+
"edited" => false,
|
34
|
+
"link_flair_css_class" => "megathread",
|
35
|
+
"author_flair_css_class" => nil,
|
36
|
+
"downs" => 0,
|
37
|
+
"brand_safe" => true,
|
38
|
+
"archived" => false,
|
39
|
+
"media_embed" => {},
|
40
|
+
"is_self" => true,
|
41
|
+
"hide_score" => false,
|
42
|
+
"spoiler" => false,
|
43
|
+
"permalink" => "/r/AskReddit/com...",
|
44
|
+
"locked" => false,
|
45
|
+
"stickied" => true,
|
46
|
+
"created" => 1487046505.0,
|
47
|
+
"url" => "https://www.reddit./5...",
|
48
|
+
"author_flair_text" => nil,
|
49
|
+
"quarantine" => false,
|
50
|
+
"title" => "[Megathread] Valentine's Day",
|
51
|
+
"created_utc" => 1487017705.0,
|
52
|
+
"distinguished" => "moderator",
|
53
|
+
"media" => nil,
|
54
|
+
"num_comments" => 2258,
|
55
|
+
"visited" => false,
|
56
|
+
"num_reports" => nil,
|
57
|
+
"ups" => 638
|
58
|
+
}
|
59
|
+
}, {
|
60
|
+
"kind" => "t3", "data" => {
|
61
|
+
"contest_mode" => false, "banned_by" => nil, "domain" => "self.AskReddit", "subreddit" => "AskReddit", "selftext_html" => nil, "selftext" => "", "likes" => nil, "suggested_sort" => nil, "user_reports" => [], "secure_media" => nil, "link_flair_text" => nil, "id" => "5u0azv", "gilded" => 0, "secure_media_embed" => {}, "clicked" => false, "report_reasons" => nil, "author" => "Coonark00", "saved" => false, "mod_reports" => [], "name" => "t3_5u0azv", "score" => 8245, "approved_by" => nil, "over_18" => true, "removal_reason" => nil, "hidden" => false, "thumbnail" => "", "subreddit_id" => "t5_2qh1i", "edited" => false, "link_flair_css_class" => nil, "author_flair_css_class" => nil, "downs" => 0, "brand_safe" => true, "archived" => false, "media_embed" => {}, "is_self" => true, "hide_score" => false, "spoiler" => false, "permalink" => "/r/AskReddit/comments/5u0azv/what_is_your_most_devious_would_you_rather/", "locked" => false, "stickied" => false, "created" => 1487109211.0, "url" => "https://www.reddit.com/r/AskReddit/comments/5u0azv/what_is_your_most_devious_would_you_rather/", "author_flair_text" => nil, "quarantine" => false, "title" => "What is your most devious \"Would you rather\" question?", "created_utc" => 1487080411.0, "distinguished" => nil, "media" => nil, "num_comments" => 7265, "visited" => false, "num_reports" => nil, "ups" => 8245
|
62
|
+
}
|
63
|
+
}, {
|
64
|
+
"kind" => "t3", "data" => {
|
65
|
+
"contest_mode" => false, "banned_by" => nil, "domain" => "self.AskReddit", "subreddit" => "AskReddit", "selftext_html" => nil, "selftext" => "", "likes" => nil, "suggested_sort" => nil, "user_reports" => [], "secure_media" => nil, "link_flair_text" => nil, "id" => "5u2i4r", "gilded" => 0, "secure_media_embed" => {}, "clicked" => false, "report_reasons" => nil, "author" => "-oh-no", "saved" => false, "mod_reports" => [], "name" => "t3_5u2i4r", "score" => 1715, "approved_by" => nil, "over_18" => false, "removal_reason" => nil, "hidden" => false, "thumbnail" => "", "subreddit_id" => "t5_2qh1i", "edited" => false, "link_flair_css_class" => nil, "author_flair_css_class" => nil, "downs" => 0, "brand_safe" => true, "archived" => false, "media_embed" => {}, "is_self" => true, "hide_score" => false, "spoiler" => false, "permalink" => "/r/AskReddit/comments/5u2i4r/what_are_some_of_the_most_pathetic_things/", "locked" => false, "stickied" => false, "created" => 1487130279.0, "url" => "https://www.reddit.com/r/AskReddit/comments/5u2i4r/what_are_some_of_the_most_pathetic_things/", "author_flair_text" => nil, "quarantine" => false, "title" => "What are some of the most pathetic things YouTubers have done for views?", "created_utc" => 1487101479.0, "distinguished" => nil, "media" => nil, "num_comments" => 1180, "visited" => false, "num_reports" => nil, "ups" => 1715
|
66
|
+
}
|
67
|
+
}]
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Received 2-15-2017
|
2
|
+
|
3
|
+
{
|
4
|
+
"banner_img"=>"http://a.thumbs.r...",
|
5
|
+
"user_sr_theme_enabled"=>true,
|
6
|
+
"submit_text_html"=>"Information only.<...",
|
7
|
+
"user_is_banned"=>nil,
|
8
|
+
"wiki_enabled"=>true,
|
9
|
+
"show_media"=>true,
|
10
|
+
"id"=>"2cneq",
|
11
|
+
"submit_text"=>"1. Submissions must be...",
|
12
|
+
"display_name"=>"politics",
|
13
|
+
"header_img"=>"http://b.thumbs.r...",
|
14
|
+
"description_html"=>"<!-- SC_OFF...",
|
15
|
+
"title"=>"Politics",
|
16
|
+
"collapse_deleted_comments"=>true,
|
17
|
+
"over18"=>false,
|
18
|
+
"public_description_html"=>"<!-- SC_OFF...",
|
19
|
+
"spoilers_enabled"=>false,
|
20
|
+
"icon_size"=>[256, 256],
|
21
|
+
"suggested_comment_sort"=>nil,
|
22
|
+
"icon_img"=>"http://a.thumbs.reddit...",
|
23
|
+
"header_title"=>"The Place for U.S. Politics",
|
24
|
+
"description"=>"## **Welcome to /r/Politics...",
|
25
|
+
"user_is_muted"=>nil,
|
26
|
+
"submit_link_label"=>nil,
|
27
|
+
"accounts_active"=>nil,
|
28
|
+
"public_traffic"=>true,
|
29
|
+
"header_size"=>[21, 16],
|
30
|
+
"subscribers"=>3300054,
|
31
|
+
"submit_text_label"=>nil,
|
32
|
+
"whitelist_status"=>"all_ads",
|
33
|
+
"lang"=>"en",
|
34
|
+
"user_is_moderator"=>nil,
|
35
|
+
"key_color"=>"",
|
36
|
+
"name"=>"t5_2cneq",
|
37
|
+
"created"=>1186406199.0,
|
38
|
+
"url"=>"/r/politics/",
|
39
|
+
"quarantine"=>false,
|
40
|
+
"hide_ads"=>false,
|
41
|
+
"created_utc"=>1186377399.0,
|
42
|
+
"banner_size"=>[880, 264],
|
43
|
+
"user_is_contributor"=>nil,
|
44
|
+
"accounts_active_is_fuzzed"=>nil,
|
45
|
+
"advertiser_category"=>"Lifestyles",
|
46
|
+
"public_description"=>"/r/Politics is for...",
|
47
|
+
"show_media_preview"=>false,
|
48
|
+
"comment_score_hide_mins"=>480,
|
49
|
+
"subreddit_type"=>"public",
|
50
|
+
"submission_type"=>"link",
|
51
|
+
"user_is_subscriber"=>nil
|
52
|
+
}
|
53
|
+
{"banner_img"=>"", "user_sr_theme_enabled"=>true, "submit_text_html"=>"<!-- SC_OFF --><div class=\"md\"><p>Please read <a href=\"/r/pics/about/sidebar\">the sidebar</a> before submitting</p>\n</div><!-- SC_ON -->", "user_is_banned"=>nil, "wiki_enabled"=>true, "show_media"=>true, "id"=>"2qh0u", "submit_text"=>"Please read [the sidebar](/r/pics/about/sidebar) before submitting\n\n", "display_name"=>"pics", "header_img"=>"http://b.thumbs.redditmedia.com/MfVUZn6wkAaWadas1QAInsX3excC1gp4X7Y3jm_FBiQ.png", "description_html"=>"<!-- SC_OFF --><div class=\"md\"><p>A place to share photographs and pictures. Feel free to post your own, but please <strong>read the rules first</strong> (see below), and note that we are <em>not a catch-all</em> for general images (of screenshots, comics, etc.)</p>\n\n<hr/>\n\n<h1>Spoiler code</h1>\n\n<p>Please mark spoilers like this:<br/>\n<code>[text here](/spoiler)</code></p>\n\n<p>Hover over to <a href=\"/spoiler\">read</a>.</p>\n\n<hr/>\n\n<p>Check out <a href=\"http://nt.reddit.com/r/pics\">http://nt.reddit.com/r/pics</a>!</p>\n\n<p>Check out <a href=\"/r/pics/w/takedown\">/r/pics/w/takedown</a> for help with taking down posts due to copyright or personal identifiable information reasons. </p>\n\n<hr/>\n\n<h1><a href=\"/r/pics/about/rules\">Posting Rules</a></h1>\n\n<ol>\n<li><p><strong>No screenshots or pictures of screens. No pictures with added/superimposed text.</strong> <em>This includes <a href=\"http://en.wikipedia.org/wiki/Image_macro\">image macros</a>, comics, maps, infographics, and most diagrams. Text (e.g. a URL) serving to credit the original author is exempt.</em></p></li>\n<li><p><strong>No porn or gore.</strong> <em>NSFW content must be tagged.</em></p></li>\n<li><p><strong>No personal information.</strong> <em>This includes anything hosted on Facebook&#39;s servers, as they can be traced to the original account holder. Stalking &amp; harassment will not be tolerated.</em> <strong><em>No missing-persons requests!</em></strong></p></li>\n<li><p><strong>Titles must follow all <a href=\"/r/pics/w/titles\">title guidelines</a>.</strong></p></li>\n<li><p><strong>Submissions must link directly to a specific image file or to a website with minimal ads.</strong> <em>We do not allow blog hosting of images (&quot;blogspam&quot;), but links to albums on image hosting websites are okay. URL shorteners are prohibited. URLs in image or album descriptions are prohibited.</em> </p></li>\n<li><p><strong>No animated images.</strong> <em>Please submit them to <a href=\"/r/gif\">/r/gif</a>, <a href=\"/r/gifs\">/r/gifs</a>, or <a href=\"/r/reactiongifs\">/r/reactiongifs</a> instead.</em></p></li>\n<li><p>We enforce a standard of common decency and civility here. <strong>Please be respectful to others.</strong> Personal attacks, bigotry, fighting words, otherwise inappropriate behavior or content, comments that insult or demean a specific user or group of users will be removed. Regular or egregious violations will result in a ban.</p></li>\n</ol>\n\n<ul>\n<li><p>If your submission appears to be filtered, but <strong>definitely</strong> meets the above rules, <a href=\"/message/compose?to=%23pics\">please send us a message</a> with a link to the <strong>comments section</strong> of your post (not a direct link to the image). <strong>Don&#39;t delete it</strong> as that just makes the filter hate you! </p></li>\n<li><p>If you come across any rule violations please report the submission or <a href=\"http://www.reddit.com/message/compose?to=%23pics\">message the mods</a> and one of us will remove it!</p></li>\n<li><p>Serial reposters may be filtered. False claims of ownership will result in a ban.</p></li>\n<li><p><strong>Professional photographer or artist?</strong> Read <a href=\"/r/pics/wiki/professionals\">these guidelines</a> for linking to your own site and obtaining &#39;Verified&#39; user flair. </p></li>\n</ul>\n\n<h1>Links</h1>\n\n<p>If your post doesn&#39;t meet the above rules, consider submitting it on one of these other subreddits:</p>\n\n<h1>Subreddits</h1>\n\n<p>Below is a table of subreddits that you might want to check out!</p>\n\n<table><thead>\n<tr>\n<th>Screenshots</th>\n<th>Advice Animals</th>\n</tr>\n</thead><tbody>\n<tr>\n<td><a href=\"/r/images\">/r/images</a></td>\n<td><a href=\"/r/adviceanimals\">/r/adviceanimals</a></td>\n</tr>\n<tr>\n<td><a href=\"/r/screenshots\">/r/screenshots</a></td>\n<td><a href=\"/r/memes\">/r/memes</a></td>\n</tr>\n<tr>\n<td><a href=\"/r/desktops\">/r/desktops</a></td>\n<td><a href=\"/r/memesIRL\">/r/memesIRL</a></td>\n</tr>\n<tr>\n<td><strong>Animals</strong></td>\n<td><strong>More Animals</strong></td>\n</tr>\n<tr>\n<td><a href=\"/r/aww\">/r/aww</a></td>\n<td><a href=\"/r/rabbits\">/r/rabbits</a></td>\n</tr>\n<tr>\n<td><a href=\"/r/dogs\">/r/dogs</a></td>\n<td><a href=\"/r/BeforeNAfterAdoption\">/r/BeforeNAfterAdoption</a></td>\n</tr>\n<tr>\n<td><a href=\"/r/cats\">/r/cats</a></td>\n<td><a href=\"/r/otters\">/r/otters</a></td>\n</tr>\n<tr>\n<td><a href=\"/r/foxes\">/r/foxes</a></td>\n<td><a href=\"/r/redpandas\">/r/redpandas</a></td>\n</tr>\n<tr>\n<td><strong>GIFS</strong></td>\n<td><strong>HQ / Curated</strong></td>\n</tr>\n<tr>\n<td><a href=\"/r/gifs\">/r/gifs</a></td>\n<td><a href=\"/r/pic\">/r/pic</a></td>\n</tr>\n<tr>\n<td><a href=\"/r/catgifs\">/r/catgifs</a></td>\n<td><a href=\"/r/earthporn\">/r/earthporn</a></td>\n</tr>\n<tr>\n<td><a href=\"/r/reactiongifs\">/r/reactiongifs</a></td>\n<td><a href=\"/r/spaceporn\">/r/spaceporn</a></td>\n</tr>\n</tbody></table>\n\n<h2>Topic subreddits</h2>\n\n<p>Every now and then, we choose 2 new topics, and find some subreddits about that topic to feature!</p>\n\n<table><thead>\n<tr>\n<th>Comics</th>\n<th>Art</th>\n</tr>\n</thead><tbody>\n<tr>\n<td><a href=\"/r/comics\">/r/comics</a></td>\n<td><a href=\"/r/Art\">/r/Art</a></td>\n</tr>\n<tr>\n<td><a href=\"/r/xkcd\">/r/xkcd</a></td>\n<td><a href=\"/r/ImaginaryBestOf\">/r/ImaginaryBestOf</a></td>\n</tr>\n<tr>\n<td><a href=\"/r/comicbooks\">/r/comicbooks</a></td>\n<td><a href=\"/r/IDAP\">/r/IDAP</a></td>\n</tr>\n</tbody></table>\n</div><!-- SC_ON -->", "title"=>"Reddit Pics", "collapse_deleted_comments"=>true, "over18"=>false, "public_description_html"=>"<!-- SC_OFF --><div class=\"md\"><p>A place to share photographs and pictures.</p>\n</div><!-- SC_ON -->", "spoilers_enabled"=>true, "icon_size"=>[256, 256], "suggested_comment_sort"=>nil, "icon_img"=>"http://b.thumbs.redditmedia.com/VZX_KQLnI1DPhlEZ07bIcLzwR1Win808RIt7zm49VIQ.png", "header_title"=>"29% of statistics are made up", "description"=>"A place to share photographs and pictures. Feel free to post your own, but please **read the rules first** (see below), and note that we are *not a catch-all* for general images (of screenshots, comics, etc.)\n\n---\n\n#Spoiler code#\n\nPlease mark spoilers like this: \n`[text here](/spoiler)`\n\nHover over to [read](/spoiler).\n\n---\nCheck out http://nt.reddit.com/r/pics!\n\nCheck out /r/pics/w/takedown for help with taking down posts due to copyright or personal identifiable information reasons. \n\n---\n#[Posting Rules](/r/pics/about/rules)#\n\n\n1. **No screenshots or pictures of screens. No pictures with added/superimposed text.** *This includes [image macros](http://en.wikipedia.org/wiki/Image_macro), comics, maps, infographics, and most diagrams. Text (e.g. a URL) serving to credit the original author is exempt.*\n\n1. **No porn or gore.** *NSFW content must be tagged.*\n\n1. **No personal information.** *This includes anything hosted on Facebook's servers, as they can be traced to the original account holder. Stalking & harassment will not be tolerated.* ***No missing-persons requests!***\n\n1. **Titles must follow all [title guidelines](/r/pics/w/titles).**\n\n1. **Submissions must link directly to a specific image file or to a website with minimal ads.** *We do not allow blog hosting of images (\"blogspam\"), but links to albums on image hosting websites are okay. URL shorteners are prohibited. URLs in image or album descriptions are prohibited.* \n\n1. **No animated images.** *Please submit them to /r/gif, /r/gifs, or /r/reactiongifs instead.*\n\n1. We enforce a standard of common decency and civility here. **Please be respectful to others.** Personal attacks, bigotry, fighting words, otherwise inappropriate behavior or content, comments that insult or demean a specific user or group of users will be removed. Regular or egregious violations will result in a ban.\n\n* If your submission appears to be filtered, but **definitely** meets the above rules, [please send us a message](/message/compose?to=%23pics) with a link to the **comments section** of your post (not a direct link to the image). **Don't delete it** as that just makes the filter hate you! \n\n* If you come across any rule violations please report the submission or [message the mods](http://www.reddit.com/message/compose?to=%23pics) and one of us will remove it!\n\n* Serial reposters may be filtered. False claims of ownership will result in a ban.\n\n* **Professional photographer or artist?** Read [these guidelines](/r/pics/wiki/professionals) for linking to your own site and obtaining 'Verified' user flair. \n\n#Links#\nIf your post doesn't meet the above rules, consider submitting it on one of these other subreddits:\n\n#Subreddits\nBelow is a table of subreddits that you might want to check out!\n\nScreenshots | Advice Animals\n-----------|--------------\n/r/images | /r/adviceanimals\n/r/screenshots | /r/memes\n/r/desktops | /r/memesIRL\n**Animals** | **More Animals**\n/r/aww | /r/rabbits\n/r/dogs | /r/BeforeNAfterAdoption\n/r/cats | /r/otters\n/r/foxes | /r/redpandas\n**GIFS** | **HQ / Curated**\n/r/gifs | /r/pic\n/r/catgifs | /r/earthporn\n/r/reactiongifs | /r/spaceporn\n\n##Topic subreddits\n\nEvery now and then, we choose 2 new topics, and find some subreddits about that topic to feature!\n\nComics | Art\n-----|----------\n/r/comics | /r/Art\n/r/xkcd | /r/ImaginaryBestOf\n/r/comicbooks | /r/IDAP ", "user_is_muted"=>nil, "submit_link_label"=>"Submit an image", "accounts_active"=>nil, "public_traffic"=>true, "header_size"=>[160, 64], "subscribers"=>15349082, "submit_text_label"=>nil, "whitelist_status"=>"all_ads", "lang"=>"en", "user_is_moderator"=>nil, "key_color"=>"#222222", "name"=>"t5_2qh0u", "created"=>1201249869.0, "url"=>"/r/pics/", "quarantine"=>false, "hide_ads"=>false, "created_utc"=>1201221069.0, "banner_size"=>nil, "user_is_contributor"=>nil, "accounts_active_is_fuzzed"=>nil, "advertiser_category"=>"Lifestyles", "public_description"=>"A place to share photographs and pictures.", "show_media_preview"=>true, "comment_score_hide_mins"=>60, "subreddit_type"=>"public", "submission_type"=>"link", "user_is_subscriber"=>nil}
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require "httparty"
|
2
|
+
|
3
|
+
module RedditApi
|
4
|
+
class Client
|
5
|
+
|
6
|
+
attr_reader :agent, :id, :password, :secret, :username, :failures
|
7
|
+
|
8
|
+
MAXIMUM_RECORDS = 100
|
9
|
+
MAX_FAILURES = 5
|
10
|
+
ERROR_CODES = (400..511)
|
11
|
+
|
12
|
+
def initialize(args = {})
|
13
|
+
@agent = ENV["REDDIT_AGENT"]
|
14
|
+
@client = args.fetch(:client, HTTParty)
|
15
|
+
@id = ENV["REDDIT_AGENT"]
|
16
|
+
@password = ENV["REDDIT_AGENT"]
|
17
|
+
@secret = ENV["REDDIT_AGENT"]
|
18
|
+
@username = ENV["REDDIT_AGENT"]
|
19
|
+
@base_url = "https://oauth.reddit.com/"
|
20
|
+
@failures = args.fetch(:failures, 0)
|
21
|
+
@null_response_factory = RedditApi:: NullResponse
|
22
|
+
@last_record = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def get(endpoint, count, resource_type)
|
26
|
+
sleep(3)
|
27
|
+
records = {}
|
28
|
+
loop do
|
29
|
+
new_records = request_records(endpoint, resource_type)
|
30
|
+
collect_records(new_records, records, count)
|
31
|
+
break if break_get?(records, count)
|
32
|
+
end
|
33
|
+
self.last_record = nil
|
34
|
+
records.keys
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
attr_writer :failures, :last_record
|
39
|
+
private
|
40
|
+
attr_reader :client, :base_url, :null_response_factory, :last_record
|
41
|
+
|
42
|
+
def collect_records(new_records, collected_records, count)
|
43
|
+
new_records.each do |record|
|
44
|
+
collected_records[record] = true
|
45
|
+
break if collected_records.length == count
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def request_records(endpoint, resource_type)
|
50
|
+
response = send_request(endpoint, resource_type)
|
51
|
+
parse_response(response)
|
52
|
+
end
|
53
|
+
|
54
|
+
def send_request(endpoint, resource_type)
|
55
|
+
url = base_url + endpoint
|
56
|
+
headers = generate_headers
|
57
|
+
query = generate_query(resource_type)
|
58
|
+
response = client.get(url, headers: headers, query: query)
|
59
|
+
response || null_response_factory.new
|
60
|
+
end
|
61
|
+
|
62
|
+
def parse_response(response)
|
63
|
+
if bad_response?(response)
|
64
|
+
handle_bad_response
|
65
|
+
else
|
66
|
+
handle_successful_response(response)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def bad_response?(response)
|
71
|
+
ERROR_CODES.cover?(response.code) || response["error"]
|
72
|
+
end
|
73
|
+
|
74
|
+
def handle_bad_response
|
75
|
+
self.failures += 1
|
76
|
+
[]
|
77
|
+
end
|
78
|
+
|
79
|
+
def handle_successful_response(response)
|
80
|
+
if records = response["data"]["children"]
|
81
|
+
store_last_record(records)
|
82
|
+
else
|
83
|
+
bad_response
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def store_last_record(records)
|
88
|
+
self.last_record = records[-1]
|
89
|
+
records
|
90
|
+
end
|
91
|
+
|
92
|
+
def break_get?(records, desired_count)
|
93
|
+
records.length >= desired_count || failures >= MAX_FAILURES
|
94
|
+
end
|
95
|
+
|
96
|
+
def generate_headers
|
97
|
+
access_token = generate_access_token
|
98
|
+
{
|
99
|
+
"Authorization" => "bearer #{access_token}",
|
100
|
+
"user-agent" => agent
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
def generate_query(resource_type)
|
105
|
+
{
|
106
|
+
limit: MAXIMUM_RECORDS,
|
107
|
+
after: generate_after(resource_type)
|
108
|
+
}
|
109
|
+
end
|
110
|
+
|
111
|
+
def generate_after(resource_type)
|
112
|
+
if last_record
|
113
|
+
build_after(resource_type)
|
114
|
+
else
|
115
|
+
nil
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def build_after(resource_type)
|
120
|
+
prefix = TYPE_PREFIXES[resource_type]
|
121
|
+
last_resource_id = last_record["data"]["id"]
|
122
|
+
"#{prefix}_#{last_resource_id}"
|
123
|
+
end
|
124
|
+
|
125
|
+
def generate_access_token
|
126
|
+
url = "https://www.reddit.com/api/v1/access_token"
|
127
|
+
basic_auth = { username: id,
|
128
|
+
password: secret }
|
129
|
+
headers = { "user-agent" => agent }
|
130
|
+
body = { grant_type: "password",
|
131
|
+
username: username,
|
132
|
+
password: password }
|
133
|
+
response = client.post(url,
|
134
|
+
basic_auth: basic_auth,
|
135
|
+
headers: headers,
|
136
|
+
body: body)
|
137
|
+
response["access_token"]
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module RedditApi
|
3
|
+
class Comment
|
4
|
+
|
5
|
+
attr_reader :reddit_id, :author_name, :subreddit_name
|
6
|
+
|
7
|
+
def initialize(args = {})
|
8
|
+
@reddit_id = args.fetch("id", nil)
|
9
|
+
@author_name = args.fetch("author", nil)
|
10
|
+
@subreddit_name = args.fetch("subreddit", nil)
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_h
|
14
|
+
{
|
15
|
+
reddit_id: reddit_id,
|
16
|
+
author_name: author_name,
|
17
|
+
subreddit_name: subreddit_name
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
module RedditApi
|
3
|
+
class Comments
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@client = RedditApi::Client.new
|
7
|
+
@comment_factory = RedditApi::Comment
|
8
|
+
end
|
9
|
+
|
10
|
+
def most_recent_subreddits(user, count)
|
11
|
+
subreddits = {}
|
12
|
+
while subreddits.length < count
|
13
|
+
comments = most_recent_comments(user)
|
14
|
+
collect_subreddits(comments, count, subreddits)
|
15
|
+
end
|
16
|
+
subreddits.keys
|
17
|
+
end
|
18
|
+
|
19
|
+
def most_recent_comments(user, count = 100)
|
20
|
+
comments_data = most_recent_comment_data(user.username, count)
|
21
|
+
build_all_comments(comments_data)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
attr_reader :client, :comment_factory
|
26
|
+
|
27
|
+
def most_recent_comment_data(username, count)
|
28
|
+
return [] if username == "[deleted]"
|
29
|
+
endpoint = "user/#{username}/comments.json"
|
30
|
+
client.get(endpoint, count, :comment)
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_all_comments(comments_data)
|
34
|
+
comments_data.map! do |comment_data|
|
35
|
+
build_comment(comment_data)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def build_comment(comment_data)
|
40
|
+
comment_factory.new(comment_data["data"])
|
41
|
+
end
|
42
|
+
|
43
|
+
def collect_subreddits(comments, count, subreddits)
|
44
|
+
comments.each do |comment|
|
45
|
+
subreddits[comment.subreddit_name] = true
|
46
|
+
break if subreddits.length == count
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
module RedditApi
|
3
|
+
class Post
|
4
|
+
|
5
|
+
attr_reader :reddit_id, :author, :subreddit, :stickied
|
6
|
+
|
7
|
+
def initialize(args = {})
|
8
|
+
@reddit_id = args.fetch("id", nil)
|
9
|
+
@author = args.fetch("author", nil)
|
10
|
+
@subreddit = args.fetch("subreddit", nil)
|
11
|
+
@stickied = args.fetch("stickied", nil)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_h
|
15
|
+
{
|
16
|
+
reddit_id: reddit_id,
|
17
|
+
author: author,
|
18
|
+
subreddit: subreddit,
|
19
|
+
stickied: stickied
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
module RedditApi
|
3
|
+
class Posts
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@client = RedditApi::Client.new
|
7
|
+
@post_factory = RedditApi::Post
|
8
|
+
end
|
9
|
+
|
10
|
+
def top(subreddit, count)
|
11
|
+
posts_data = top_data(subreddit, count)
|
12
|
+
posts_data = filter_out(posts_data, :stickied_posts)
|
13
|
+
build_all_posts(posts_data)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
attr_reader :client, :post_factory
|
18
|
+
|
19
|
+
def top_data(subreddit, count)
|
20
|
+
endpoint = URI.encode("r/#{subreddit.name}/hot.json")
|
21
|
+
client.get(endpoint, count, :post)
|
22
|
+
end
|
23
|
+
|
24
|
+
def filter_out(posts_data, filter)
|
25
|
+
send(filter, posts_data)
|
26
|
+
end
|
27
|
+
|
28
|
+
def stickied_posts(posts_data)
|
29
|
+
posts_data.select do |post_data|
|
30
|
+
!post_data["data"]["stickied"]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def build_all_posts(posts_data)
|
35
|
+
posts_data.map! do |post_data|
|
36
|
+
build_post(post_data)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def build_post(post_data)
|
41
|
+
post_factory.new(post_data["data"])
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
module RedditApi
|
3
|
+
class Subreddit
|
4
|
+
attr_reader :reddit_id, :name, :url, :description, :subscriber_count
|
5
|
+
|
6
|
+
def initialize(args = {})
|
7
|
+
@reddit_id = args.fetch("id", nil)
|
8
|
+
@name = args.fetch("display_name", nil)
|
9
|
+
@url = args.fetch("url", nil)
|
10
|
+
@description = args.fetch("public_description", nil)
|
11
|
+
@subscriber_count = args.fetch("subscribers", nil)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_h
|
15
|
+
{
|
16
|
+
reddit_id: reddit_id,
|
17
|
+
name: name,
|
18
|
+
url: url,
|
19
|
+
description: description,
|
20
|
+
subscriber_count: subscriber_count
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
module RedditApi
|
3
|
+
class Subreddits
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@client = RedditApi::Client.new
|
7
|
+
@subreddit_factory = RedditApi::Subreddit
|
8
|
+
end
|
9
|
+
|
10
|
+
def top(count)
|
11
|
+
subreddits_data = top_data(count)
|
12
|
+
build_all_subreddits(subreddits_data)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
attr_reader :client, :subreddit_factory
|
17
|
+
|
18
|
+
def top_data(count)
|
19
|
+
endpoint = "subreddits/popular.json"
|
20
|
+
client.get(endpoint, count, :subreddit)
|
21
|
+
end
|
22
|
+
|
23
|
+
def build_all_subreddits(subreddits_data)
|
24
|
+
subreddits_data.map! do |subreddit_data|
|
25
|
+
build_subreddit(subreddit_data)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def build_subreddit(subreddit_data)
|
30
|
+
subreddit_factory.new(subreddit_data["data"])
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
module RedditApi
|
3
|
+
class Users
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@post_api = RedditApi::Posts.new
|
7
|
+
@user_factory = RedditApi::User
|
8
|
+
end
|
9
|
+
|
10
|
+
def top_posters(subreddit, count)
|
11
|
+
users = {}
|
12
|
+
while users.length < count
|
13
|
+
posts = post_api.top(subreddit, count)
|
14
|
+
collect_users(posts, count, users)
|
15
|
+
end
|
16
|
+
users.values
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
attr_reader :post_api, :user_factory
|
21
|
+
|
22
|
+
def collect_users(posts, count, users)
|
23
|
+
usernames = get_usernames(posts, count, users)
|
24
|
+
user_data = format_user_data(usernames)
|
25
|
+
new_users = build_all_users(user_data)
|
26
|
+
aggregate_users(new_users, users)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_usernames(posts, count, users)
|
30
|
+
usernames = []
|
31
|
+
posts.each_with_index do |post, i|
|
32
|
+
break if (users.length + i) == count
|
33
|
+
usernames << post.author
|
34
|
+
end
|
35
|
+
usernames
|
36
|
+
end
|
37
|
+
|
38
|
+
def format_user_data(usernames)
|
39
|
+
usernames.map! do |username|
|
40
|
+
{ "username" => username }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def build_all_users(users_data)
|
45
|
+
users_data.map! do |user_data|
|
46
|
+
build_user(user_data)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_user(user_data)
|
51
|
+
user_factory.new(user_data)
|
52
|
+
end
|
53
|
+
|
54
|
+
def aggregate_users(new_users, collected_users)
|
55
|
+
new_users.each do |user|
|
56
|
+
collected_users[user.username] = user
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
data/lib/reddit_api.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "reddit_api/version"
|
2
|
+
require "dotenv/load"
|
3
|
+
require "reddit_api/null_response"
|
4
|
+
require "reddit_api/resource_type_prefixes"
|
5
|
+
require "reddit_api/client"
|
6
|
+
require "reddit_api/subreddits"
|
7
|
+
require "reddit_api/subreddit"
|
8
|
+
require "reddit_api/posts"
|
9
|
+
require "reddit_api/post"
|
10
|
+
require "reddit_api/comments"
|
11
|
+
require "reddit_api/comment"
|
12
|
+
require "reddit_api/users"
|
13
|
+
require "reddit_api/user"
|
14
|
+
|
15
|
+
module RedditApi
|
16
|
+
end
|
data/reddit_api.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "reddit_api/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "reddit_api"
|
8
|
+
spec.version = RedditApi::VERSION
|
9
|
+
spec.authors = ["Anthony Fuentes"]
|
10
|
+
spec.email = ["anthony.c.fuentes@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Reddit API wrapper"
|
13
|
+
spec.description = "A friendly inteface for the Reddit API"
|
14
|
+
spec.homepage = "https://github.com/anthonyfuentes/reddit_api"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_dependency "dotenv", "~> 2.2.0"
|
34
|
+
spec.add_dependency "httparty", "~> 0.14.0"
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.5.0"
|
38
|
+
spec.add_development_dependency "guard-rspec", "~> 4.7.3"
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: reddit_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anthony Fuentes
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dotenv
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httparty
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.14.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.14.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.13'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.13'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.5.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.5.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 4.7.3
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 4.7.3
|
97
|
+
description: A friendly inteface for the Reddit API
|
98
|
+
email:
|
99
|
+
- anthony.c.fuentes@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- Gemfile
|
108
|
+
- Guardfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- lib/example_responses/comments.rb
|
115
|
+
- lib/example_responses/posts.rb
|
116
|
+
- lib/example_responses/subreddits.rb
|
117
|
+
- lib/reddit_api.rb
|
118
|
+
- lib/reddit_api/client.rb
|
119
|
+
- lib/reddit_api/comment.rb
|
120
|
+
- lib/reddit_api/comments.rb
|
121
|
+
- lib/reddit_api/null_response.rb
|
122
|
+
- lib/reddit_api/post.rb
|
123
|
+
- lib/reddit_api/posts.rb
|
124
|
+
- lib/reddit_api/resource_type_prefixes.rb
|
125
|
+
- lib/reddit_api/subreddit.rb
|
126
|
+
- lib/reddit_api/subreddits.rb
|
127
|
+
- lib/reddit_api/user.rb
|
128
|
+
- lib/reddit_api/users.rb
|
129
|
+
- lib/reddit_api/version.rb
|
130
|
+
- reddit_api.gemspec
|
131
|
+
homepage: https://github.com/anthonyfuentes/reddit_api
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata:
|
135
|
+
allowed_push_host: https://rubygems.org
|
136
|
+
post_install_message:
|
137
|
+
rdoc_options: []
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
requirements: []
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 2.5.1
|
153
|
+
signing_key:
|
154
|
+
specification_version: 4
|
155
|
+
summary: Reddit API wrapper
|
156
|
+
test_files: []
|