giphy 1.1.1 → 1.2.0

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: 985230cab97f32c88f2951f8028b6464c442f0a8
4
- data.tar.gz: 9cc2ebd22ba089407fc8a888117cc6cabd20bbfe
3
+ metadata.gz: cd309051cea1c13dfa8ed22b5a2f200d6d7d8446
4
+ data.tar.gz: e1425d1073873285c07ea700b8541f343d7dd489
5
5
  SHA512:
6
- metadata.gz: e1f6f86619faa66ca59d606f368203d37903e96dcfa91018bc09b47da0cbaa56bc3fac1eba9d5ac1cf0b76e9136ef00fb29416455519f51655e5399f0a278907
7
- data.tar.gz: f4cab1159e1a27b8cc2502228ca09d8f951d4698d3e8136ba2e45539505022450b18bcd2330a097e273bb577f7db4526549814917f4ae7953eb5a349ee361c8b
6
+ metadata.gz: c9e7d244fb4b78e0de931a24a10c3bc0c6dd561eab86e0e999ca240e16b80e09aec3ab3afaa0f7ed5227bdd96aad1daeb126fb2455ecce70d7314ca2ab6d04c3
7
+ data.tar.gz: 5cd2d7d65f0c17dbae0321ca535dd52fbdefc31feee0ac988e87606314360647a80c2af497e64c0027c90a25c739232a6ce667fea4de7de4a08ab49b1643c0d0
data/README.md CHANGED
@@ -84,6 +84,12 @@ Giphy.screensaver('surprise')
84
84
  Giphy.random
85
85
  ````
86
86
 
87
+ For getting random gifs with a specific tag:
88
+
89
+ ````ruby
90
+ Giphy.random('american psycho')
91
+ ````
92
+
87
93
  #### Artists
88
94
  ````ruby
89
95
  Giphy.artists
@@ -34,8 +34,8 @@ module Giphy
34
34
  get('/screensaver', tag: tag)
35
35
  end
36
36
 
37
- def random
38
- get('/random')
37
+ def random(tag='')
38
+ get('/random', { tag: tag })
39
39
  end
40
40
 
41
41
  def artists(options={})
@@ -40,8 +40,8 @@ module Giphy
40
40
  gif.new(result)
41
41
  end
42
42
 
43
- def random
44
- result = client.random
43
+ def random(tag='')
44
+ result = client.random(tag)
45
45
  random_gif.new(result)
46
46
  end
47
47
 
@@ -1,3 +1,3 @@
1
1
  module Giphy
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -74,10 +74,19 @@ describe Giphy::Client do
74
74
  end
75
75
  end
76
76
 
77
- describe "#ramdom" do
78
- it "does a GET on the 'random' endpoint" do
79
- Giphy::Request.stub(:get).with('/random', {}).and_return(api_response)
80
- expect(subject.random).to eq response
77
+ describe "#random" do
78
+ context "when no tag is passed to it" do
79
+ it "does a GET on the 'random' endpoint with no tag" do
80
+ Giphy::Request.stub(:get).with('/random', {tag: ''}).and_return(api_response)
81
+ expect(subject.random).to eq response
82
+ end
83
+ end
84
+
85
+ context "when a tag is passed to it" do
86
+ it "does a GET on the 'random' endpoint with a tag" do
87
+ Giphy::Request.stub(:get).with('/random', {tag: 'american psycho'}).and_return(api_response)
88
+ expect(subject.random('american psycho')).to eq response
89
+ end
81
90
  end
82
91
  end
83
92
 
@@ -78,10 +78,20 @@ describe Giphy::Search do
78
78
  end
79
79
 
80
80
  describe "#random" do
81
- it "returns a new Gif from the client result" do
82
- client.stub(random: client_result)
83
- Giphy::RandomGif.stub(:new).with(client_result).and_return(response)
84
- expect(subject.random).to eq response
81
+ context "when no tag is passed to it" do
82
+ it "returns a new Gif from the client result" do
83
+ client.stub(random: client_result)
84
+ Giphy::RandomGif.stub(:new).with(client_result).and_return(response)
85
+ expect(subject.random).to eq response
86
+ end
87
+ end
88
+
89
+ context "when a tag is passed to it" do
90
+ it "returns a new Gif from the client result" do
91
+ client.stub(:random).with('american psycho').and_return(client_result)
92
+ Giphy::RandomGif.stub(:new).with(client_result).and_return(response)
93
+ expect(subject.random('american psycho')).to eq response
94
+ end
85
95
  end
86
96
  end
87
97
 
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: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Sogamoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-22 00:00:00.000000000 Z
11
+ date: 2014-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler