Quantcast
Channel: Active questions tagged feedzirra+ruby+rubygems - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Ruby: How to set feedjira configuration options?

$
0
0

In the Feedjira 2.0 announcement blog post, it says that if you want to set the user agent, that should be a configuration option, but it is not clear how to do this. Ideally, I would like to mimic the options previously provided in Feedjira 1.0, including user_agent, if_modified_since, timeout, and ssl_verify_peer.

http://feedjira.com/blog/2014/04/14/thoughts-on-version-two-point-oh.html

With Feedjira 1.0, you could set those options by making the following call (as described here):

feed_parsed = Feedjira::Feed.fetch_and_parse("http://sports.espn.go.com/espn/rss/news", {:if_modified_since => Time.now, :ssl_verify_peer => false, :timeout => 5, :user_agent => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36"})

The only example I have seen where configuration options are set was from a comment in a github pull request, which is as follows:

Feedjira::Feed.configure do |faraday|
    faraday.request :user_agent, app: "MySite", version: APP_VERSION
end

But when I tried something similar, I received the following error:

undefined method `configure' for Feedjira::Feed:Class

Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images