-
Notifications
You must be signed in to change notification settings - Fork 49
/
foursquare.rb
48 lines (42 loc) · 1.56 KB
/
foursquare.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$LOAD_PATH << File.dirname(__FILE__)
require "rubygems"
require "typhoeus"
require "json"
require "cgi"
require "foursquare/base"
require "foursquare/checkin_proxy"
require "foursquare/checkin"
require "foursquare/user_proxy"
require "foursquare/user"
require "foursquare/venue_proxy"
require "foursquare/venue"
require "foursquare/settings"
require "foursquare/tip"
require "foursquare/photo"
require "foursquare/location"
require "foursquare/category"
module Foursquare
class Error < StandardError ; end
class InvalidAuth < Foursquare::Error; end
class ServiceUnavailable < Foursquare::Error; end
def self.verbose=(setting)
@verbose = setting
end
def self.verbose?
@verbose
end
def self.log(msg)
return unless verbose?
puts "[foursquare] #{msg}"
end
ERRORS = {
"invalid_auth" => "OAuth token was not provided or was invalid.",
"param_error" => "A required parameter was missing or a parameter was malformed. This is also used if the resource ID in the path is incorrect.",
"endpoint_error" => "The requested path does not exist.",
"not_authorized" => "Although authentication succeeded, the acting user is not allowed to see this information due to privacy restrictions.",
"rate_limit_exceeded" => "Rate limit for this hour exceeded.",
"deprecated" => "Something about this request is using deprecated functionality, or the response format may be about to change.",
"server_error" => "Server is currently experiencing issues. Check status.foursquare.com for udpates.",
"other" => "Some other type of error occurred."
}
end