giphy 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/giphy.gemspec +2 -1
- data/lib/giphy/errors/unexpected.rb +5 -0
- data/lib/giphy/request.rb +5 -2
- data/lib/giphy/response.rb +1 -0
- data/lib/giphy/version.rb +1 -1
- data/spec/giphy/response_spec.rb +9 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 400b63fbcdafa08cc768ee85c1b2525b31d33a50
|
4
|
+
data.tar.gz: 181686b337c64a151569de7deb0338f3c627db91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992b85ca64125dda70ffebf884eba03bfc8627321f0faa273f816a4d5321a69b6eae0b7b1d514a8ce0c1c4c48c0b5cd15a93988e534c4e088eafef898947f2ca
|
7
|
+
data.tar.gz: 4d9e6af5673327a297eef1ef1268f3849b6f8f67384f3e651298317025f41b936cbb72d5bd4bb59339d3ca8cc2e4ce749e56377a929bdf2c147ba4e6f7eb391a
|
data/giphy.gemspec
CHANGED
@@ -19,10 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
-
spec.add_development_dependency "rake", "~> 10.1"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.1"
|
23
23
|
spec.add_development_dependency "rspec", "~> 2.14"
|
24
24
|
spec.add_development_dependency "rspec-its", "~> 1.0"
|
25
25
|
spec.add_dependency "faraday", "~> 0.9"
|
26
|
+
spec.add_dependency "faraday_middleware"
|
26
27
|
spec.add_dependency "faraday_middleware-parse_oj", "~> 0.3"
|
27
28
|
spec.add_dependency "launchy", "~> 2.4"
|
28
29
|
end
|
data/lib/giphy/request.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
2
3
|
require 'faraday_middleware/parse_oj'
|
3
4
|
|
4
5
|
module Giphy
|
@@ -27,9 +28,11 @@ module Giphy
|
|
27
28
|
|
28
29
|
def connection
|
29
30
|
Faraday.new(url: URL) do |connection|
|
30
|
-
connection.
|
31
|
+
connection.use FaradayMiddleware::FollowRedirects
|
32
|
+
connection.use Faraday::Response::RaiseError
|
33
|
+
connection.request :url_encoded
|
31
34
|
connection.response :oj
|
32
|
-
connection.adapter
|
35
|
+
connection.adapter Faraday.default_adapter
|
33
36
|
end
|
34
37
|
end
|
35
38
|
|
data/lib/giphy/response.rb
CHANGED
data/lib/giphy/version.rb
CHANGED
data/spec/giphy/response_spec.rb
CHANGED
@@ -36,5 +36,14 @@ describe Giphy::Response do
|
|
36
36
|
expect{ subject.data }.to raise_error Giphy::Errors::API
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
context "when response is empty" do
|
41
|
+
let(:hash) { nil }
|
42
|
+
|
43
|
+
it "raises an error and sets its message" do
|
44
|
+
expect{ subject.data }.to raise_error Giphy::Errors::Unexpected
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
39
48
|
end
|
40
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: giphy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Sogamoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.9'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: faraday_middleware
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: faraday_middleware-parse_oj
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,6 +146,7 @@ files:
|
|
132
146
|
- lib/giphy/configuration.rb
|
133
147
|
- lib/giphy/errors/api.rb
|
134
148
|
- lib/giphy/errors/argument_error.rb
|
149
|
+
- lib/giphy/errors/unexpected.rb
|
135
150
|
- lib/giphy/favorite_gif.rb
|
136
151
|
- lib/giphy/flagged_gif.rb
|
137
152
|
- lib/giphy/gif.rb
|