reddit_api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # Ignore application configuration
12
+ .env
13
+
14
+ # Ignore todo
15
+ todo.txt
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format d
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.13.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in reddit_api.gemspec
4
+ gemspec
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
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
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,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -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"=>"&lt;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"=>"&lt;div class=\"md\"&gt;&lt;p&gt;If Reddit could be killed, it&amp;#39;d be dead by now.&lt;/p&gt;\n&lt;/div&gt;", "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" => "&lt;!--...",
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.&lt...",
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"=>"&lt;!-- SC_OFF...",
15
+ "title"=>"Politics",
16
+ "collapse_deleted_comments"=>true,
17
+ "over18"=>false,
18
+ "public_description_html"=>"&lt;!-- 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"=>"&lt;!-- SC_OFF --&gt;&lt;div class=\"md\"&gt;&lt;p&gt;Please read &lt;a href=\"/r/pics/about/sidebar\"&gt;the sidebar&lt;/a&gt; before submitting&lt;/p&gt;\n&lt;/div&gt;&lt;!-- SC_ON --&gt;", "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"=>"&lt;!-- SC_OFF --&gt;&lt;div class=\"md\"&gt;&lt;p&gt;A place to share photographs and pictures. Feel free to post your own, but please &lt;strong&gt;read the rules first&lt;/strong&gt; (see below), and note that we are &lt;em&gt;not a catch-all&lt;/em&gt; for general images (of screenshots, comics, etc.)&lt;/p&gt;\n\n&lt;hr/&gt;\n\n&lt;h1&gt;Spoiler code&lt;/h1&gt;\n\n&lt;p&gt;Please mark spoilers like this:&lt;br/&gt;\n&lt;code&gt;[text here](/spoiler)&lt;/code&gt;&lt;/p&gt;\n\n&lt;p&gt;Hover over to &lt;a href=\"/spoiler\"&gt;read&lt;/a&gt;.&lt;/p&gt;\n\n&lt;hr/&gt;\n\n&lt;p&gt;Check out &lt;a href=\"http://nt.reddit.com/r/pics\"&gt;http://nt.reddit.com/r/pics&lt;/a&gt;!&lt;/p&gt;\n\n&lt;p&gt;Check out &lt;a href=\"/r/pics/w/takedown\"&gt;/r/pics/w/takedown&lt;/a&gt; for help with taking down posts due to copyright or personal identifiable information reasons. &lt;/p&gt;\n\n&lt;hr/&gt;\n\n&lt;h1&gt;&lt;a href=\"/r/pics/about/rules\"&gt;Posting Rules&lt;/a&gt;&lt;/h1&gt;\n\n&lt;ol&gt;\n&lt;li&gt;&lt;p&gt;&lt;strong&gt;No screenshots or pictures of screens. No pictures with added/superimposed text.&lt;/strong&gt; &lt;em&gt;This includes &lt;a href=\"http://en.wikipedia.org/wiki/Image_macro\"&gt;image macros&lt;/a&gt;, comics, maps, infographics, and most diagrams. Text (e.g. a URL) serving to credit the original author is exempt.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;&lt;strong&gt;No porn or gore.&lt;/strong&gt; &lt;em&gt;NSFW content must be tagged.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;&lt;strong&gt;No personal information.&lt;/strong&gt; &lt;em&gt;This includes anything hosted on Facebook&amp;#39;s servers, as they can be traced to the original account holder. Stalking &amp;amp; harassment will not be tolerated.&lt;/em&gt; &lt;strong&gt;&lt;em&gt;No missing-persons requests!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;&lt;strong&gt;Titles must follow all &lt;a href=\"/r/pics/w/titles\"&gt;title guidelines&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;&lt;strong&gt;Submissions must link directly to a specific image file or to a website with minimal ads.&lt;/strong&gt; &lt;em&gt;We do not allow blog hosting of images (&amp;quot;blogspam&amp;quot;), but links to albums on image hosting websites are okay. URL shorteners are prohibited. URLs in image or album descriptions are prohibited.&lt;/em&gt; &lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;&lt;strong&gt;No animated images.&lt;/strong&gt; &lt;em&gt;Please submit them to &lt;a href=\"/r/gif\"&gt;/r/gif&lt;/a&gt;, &lt;a href=\"/r/gifs\"&gt;/r/gifs&lt;/a&gt;, or &lt;a href=\"/r/reactiongifs\"&gt;/r/reactiongifs&lt;/a&gt; instead.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;We enforce a standard of common decency and civility here. &lt;strong&gt;Please be respectful to others.&lt;/strong&gt; 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.&lt;/p&gt;&lt;/li&gt;\n&lt;/ol&gt;\n\n&lt;ul&gt;\n&lt;li&gt;&lt;p&gt;If your submission appears to be filtered, but &lt;strong&gt;definitely&lt;/strong&gt; meets the above rules, &lt;a href=\"/message/compose?to=%23pics\"&gt;please send us a message&lt;/a&gt; with a link to the &lt;strong&gt;comments section&lt;/strong&gt; of your post (not a direct link to the image). &lt;strong&gt;Don&amp;#39;t delete it&lt;/strong&gt; as that just makes the filter hate you! &lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;If you come across any rule violations please report the submission or &lt;a href=\"http://www.reddit.com/message/compose?to=%23pics\"&gt;message the mods&lt;/a&gt; and one of us will remove it!&lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;Serial reposters may be filtered. False claims of ownership will result in a ban.&lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;&lt;strong&gt;Professional photographer or artist?&lt;/strong&gt; Read &lt;a href=\"/r/pics/wiki/professionals\"&gt;these guidelines&lt;/a&gt; for linking to your own site and obtaining &amp;#39;Verified&amp;#39; user flair. &lt;/p&gt;&lt;/li&gt;\n&lt;/ul&gt;\n\n&lt;h1&gt;Links&lt;/h1&gt;\n\n&lt;p&gt;If your post doesn&amp;#39;t meet the above rules, consider submitting it on one of these other subreddits:&lt;/p&gt;\n\n&lt;h1&gt;Subreddits&lt;/h1&gt;\n\n&lt;p&gt;Below is a table of subreddits that you might want to check out!&lt;/p&gt;\n\n&lt;table&gt;&lt;thead&gt;\n&lt;tr&gt;\n&lt;th&gt;Screenshots&lt;/th&gt;\n&lt;th&gt;Advice Animals&lt;/th&gt;\n&lt;/tr&gt;\n&lt;/thead&gt;&lt;tbody&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/images\"&gt;/r/images&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/adviceanimals\"&gt;/r/adviceanimals&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/screenshots\"&gt;/r/screenshots&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/memes\"&gt;/r/memes&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/desktops\"&gt;/r/desktops&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/memesIRL\"&gt;/r/memesIRL&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;strong&gt;Animals&lt;/strong&gt;&lt;/td&gt;\n&lt;td&gt;&lt;strong&gt;More Animals&lt;/strong&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/aww\"&gt;/r/aww&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/rabbits\"&gt;/r/rabbits&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/dogs\"&gt;/r/dogs&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/BeforeNAfterAdoption\"&gt;/r/BeforeNAfterAdoption&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/cats\"&gt;/r/cats&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/otters\"&gt;/r/otters&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/foxes\"&gt;/r/foxes&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/redpandas\"&gt;/r/redpandas&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;strong&gt;GIFS&lt;/strong&gt;&lt;/td&gt;\n&lt;td&gt;&lt;strong&gt;HQ / Curated&lt;/strong&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/gifs\"&gt;/r/gifs&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/pic\"&gt;/r/pic&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/catgifs\"&gt;/r/catgifs&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/earthporn\"&gt;/r/earthporn&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/reactiongifs\"&gt;/r/reactiongifs&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/spaceporn\"&gt;/r/spaceporn&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/tbody&gt;&lt;/table&gt;\n\n&lt;h2&gt;Topic subreddits&lt;/h2&gt;\n\n&lt;p&gt;Every now and then, we choose 2 new topics, and find some subreddits about that topic to feature!&lt;/p&gt;\n\n&lt;table&gt;&lt;thead&gt;\n&lt;tr&gt;\n&lt;th&gt;Comics&lt;/th&gt;\n&lt;th&gt;Art&lt;/th&gt;\n&lt;/tr&gt;\n&lt;/thead&gt;&lt;tbody&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/comics\"&gt;/r/comics&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/Art\"&gt;/r/Art&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/xkcd\"&gt;/r/xkcd&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/ImaginaryBestOf\"&gt;/r/ImaginaryBestOf&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;tr&gt;\n&lt;td&gt;&lt;a href=\"/r/comicbooks\"&gt;/r/comicbooks&lt;/a&gt;&lt;/td&gt;\n&lt;td&gt;&lt;a href=\"/r/IDAP\"&gt;/r/IDAP&lt;/a&gt;&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/tbody&gt;&lt;/table&gt;\n&lt;/div&gt;&lt;!-- SC_ON --&gt;", "title"=>"Reddit Pics", "collapse_deleted_comments"=>true, "over18"=>false, "public_description_html"=>"&lt;!-- SC_OFF --&gt;&lt;div class=\"md\"&gt;&lt;p&gt;A place to share photographs and pictures.&lt;/p&gt;\n&lt;/div&gt;&lt;!-- SC_ON --&gt;", "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 &amp; 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,10 @@
1
+
2
+ module RedditApi
3
+ class NullResponse
4
+
5
+ def code
6
+ 404
7
+ end
8
+
9
+ end
10
+ 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,6 @@
1
+
2
+ TYPE_PREFIXES = {
3
+ comment: "t1",
4
+ post: "t3",
5
+ subreddit: "t5"
6
+ }
@@ -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,16 @@
1
+
2
+ module RedditApi
3
+ class User
4
+
5
+ attr_reader :username
6
+
7
+ def initialize(args = {})
8
+ @username = args.fetch("username", nil)
9
+ end
10
+
11
+ def to_h
12
+ { username: username }
13
+ end
14
+
15
+ end
16
+ 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
+
@@ -0,0 +1,3 @@
1
+ module RedditApi
2
+ VERSION = "0.1.0"
3
+ end
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
@@ -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: []