redd 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -8
- data/bin/console +42 -16
- data/lib/redd.rb +50 -19
- data/lib/redd/api_client.rb +18 -27
- data/lib/redd/auth_strategies/auth_strategy.rb +4 -3
- data/lib/redd/auth_strategies/script.rb +6 -1
- data/lib/redd/auth_strategies/userless.rb +6 -1
- data/lib/redd/auth_strategies/web.rb +4 -4
- data/lib/redd/models/access.rb +6 -1
- data/lib/redd/models/basic_model.rb +12 -55
- data/lib/redd/models/comment.rb +24 -28
- data/lib/redd/models/front_page.rb +1 -1
- data/lib/redd/models/gildable.rb +13 -0
- data/lib/redd/models/inboxable.rb +3 -3
- data/lib/redd/models/lazy_model.rb +7 -8
- data/lib/redd/models/listing.rb +6 -7
- data/lib/redd/models/live_thread.rb +9 -11
- data/lib/redd/models/mod_mail.rb +19 -24
- data/lib/redd/models/more_comments.rb +1 -1
- data/lib/redd/models/multireddit.rb +9 -13
- data/lib/redd/models/postable.rb +3 -3
- data/lib/redd/models/private_message.rb +18 -9
- data/lib/redd/models/searchable.rb +1 -1
- data/lib/redd/models/session.rb +31 -2
- data/lib/redd/models/submission.rb +26 -14
- data/lib/redd/models/subreddit.rb +115 -19
- data/lib/redd/models/user.rb +21 -9
- data/lib/redd/models/wiki_page.rb +8 -11
- data/lib/redd/utilities/unmarshaller.rb +3 -2
- data/lib/redd/version.rb +1 -1
- data/redd.gemspec +1 -1
- metadata +4 -5
- data/TODO.md +0 -8
- data/lib/redd/auth_strategies/installed.rb +0 -22
@@ -15,6 +15,7 @@ module Redd
|
|
15
15
|
'more' => Models::MoreComments,
|
16
16
|
'wikipage' => Models::WikiPage,
|
17
17
|
'Listing' => Models::Listing,
|
18
|
+
'modaction' => Models::Subreddit::ModAction,
|
18
19
|
'LabeledMulti' => Models::Multireddit,
|
19
20
|
'LiveUpdate' => Models::LiveThread::LiveUpdate
|
20
21
|
}.freeze
|
@@ -26,12 +27,12 @@ module Redd
|
|
26
27
|
def unmarshal(response)
|
27
28
|
if response[:json] && response[:json][:data]
|
28
29
|
if response[:json][:data][:things]
|
29
|
-
Models::Listing.
|
30
|
+
Models::Listing.new(@client, children: response[:json][:data][:things])
|
30
31
|
else
|
31
32
|
Models::BasicModel.new(@client, response[:json][:data])
|
32
33
|
end
|
33
34
|
elsif MAPPING.key?(response[:kind])
|
34
|
-
MAPPING[response[:kind]].
|
35
|
+
MAPPING[response[:kind]].new(@client, response[:data])
|
35
36
|
else
|
36
37
|
raise "unknown type to unmarshal: #{response[:kind].inspect}"
|
37
38
|
end
|
data/lib/redd/version.rb
CHANGED
data/redd.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.authors = ['Avinash Dwarapu']
|
12
12
|
spec.email = ['avinash@dwarapu.me']
|
13
13
|
|
14
|
-
spec.summary = '
|
14
|
+
spec.summary = 'A batteries-included API wrapper for reddit.'
|
15
15
|
spec.homepage = 'https://github.com/avinashbot/redd'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Avinash Dwarapu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -137,13 +137,11 @@ files:
|
|
137
137
|
- LICENSE.txt
|
138
138
|
- README.md
|
139
139
|
- Rakefile
|
140
|
-
- TODO.md
|
141
140
|
- bin/console
|
142
141
|
- bin/setup
|
143
142
|
- lib/redd.rb
|
144
143
|
- lib/redd/api_client.rb
|
145
144
|
- lib/redd/auth_strategies/auth_strategy.rb
|
146
|
-
- lib/redd/auth_strategies/installed.rb
|
147
145
|
- lib/redd/auth_strategies/script.rb
|
148
146
|
- lib/redd/auth_strategies/userless.rb
|
149
147
|
- lib/redd/auth_strategies/web.rb
|
@@ -153,6 +151,7 @@ files:
|
|
153
151
|
- lib/redd/models/basic_model.rb
|
154
152
|
- lib/redd/models/comment.rb
|
155
153
|
- lib/redd/models/front_page.rb
|
154
|
+
- lib/redd/models/gildable.rb
|
156
155
|
- lib/redd/models/inboxable.rb
|
157
156
|
- lib/redd/models/lazy_model.rb
|
158
157
|
- lib/redd/models/listing.rb
|
@@ -201,5 +200,5 @@ rubyforge_project:
|
|
201
200
|
rubygems_version: 2.6.8
|
202
201
|
signing_key:
|
203
202
|
specification_version: 4
|
204
|
-
summary:
|
203
|
+
summary: A batteries-included API wrapper for reddit.
|
205
204
|
test_files: []
|
data/TODO.md
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'auth_strategy'
|
4
|
-
|
5
|
-
module Redd
|
6
|
-
module AuthStrategies
|
7
|
-
# For non-confidential apps. Different from the implicit grant.
|
8
|
-
class Installed < AuthStrategy
|
9
|
-
def initialize(client_id:, redirect_uri:, **kwargs)
|
10
|
-
super(client_id: client_id, secret: '', **kwargs)
|
11
|
-
@redirect_uri = redirect_uri
|
12
|
-
end
|
13
|
-
|
14
|
-
# Authenticate with a code using the "web" flow.
|
15
|
-
# @param code [String] the code returned by reddit
|
16
|
-
# @return [Access]
|
17
|
-
def authenticate(code)
|
18
|
-
request_access('authorization_code', code: code, redirect_uri: @redirect_uri)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|