redd 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 +4 -4
- data/.travis.yml +3 -6
- data/README.md +9 -8
- data/lib/redd/response/parse_json.rb +3 -3
- data/lib/redd/version.rb +1 -1
- data/redd.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68ca6da5f545b524f8b03e08e6b493b3df260202
|
4
|
+
data.tar.gz: 6358bd923e9c302160b7f4a9bb095d4691741d8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb2902ebe6c5e959e24fc8ba672be642acd35c90667ba3a35023e5fa69ec8336e3f51d6489133e9417377417012879f5954fe405580c17a422a5542bfee7adc
|
7
|
+
data.tar.gz: c7f7c8816778a0c26aa7a49a8ffc514a64dcb22d3e1bb755856cbedb1888e7d6ee3946a0b396167328d090328f90dfbc9e290aa797145d110d7b4e6f42260326
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<p align="center">
|
2
2
|
<img src="github/redd.png?raw=true" alt="redd"><br>
|
3
3
|
<a href="http://badge.fury.io/rb/redd"><img src="https://badge.fury.io/rb/redd.svg" alt="Gem Version" height="18"></a>
|
4
|
-
<a href="https://
|
4
|
+
<a href="https://travis-ci.org/avidw/redd"><img src="https://travis-ci.org/avidw/redd.svg?branch=master" alt="Build Status"></a>
|
5
5
|
</p>
|
6
6
|
|
7
7
|
**redd** is an API wrapper for [reddit](http://reddit.com/dev/api) written in ruby that focuses on being *simple and extensible*.
|
@@ -68,7 +68,7 @@ Ruby and redd make creating reddit bots accessible and fun. To demonstrate, let'
|
|
68
68
|
rescue Redd::Error => e
|
69
69
|
status = e.message.status
|
70
70
|
# 5-something errors are usually errors on reddit's end.
|
71
|
-
raise e unless
|
71
|
+
raise e unless (500...600).include?(status)
|
72
72
|
end
|
73
73
|
```
|
74
74
|
|
@@ -89,12 +89,9 @@ Extending any ruby library, including redd is incredibly easy. Let's try this ou
|
|
89
89
|
# methods.
|
90
90
|
fullname = extract_fullname(thing)
|
91
91
|
|
92
|
-
|
93
|
-
path = "/api/v1/gold/gild/#{fullname}"
|
94
|
-
|
95
|
-
# We're using send instead of object_from_response, because we don't
|
92
|
+
# We're using post instead of object_from_response, because we don't
|
96
93
|
# expect any object from the response.
|
97
|
-
|
94
|
+
post "/api/v1/gold/gild/#{fullname}"
|
98
95
|
end
|
99
96
|
end
|
100
97
|
```
|
@@ -120,7 +117,11 @@ Extending any ruby library, including redd is incredibly easy. Let's try this ou
|
|
120
117
|
```
|
121
118
|
|
122
119
|
## Supported Rubies
|
123
|
-
|
120
|
+
This gem aims to work on the following rubies:
|
121
|
+
|
122
|
+
MRI: **1.9.3** - **2.1.2**
|
123
|
+
JRuby: **1.7.x**
|
124
|
+
Rubinius: **2.x.x**
|
124
125
|
|
125
126
|
## Copyright
|
126
127
|
Copyright (c) [Avinash Dwarapu](http://github.com/avidw) under the MIT License. See LICENSE.md for more details.
|
@@ -4,7 +4,7 @@ module Redd
|
|
4
4
|
# Faraday Middleware that parses JSON using Oj.
|
5
5
|
class ParseJson < Faraday::Middleware
|
6
6
|
dependency do
|
7
|
-
require "
|
7
|
+
require "multi_json" unless defined?(::MultiJson)
|
8
8
|
end
|
9
9
|
|
10
10
|
# Call the middleware.
|
@@ -22,8 +22,8 @@ module Redd
|
|
22
22
|
# @param [String] body The JSON string to parse.
|
23
23
|
# @return [Hash] A symbolized parsed JSON hash.
|
24
24
|
def parse(body)
|
25
|
-
|
26
|
-
rescue
|
25
|
+
MultiJson.load(body, symbolize_keys: true)
|
26
|
+
rescue MultiJson::ParseError
|
27
27
|
body
|
28
28
|
end
|
29
29
|
end
|
data/lib/redd/version.rb
CHANGED
data/redd.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Avinash Dwarapu
|
@@ -123,21 +123,21 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.9.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: multi_json
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '1.10'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ~>
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '1.10'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: memoizable
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - '>='
|