weneedfeed 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/weneedfeed/item.rb +14 -1
- data/lib/weneedfeed/version.rb +1 -1
- data/templates/show_feed.xml.erb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 819bba3695f6ec96a66d4a2eca1521ffd70362061267ae43278bc9e2a50263f7
|
4
|
+
data.tar.gz: bfe94358ddedce6a9d2fc029c1cef72b7672e6dd29c1a0de7c7ad9535f9b4d74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6cf9a9347388458458b433b0397f942b1a1db30712d5cc35155b90ef5ccda42e23eb2dcf5e264b8440fb2cec1b74ba14886718da840824da012f043a5f899fe
|
7
|
+
data.tar.gz: 978321586272751213ac40ad55fb4907c868e9e893985b3464be7d8d6e0f8af28242d341f35af9b4bba50708208a0fdc20904c4e00821ab10ad045b8735525f9
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/weneedfeed/item.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'addressable'
|
4
|
+
require 'digest/sha1'
|
4
5
|
require 'marcel'
|
5
6
|
|
6
7
|
module Weneedfeed
|
@@ -50,6 +51,11 @@ module Weneedfeed
|
|
50
51
|
@node.at(@description_selector)&.inner_html
|
51
52
|
end
|
52
53
|
|
54
|
+
# @return [String]
|
55
|
+
def guid
|
56
|
+
link || hashed_title_and_description
|
57
|
+
end
|
58
|
+
|
53
59
|
# @return [String, nil]
|
54
60
|
def image_mime_type
|
55
61
|
return unless image_url
|
@@ -80,7 +86,7 @@ module Weneedfeed
|
|
80
86
|
).normalize.to_s
|
81
87
|
end
|
82
88
|
|
83
|
-
# @return [String]
|
89
|
+
# @return [String, nil]
|
84
90
|
def link
|
85
91
|
return unless link_path_or_url
|
86
92
|
|
@@ -120,6 +126,13 @@ module Weneedfeed
|
|
120
126
|
|
121
127
|
private
|
122
128
|
|
129
|
+
# @return [String]
|
130
|
+
def hashed_title_and_description
|
131
|
+
source = [title, description].join(':')
|
132
|
+
sha1 = ::Digest::SHA1.hexdigest(source)
|
133
|
+
"urn:sha1:#{sha1}"
|
134
|
+
end
|
135
|
+
|
123
136
|
# @return [Nokogiri::Node, nil]
|
124
137
|
def time_node
|
125
138
|
@node.at(@time_selector)
|
data/lib/weneedfeed/version.rb
CHANGED
data/templates/show_feed.xml.erb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
<% end %>
|
18
18
|
<description><![CDATA[<%= item.description %>]]></description>
|
19
19
|
<content:encoded><![CDATA[<%= item.description %>]]></content:encoded>
|
20
|
-
<guid isPermaLink="true"><%= item.
|
20
|
+
<guid isPermaLink="true"><%= item.guid %></guid>
|
21
21
|
<% if item.image_url %>
|
22
22
|
<enclosure url=<%= item.image_url.encode(xml: :attr) %> length="0" type="<%= item.image_mime_type %>"/>
|
23
23
|
<% end %>
|