reddit-base 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -3
- data/lib/reddit/base/client.rb +2 -2
- data/lib/reddit/base/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 264ad54f63ddc99d0fba54fc3b13e3739357846c
|
4
|
+
data.tar.gz: 02a53d1639d64497bf6ca4eec5a152d3222fb02c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 243387c7510e4b6974f31131822edc2a239911fc2adcb1364eb8d5e3451391f2f31dbba1d9be6fdd91ec7d9a1ccc2085daa2c3b8fec0c15d60d5d75d7cbf0adf
|
7
|
+
data.tar.gz: e07eb437bef94de7acdd3f915d5f77bd70b0094e7114991a22deb93240d6caddb0fe82c6c9ef205852a18c133588da2812ff03062bd2f4ab52514324e1d63d78
|
data/README.md
CHANGED
@@ -27,15 +27,25 @@ Or in your Gemfile with Bundler:
|
|
27
27
|
Basic Usage
|
28
28
|
-------------
|
29
29
|
|
30
|
-
|
30
|
+
Retrieve the JSON for a particular endpoint:
|
31
31
|
|
32
32
|
require 'reddit/base'
|
33
33
|
|
34
34
|
client = Reddit::Base::Client.new(user: USERNAME, password: PASSWORD)
|
35
35
|
client.get('/r/AskReddit')
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
Making a new self post:
|
38
|
+
|
39
|
+
require 'reddit/base'
|
40
|
+
|
41
|
+
client = Reddit::Base::Client.new(user: USERNAME, password: PASSWORD)
|
42
|
+
client.get('/r/AskReddit') # Need to make at least one GET request to retrieve a modhash.
|
43
|
+
client.post('/api/submit', kind: 'self', sr: SUBREDDIT, title: 'Hello,', text: 'World!')
|
44
|
+
|
45
|
+
`Client#get` and `Client#post` accept a `simplify` option to flatten data and kind attributes
|
46
|
+
for easier traversal:
|
47
|
+
|
48
|
+
client.get('/r/AskReddit', simplify: true)
|
39
49
|
|
40
50
|
What it Does
|
41
51
|
------------
|
data/lib/reddit/base/client.rb
CHANGED
@@ -11,13 +11,13 @@ module Reddit
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def get(*args, **options)
|
14
|
-
body = connection.get(*args,
|
14
|
+
body = connection.get(*args, **options).body
|
15
15
|
body = Reddit::Base::Helpers.simplify body if options[:simplify]
|
16
16
|
body
|
17
17
|
end
|
18
18
|
|
19
19
|
def post(*args, **options)
|
20
|
-
body = connection.post(*args,
|
20
|
+
body = connection.post(*args, **options).body
|
21
21
|
body = Reddit::Base::Helpers.simplify body if options[:simplify]
|
22
22
|
body
|
23
23
|
end
|
data/lib/reddit/base/version.rb
CHANGED