feedzirra 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/lib/feedzirra/feed.rb +13 -2
- data/lib/feedzirra/parser/itunes_rss_item.rb +6 -1
- data/lib/feedzirra/version.rb +1 -1
- data/spec/feedzirra/feed_spec.rb +65 -0
- data/spec/feedzirra/parser/itunes_rss_item_spec.rb +2 -2
- 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: cdb3db9a21bc3184dd6da19a6f3d42b705b39b51
|
4
|
+
data.tar.gz: daabebe14cf96c5b64e36c96807be17ce22f8340
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 385cbc0091086ef09db6a9b5c112691342aa01c6cbe96196ec05cbdc768248a6c41eafe6127f9dd94e39a9b1e801696618e04d91f8abfcc063262b74bd247808
|
7
|
+
data.tar.gz: 549fe428debf283e32b6b06887bf2a9b23fffc398e73eced27a8bac13f916a87973775b7171450c237ebb84d8ba8ed1f9ba4faba2541447ec935af922568aeff
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Feedzirra Changelog
|
2
2
|
|
3
|
+
## 0.3.0
|
4
|
+
|
5
|
+
* General
|
6
|
+
* Add CodeClimate badge [[#192](https://github.com/pauldix/feedzirra/pull/192)]
|
7
|
+
|
8
|
+
* Enhancements
|
9
|
+
* CURL SSL Version option [[#156](https://github.com/pauldix/feedzirra/pull/156)]
|
10
|
+
* Cookie support for Curb [[#98](https://github.com/pauldix/feedzirra/pull/98)]
|
11
|
+
|
12
|
+
* Deprecations
|
13
|
+
* For `ITunesRSSItem`, use `id` instead of `guid` [[#169](https://github.com/pauldix/feedzirra/pull/169)]
|
14
|
+
|
3
15
|
## 0.2.2
|
4
16
|
|
5
17
|
* General
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Feedzirra [](http://travis-ci.org/pauldix/feedzirra)
|
1
|
+
# Feedzirra [](http://travis-ci.org/pauldix/feedzirra) [](https://codeclimate.com/github/pauldix/feedzirra)
|
2
2
|
|
3
3
|
I'd like feedback on the api and any bugs encountered on feeds in the wild. I've set up a [google group here](http://groups.google.com/group/feedzirra).
|
4
4
|
|
data/lib/feedzirra/feed.rb
CHANGED
@@ -113,14 +113,23 @@ module Feedzirra
|
|
113
113
|
# Possible parameters:
|
114
114
|
# * :user_agent - overrides the default user agent.
|
115
115
|
# * :compress - any value to enable compression
|
116
|
-
# * :
|
116
|
+
# * :enable_cookies - boolean
|
117
|
+
# * :cookiefile - file to read cookies
|
118
|
+
# * :cookies - contents of cookies header
|
119
|
+
# * :http_authentication - array containing username, then password
|
117
120
|
# * :proxy_url - proxy url
|
118
121
|
# * :proxy_port - proxy port
|
119
122
|
# * :max_redirects - max number of redirections
|
120
123
|
# * :timeout - timeout
|
121
|
-
|
124
|
+
# * :ssl_verify_host - boolean
|
125
|
+
# * :ssl_verify_peer - boolean
|
126
|
+
# * :ssl_version - the ssl version to use, see OpenSSL::SSL::SSLContext::METHODS for options
|
127
|
+
def self.setup_easy(curl, options={})
|
122
128
|
curl.headers["Accept-encoding"] = 'gzip, deflate' if options.has_key?(:compress)
|
123
129
|
curl.headers["User-Agent"] = (options[:user_agent] || USER_AGENT)
|
130
|
+
curl.enable_cookies = options[:enable_cookies] if options.has_key?(:enable_cookies)
|
131
|
+
curl.cookiefile = options[:cookiefile] if options.has_key?(:cookiefile)
|
132
|
+
curl.cookies = options[:cookies] if options.has_key?(:cookies)
|
124
133
|
|
125
134
|
curl.userpwd = options[:http_authentication].join(':') if options.has_key?(:http_authentication)
|
126
135
|
curl.proxy_url = options[:proxy_url] if options.has_key?(:proxy_url)
|
@@ -128,6 +137,8 @@ module Feedzirra
|
|
128
137
|
curl.max_redirects = options[:max_redirects] if options[:max_redirects]
|
129
138
|
curl.timeout = options[:timeout] if options[:timeout]
|
130
139
|
curl.ssl_verify_host = options[:ssl_verify_host] if options.has_key?(:ssl_verify_host)
|
140
|
+
curl.ssl_verify_peer = options[:ssl_verify_peer] if options.has_key?(:ssl_verify_peer)
|
141
|
+
curl.ssl_version = options[:ssl_version] if options.has_key?(:ssl_version)
|
131
142
|
|
132
143
|
curl.follow_location = true
|
133
144
|
end
|
@@ -8,7 +8,7 @@ module Feedzirra
|
|
8
8
|
include FeedEntryUtilities
|
9
9
|
|
10
10
|
element :author
|
11
|
-
element :guid
|
11
|
+
element :guid, :as => :entry_id
|
12
12
|
element :title
|
13
13
|
element :link, :as => :url
|
14
14
|
element :description, :as => :summary
|
@@ -26,6 +26,11 @@ module Feedzirra
|
|
26
26
|
element :enclosure, :value => :length, :as => :enclosure_length
|
27
27
|
element :enclosure, :value => :type, :as => :enclosure_type
|
28
28
|
element :enclosure, :value => :url, :as => :enclosure_url
|
29
|
+
|
30
|
+
def guid
|
31
|
+
warn "Feedzirra: ITunesRSSItem.guid is deprecated, please use `id` or `entry_id` instead. This will be removed in version 1.0"
|
32
|
+
id
|
33
|
+
end
|
29
34
|
end
|
30
35
|
end
|
31
36
|
|
data/lib/feedzirra/version.rb
CHANGED
data/spec/feedzirra/feed_spec.rb
CHANGED
@@ -123,6 +123,71 @@ describe Feedzirra::Feed do
|
|
123
123
|
|
124
124
|
end
|
125
125
|
|
126
|
+
describe "#setup_easy" do
|
127
|
+
class MockCurl
|
128
|
+
attr_accessor :follow_location, :userpwd, :proxy_url, :proxy_port, :max_redirects, :timeout, :ssl_verify_host, :ssl_verify_peer, :ssl_version, :enable_cookies, :cookiefile, :cookies
|
129
|
+
|
130
|
+
def headers
|
131
|
+
@headers ||= {}
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
let(:curl) { MockCurl.new }
|
136
|
+
|
137
|
+
it "sets defaults on curl" do
|
138
|
+
Feedzirra::Feed.setup_easy curl
|
139
|
+
|
140
|
+
curl.headers["User-Agent"].should eq Feedzirra::Feed::USER_AGENT
|
141
|
+
curl.follow_location.should eq true
|
142
|
+
end
|
143
|
+
|
144
|
+
it "allows user agent over-ride" do
|
145
|
+
Feedzirra::Feed.setup_easy(curl, user_agent: '007')
|
146
|
+
curl.headers["User-Agent"].should eq '007'
|
147
|
+
end
|
148
|
+
|
149
|
+
it "enables compression" do
|
150
|
+
Feedzirra::Feed.setup_easy(curl, compress: true)
|
151
|
+
curl.headers["Accept-encoding"].should eq 'gzip, deflate'
|
152
|
+
end
|
153
|
+
|
154
|
+
it "enables compression even when you act like you don't want it" do
|
155
|
+
Feedzirra::Feed.setup_easy(curl, compress: false)
|
156
|
+
curl.headers["Accept-encoding"].should eq 'gzip, deflate'
|
157
|
+
end
|
158
|
+
|
159
|
+
it "sets up http auth" do
|
160
|
+
Feedzirra::Feed.setup_easy(curl, http_authentication: ['user', 'pass'])
|
161
|
+
curl.userpwd.should eq 'user:pass'
|
162
|
+
end
|
163
|
+
|
164
|
+
it "passes known options to curl" do
|
165
|
+
known_options = {
|
166
|
+
enable_cookies: true,
|
167
|
+
cookiefile: 'cookies.txt',
|
168
|
+
cookies: 'asdf',
|
169
|
+
proxy_url: 'http://proxy.url.com',
|
170
|
+
proxy_port: '1234',
|
171
|
+
max_redirects: 2,
|
172
|
+
timeout: 500,
|
173
|
+
ssl_verify_host: true,
|
174
|
+
ssl_verify_peer: true,
|
175
|
+
ssl_version: :omg
|
176
|
+
}
|
177
|
+
|
178
|
+
Feedzirra::Feed.setup_easy curl, known_options
|
179
|
+
|
180
|
+
known_options.each do |option|
|
181
|
+
key, value = option
|
182
|
+
curl.send(key).should eq value
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
it "ignores unknown options" do
|
187
|
+
expect { Feedzirra::Feed.setup_easy curl, foo: :bar }.to_not raise_error
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
126
191
|
describe "when adding feed types" do
|
127
192
|
it "should prioritize added types over the built in ones" do
|
128
193
|
feed_text = "Atom asdf"
|
@@ -29,8 +29,8 @@ describe Feedzirra::Parser::ITunesRSSItem do
|
|
29
29
|
@item.enclosure_url.should == "http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a"
|
30
30
|
end
|
31
31
|
|
32
|
-
it "should parse the guid" do
|
33
|
-
@item.
|
32
|
+
it "should parse the guid as id" do
|
33
|
+
@item.id.should == "http://example.com/podcasts/archive/aae20050615.m4a"
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should parse the published date" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedzirra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Dix
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-11-
|
13
|
+
date: 2013-11-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
185
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.
|
186
|
+
rubygems_version: 2.1.11
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: A feed fetching and parsing library
|