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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa3500ddeba8701a3cc8c7f729fbfef3c61f95050572bc34327c489842c5744d
4
- data.tar.gz: dd89a38ec4ceed97813e9fc5b73b5df1f1c7568ae0dd6b3ab2e0e6a52d0f7bec
3
+ metadata.gz: 819bba3695f6ec96a66d4a2eca1521ffd70362061267ae43278bc9e2a50263f7
4
+ data.tar.gz: bfe94358ddedce6a9d2fc029c1cef72b7672e6dd29c1a0de7c7ad9535f9b4d74
5
5
  SHA512:
6
- metadata.gz: 8e74fb89776dde8f1c7dfb068ddea721a9a9ce6da67d31aa496673e53efcd0993f3deee7452685d643ab73e56ac56fdf42be59aa11413593ee1de326bd219a2c
7
- data.tar.gz: d9036bccf6f43b8480eb36d7ea3db5dc348e879705e93b92290ea953b04302898caa5cf4a3aea8fda71704291ab0bf1841e3c761873798f72172191f17c57c88
6
+ metadata.gz: f6cf9a9347388458458b433b0397f942b1a1db30712d5cc35155b90ef5ccda42e23eb2dcf5e264b8440fb2cec1b74ba14886718da840824da012f043a5f899fe
7
+ data.tar.gz: 978321586272751213ac40ad55fb4907c868e9e893985b3464be7d8d6e0f8af28242d341f35af9b4bba50708208a0fdc20904c4e00821ab10ad045b8735525f9
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.15.0 - 2022-04-14
11
+
12
+ ### Changed
13
+
14
+ - Use hashed title and content as guid fallback.
15
+
10
16
  ## 0.14.0 - 2022-04-14
11
17
 
12
18
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weneedfeed (0.14.0)
4
+ weneedfeed (0.15.0)
5
5
  activesupport
6
6
  addressable
7
7
  builder
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Weneedfeed
4
- VERSION = '0.14.0'
4
+ VERSION = '0.15.0'
5
5
  end
@@ -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.link %></guid>
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 %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weneedfeed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura