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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cb71e8fcd16075836f4a9582b134c91825bdf96
4
- data.tar.gz: 387602c1ada73880d1d8515045c75b55edc366e3
3
+ metadata.gz: 264ad54f63ddc99d0fba54fc3b13e3739357846c
4
+ data.tar.gz: 02a53d1639d64497bf6ca4eec5a152d3222fb02c
5
5
  SHA512:
6
- metadata.gz: 1a252a3aa26a572e8a841a432d64f6b236f4c70de7b2707202b54ceb3d5133014388de6218d58e30b5462308ddfdb123bf16b5c35c8f90578f64342b4984a33a
7
- data.tar.gz: 32b2579fcff87770557e8cf29ef21420db290a63f0601eaf91d5f15dba45ab2403e5458df4dfba54e006ed52d8a91d464638d55deea7985ff4795b2ac0b0799e
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
- Retrieving a particular endpoint:
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
- The above will return a `Faraday::Response` instance with JSON data in the
38
- `body` attribute.
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
  ------------
@@ -11,13 +11,13 @@ module Reddit
11
11
  end
12
12
 
13
13
  def get(*args, **options)
14
- body = connection.get(*args, *options).body
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, *options).body
20
+ body = connection.post(*args, **options).body
21
21
  body = Reddit::Base::Helpers.simplify body if options[:simplify]
22
22
  body
23
23
  end
@@ -1,5 +1,5 @@
1
1
  module Reddit
2
2
  module Base
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  end
5
5
  end
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.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel O'Brien