jekyll-twitter-plugin 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/jekyll-twitter-plugin.gemspec +1 -1
- data/lib/jekyll-twitter-plugin.rb +28 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6f083737b1d41bae892263082e8080b9bf944c5
|
4
|
+
data.tar.gz: 889f01d000cdd99bd332fbdec15028c3ae69ced5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e43630232086507162c89ea59b6233ee63246ed7dcc161b8c36be698792ad4cc2f5d7787b3e14b2079fca90302cf2074d70f622f1bdf25c2e67fcd34acd7e3a5
|
7
|
+
data.tar.gz: 1b07bac4f9dc337ab373c4aa8f1a9bdecdf957c57b28400e5d5e926346b7e487bb0ba9959d1589ab6d638955021ddc0903c0306804d68dbc9af9ae3e55c626ac
|
data/README.md
CHANGED
@@ -125,6 +125,9 @@ If something goes wrong then a basic error message will be displayed;
|
|
125
125
|
|
126
126
|
> Tweet could not be processed
|
127
127
|
|
128
|
+
If the Twitter client receives one of `Twitter::Error::NotFound, Twitter::Error::Forbidden` errors, this suggests the Tweet is protected or deleted and the following error will be displayed and cached so that it is not fetched again, and again. If the Tweet is restored then simply delete the cached response from `.tweet-cache` directory and build again.
|
129
|
+
|
130
|
+
> There was a '{error name}' error fetching Tweet '{Tweet status url}'
|
128
131
|
|
129
132
|
### Caching
|
130
133
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'jekyll-twitter-plugin'
|
7
|
-
spec.version = '1.
|
7
|
+
spec.version = '1.3.0'
|
8
8
|
spec.authors = ['Rob Murray']
|
9
9
|
spec.email = ['robmurray17@gmail.com']
|
10
10
|
spec.summary = 'A Liquid tag plugin for Jekyll that renders Tweets from Twitter API'
|
@@ -52,6 +52,10 @@ module TwitterJekyll
|
|
52
52
|
end
|
53
53
|
|
54
54
|
class TwitterApi
|
55
|
+
ERRORS_TO_IGNORE = [Twitter::Error::NotFound, Twitter::Error::Forbidden]
|
56
|
+
|
57
|
+
attr_reader :error
|
58
|
+
|
55
59
|
def initialize(client, params)
|
56
60
|
@client = client
|
57
61
|
@status_url = params.shift
|
@@ -70,8 +74,9 @@ module TwitterJekyll
|
|
70
74
|
return unless id
|
71
75
|
|
72
76
|
@client.status(id.to_i)
|
73
|
-
rescue
|
74
|
-
|
77
|
+
rescue *ERRORS_TO_IGNORE => e
|
78
|
+
@error = create_error(e)
|
79
|
+
return nil
|
75
80
|
end
|
76
81
|
|
77
82
|
def parse_args(args)
|
@@ -89,6 +94,10 @@ module TwitterJekyll
|
|
89
94
|
params
|
90
95
|
end
|
91
96
|
end
|
97
|
+
|
98
|
+
def create_error(exception)
|
99
|
+
ErrorResponse.new("There was a '#{exception.class.name}' error fetching Tweet '#{@status_url}'")
|
100
|
+
end
|
92
101
|
end
|
93
102
|
|
94
103
|
class Oembed < TwitterApi
|
@@ -99,6 +108,8 @@ module TwitterJekyll
|
|
99
108
|
|
100
109
|
if tweet = find_tweet(tweet_id)
|
101
110
|
@client.oembed tweet, @params
|
111
|
+
else
|
112
|
+
error
|
102
113
|
end
|
103
114
|
end
|
104
115
|
|
@@ -115,8 +126,22 @@ module TwitterJekyll
|
|
115
126
|
def fetch; end
|
116
127
|
end
|
117
128
|
|
129
|
+
class ErrorResponse
|
130
|
+
def initialize(error)
|
131
|
+
@error = error
|
132
|
+
end
|
133
|
+
|
134
|
+
def html
|
135
|
+
"<p>#{@error}</p>"
|
136
|
+
end
|
137
|
+
|
138
|
+
def to_h
|
139
|
+
{ html: html }
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
118
143
|
class TwitterTag < Liquid::Tag
|
119
|
-
ERROR_BODY_TEXT = 'Tweet could not be processed'
|
144
|
+
ERROR_BODY_TEXT = '<p>Tweet could not be processed</p>'
|
120
145
|
|
121
146
|
def initialize(_name, params, _tokens)
|
122
147
|
super
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-twitter-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Murray
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.4.
|
103
|
+
rubygems_version: 2.4.5
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: A Liquid tag plugin for Jekyll that renders Tweets from Twitter API
|