Sha256: 1302d24cb4ed6c3e06db711497a1572354bdf5d2b0cd243547d864141ac2fa6e
Contents?: true
Size: 892 Bytes
Versions: 1
Compression:
Stored size: 892 Bytes
Contents
require 'httparty' require 'strava/exceptions' module Strava module BaseConnection def fetch(relative_uri, options) response = nil begin response = self.class.get("/#{relative_uri}", :query => options) rescue HTTParty::UnsupportedFormat, HTTParty::UnsupportedURIScheme, HTTParty::ResponseError, HTTParty::RedirectionTooDeep # if it's something we understand, it's probably a bad request. raise RequestError.new rescue Exception => e # anything else is presumably not from HTTParty - throw generic network error. raise NetworkError.new(e) end case response.code when 500...600 raise StravaError.new when 404 raise '404ed' when 200 return response.parsed_response end raise NetworkError.new('Bad status ' + response.code.to_s) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
strava-api-v2-0.1 | lib/strava/base_connection.rb |