Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #267 from jxpx777/change-strava-plugin-to-open-uri
Browse files Browse the repository at this point in the history
Change strava plugin from Net::HTTP to open-uri
  • Loading branch information
ttscoff committed Mar 3, 2014
2 parents 9324984 + 42988eb commit c7afb02
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins_disabled/stravalogger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
- strava_units determine what units to display data in: "metric" or "imperial"
=end

require 'rexml/document';
require 'open-uri'
require 'json'

config = {
'description' => ['strava_access_token is an oauth access token for your account. You can obtain one at https://www.strava.com/settings/api',
Expand Down Expand Up @@ -63,15 +64,15 @@ def parse_feed(rss_feed)
tags = "\n\n#{tags}\n" unless tags == ''

begin
res = Net::HTTP.get_response(URI.parse(rss_feed))
res = URI.parse(rss_feed).read
rescue Exception => e
raise "ERROR retrieving Strava activity list url: #{rss_feed} - #{e}"
end

return false if res.nil?

begin
JSON.parse(res.body).each {|activity|
JSON.parse(res).each {|activity|
@log.info("Examining activity #{activity['id']}: #{activity['name']}")

date = Time.parse(activity['start_date_local'])
Expand Down

0 comments on commit c7afb02

Please sign in to comment.