NeonRAW 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d520bb19cf2df3e92d64c328fb23e7131ae2062
4
- data.tar.gz: 7929a149e5b1f874ddaf6efaee7d13360228f23b
3
+ metadata.gz: 2324bfcec373560663e0ec7cf943731d9f587b13
4
+ data.tar.gz: 94018ae2b46d4463542b3b6207a7659024ec4ee4
5
5
  SHA512:
6
- metadata.gz: 4d643134962de3682723c601b1efe3c6a58b49d772e0265c2ce4061e687117c465a1ff110aa7d0e398b665d3cfd6bf32c1362212036ae1489af9b85c185bbad5
7
- data.tar.gz: 752cd17acb19a108d11b8089552ca6be8e7ef203f16203513eea9867258980245fc559c05087c288a4fbcfe589a1b6b1551e08d6d617f0ba0b47a4347ddec935
6
+ metadata.gz: 2da5759365cca36ca2ab91b4816c5afd91e16ecacee526bc14de2cf3e83918f5d68b2022ab26b9a71a0cf5506f92745109b1d91ecf718c90b14dfdd343a8b20c
7
+ data.tar.gz: 386686c61e371303edebc6d788375394dadae5d96281db67a433afb39267afc31172ae5c6d537aabf6354649034df572e0b50a2759e3c71d67a78ba7bf9659d7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.1.5
2
+
3
+ * Changed conditional statement in the ratelimiting so that the client will sleep if requests_remaining is <= 0.
4
+ * Changed Subreddit#info parameter from :id to :name since it takes a fullname instead of the ID.
5
+
1
6
  ## 0.1.4
2
7
 
3
8
  * Renamed flatten_comments to flatten_tree and moved it to the client utilities rather than being a submission method.
@@ -130,7 +130,7 @@ module NeonRAW
130
130
  def handle_ratelimit(headers)
131
131
  requests_remaining = headers['X-Ratelimit-Remaining'].to_i
132
132
  ratelimit_reset = headers['X-Ratelimit-Reset'].to_i
133
- sleep(ratelimit_reset) if requests_remaining.zero?
133
+ sleep(ratelimit_reset) if requests_remaining <= 0
134
134
  end
135
135
 
136
136
  # That URL has already been submitted.
@@ -2,6 +2,9 @@ module NeonRAW
2
2
  module Objects
3
3
  # The object for /r/all.
4
4
  class All
5
+ # @!method initialize(client)
6
+ # @param client [NeonRAW::Clients::Web/Installed/Script] The client
7
+ # object.
5
8
  def initialize(client)
6
9
  @client = client
7
10
  end
@@ -6,11 +6,14 @@ module NeonRAW
6
6
  # Get info on a link/comment/subreddit.
7
7
  # @!method info(params = {})
8
8
  # @param params [Hash] The parameters.
9
- # @option params :id [String] The fullname of the thing.
9
+ # @option params :name [String] The fullname of the thing.
10
10
  # @option params :url [String] The URL of the thing.
11
11
  # @return [NeonRAW::Objects::Comment/Submission/Subreddit] Returns the
12
12
  # object.
13
+ # @see https://www.reddit.com/dev/api#fullnames
13
14
  def info(params = {})
15
+ params[:id] = params[:name]
16
+ params.delete(:name)
14
17
  path = "/r/#{display_name}/api/info"
15
18
  data = @client.request_data(path, :get, params)
16
19
  case data[:data][:children][0][:kind]
@@ -39,7 +42,7 @@ module NeonRAW
39
42
  response = @client.request_data('/api/submit', :post, params)
40
43
  # Seriously though, fucking convoluted data structures.
41
44
  submission_id = response[:jquery].last[3].first.split('/')[6]
42
- info(id: 't3_' + submission_id)
45
+ info(name: 't3_' + submission_id)
43
46
  end
44
47
 
45
48
  # Gets recommended subreddits for the subreddit.
@@ -1,3 +1,3 @@
1
1
  module NeonRAW
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: NeonRAW
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - SirNeon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-23 00:00:00.000000000 Z
11
+ date: 2016-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler