jekyll-giphy 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/jekyll-giphy.rb +32 -0
  3. metadata +45 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 10914b43d8b1965faf24faf93622013187cc2419
4
+ data.tar.gz: b3ea5105f398172bed7cc159d663dc0155f73017
5
+ SHA512:
6
+ metadata.gz: 7ea99ff3c377cd7f497c14d010326ee422c44b8c6d2a46c34a41355a46190447ab1df45fbed1cae3eade951bf10bb90a0279728bc1ddc795f1da7ddd32edaf66
7
+ data.tar.gz: 80be9774a855612eb19841a8ac90d27fe5c198445772216f80161d8a907e8cef4cb6b988e0a1eb01b69ce677f03b18360839744e47495c1b1ac85f92a5f3cc3b
@@ -0,0 +1,32 @@
1
+ require 'net/http'
2
+ require 'json'
3
+
4
+ module Jekyll
5
+ class Giphy < Liquid::Tag
6
+
7
+ @@public_api = "dc6zaTOxFJmzC"
8
+
9
+ def initialize(tagName, markup, tokens)
10
+ super
11
+ @tag = markup
12
+
13
+ end
14
+
15
+ def render(context)
16
+
17
+ uri = URI("http://api.giphy.com/v1/gifs/random?api_key=#{@@public_api}&tag=#{@tag}")
18
+ response = Net::HTTP.get(uri)
19
+ json_response = JSON.parse(response)
20
+ json_raw = json_response['data']
21
+ @image_height = json_raw['image_height']
22
+ @image_width = json_raw['image_width']
23
+ @image = json_raw['image_original_url']
24
+
25
+ "<img src=\"#{@image}\" height=\"#{@image_height}\" width=\"#{@image_width}\" alt=\"#{@tag}\">"
26
+
27
+
28
+ end
29
+ end
30
+ end
31
+
32
+ Liquid::Template.register_tag('giphy', Jekyll::Giphy)
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-giphy
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Valentina Fernandez Alanis (vfalanis)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-06-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Just think about a word/topic and the plugin will randomly select a GIF
14
+ from giphy.com
15
+ email: v.f.alanis@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/jekyll-giphy.rb
21
+ homepage: https://github.com/jasonbellamy/jekyll-giphy
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.5.1
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Plugin for adding Giphy GIFS on Jekyll sites
45
+ test_files: []