reddit-base 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/README.md +35 -11
- data/lib/reddit/base/version.rb +1 -1
- data/reddit-base.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3fb4e405bfd23bc1f041840b615db26dadf957c
|
4
|
+
data.tar.gz: 7185a75f8c788884d0fecb1307f8a6fa5e3e1c90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53c19842b951b856aa5b4ed7b7f5354c715deca5b97dc60a2628ac503e436d28f77a562b34bbb88453d6debdc0ba13a03e45ee1ce21fc1450f613ed805da4de5
|
7
|
+
data.tar.gz: ed6a28235b15a55a88ec24ca935eab60d9a43acbc6493b6e4d4a00b1a08f90a1f5d43696875f41503620200315b0aac7e30539c90518d6c1b5d37f2923bf0e3f
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -18,39 +18,62 @@ Installation
|
|
18
18
|
|
19
19
|
Via Rubygems:
|
20
20
|
|
21
|
-
|
21
|
+
```
|
22
|
+
gem install reddit-base
|
23
|
+
```
|
22
24
|
|
23
25
|
Or in your Gemfile with Bundler:
|
24
26
|
|
25
|
-
|
27
|
+
```
|
28
|
+
gem reddit-base
|
29
|
+
```
|
26
30
|
|
27
31
|
Basic Usage
|
28
32
|
-------------
|
29
33
|
|
30
34
|
Retrieve the JSON for a particular endpoint:
|
31
35
|
|
32
|
-
|
36
|
+
```ruby
|
37
|
+
require 'reddit/base'
|
33
38
|
|
34
|
-
|
35
|
-
|
39
|
+
client = Reddit::Base::Client.new(user: USERNAME, password: PASSWORD)
|
40
|
+
client.get('/r/AskReddit')
|
41
|
+
```
|
36
42
|
|
37
43
|
Making a new self post:
|
38
44
|
|
39
|
-
|
45
|
+
```ruby
|
46
|
+
require 'reddit/base'
|
40
47
|
|
41
|
-
|
42
|
-
|
43
|
-
|
48
|
+
client = Reddit::Base::Client.new(user: USERNAME, password: PASSWORD)
|
49
|
+
client.get('/r/AskReddit') # Need to make at least one GET request to retrieve a modhash.
|
50
|
+
client.post('/api/submit', kind: 'self', sr: SUBREDDIT, title: 'Hello,', text: 'World!')
|
51
|
+
```
|
44
52
|
|
45
53
|
`Client#get` and `Client#post` accept a `simplify` option to flatten data and kind attributes
|
46
54
|
for easier traversal:
|
47
55
|
|
48
|
-
|
56
|
+
```ruby
|
57
|
+
client.get('/r/AskReddit', simplify: true)
|
58
|
+
```
|
59
|
+
|
60
|
+
Several forms of authentication are supported:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
# Username and password.
|
64
|
+
client = Reddit::Base::Client.new(user: USERNAME, password: PASSWORD)
|
65
|
+
|
66
|
+
# Cookie.
|
67
|
+
client = Reddit::Base::Client.new(cookie: COOKIE)
|
68
|
+
|
69
|
+
# OAuth2 access token.
|
70
|
+
client = Reddit::Base::Client.new(access_token: ACCESS_TOKEN)
|
71
|
+
```
|
49
72
|
|
50
73
|
What it Does
|
51
74
|
------------
|
52
75
|
|
53
|
-
* Authentication.
|
76
|
+
* Authentication (user/password, cookie, OAuth2 access token).
|
54
77
|
* Rate limiting.
|
55
78
|
* Modhash handling (reddit's CSRF protection).
|
56
79
|
* JSON coersion.
|
@@ -61,6 +84,7 @@ What it Does
|
|
61
84
|
What it Doesn't
|
62
85
|
---------------
|
63
86
|
|
87
|
+
* OAuth2 token negotiation.
|
64
88
|
* Parsing of Reddit "Things" and "Kinds."
|
65
89
|
* Parsing of common attributes like dates and times.
|
66
90
|
* HTML entity decoding (beware of "body" and "selftext").
|
data/lib/reddit/base/version.rb
CHANGED
data/reddit-base.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reddit-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel O'Brien
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.3.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.3.0
|
55
55
|
description: |-
|
56
56
|
A minimal reddit API client for Ruby that
|
57
57
|
simplifies concerns such authentication, rate limiting and extracting
|
@@ -93,8 +93,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.2.2
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: A minimal reddit API client for Ruby.
|
100
100
|
test_files: []
|
101
|
+
has_rdoc:
|