gocarrot 0.0.4 → 0.0.5
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.
- data/lib/gocarrot.rb +2 -26
- metadata +2 -2
data/lib/gocarrot.rb
CHANGED
@@ -34,33 +34,9 @@ class Carrot
|
|
34
34
|
@hostname = hostname
|
35
35
|
end
|
36
36
|
|
37
|
-
# Validate
|
37
|
+
# Validate a user with the Carrot service.
|
38
38
|
#
|
39
|
-
# @param
|
40
|
-
#
|
41
|
-
# @return [Symbol] returns one of: `:authorized`, `:read_only`, `:not_created`, or `:unknown`
|
42
|
-
def validate_user(uuid = @uuid)
|
43
|
-
@uuid = uuid
|
44
|
-
http = Net::HTTP.new @hostname, 443
|
45
|
-
http.use_ssl = true
|
46
|
-
request = Net::HTTP::Get.new "/games/#{@app_id}/users.json?id=#{CGI::escape(uuid.to_s)}"
|
47
|
-
response = http.request(request)
|
48
|
-
case response
|
49
|
-
when Net::HTTPSuccess # User has fully-authorized app
|
50
|
-
return :authorized
|
51
|
-
when Net::HTTPUnauthorized # Read-only permissions
|
52
|
-
return :read_only
|
53
|
-
when Net::HTTPClientError # User has not been created
|
54
|
-
return :not_created
|
55
|
-
else
|
56
|
-
puts response.body
|
57
|
-
end
|
58
|
-
return :unknown
|
59
|
-
end
|
60
|
-
|
61
|
-
# Add a user to the Carrot service.
|
62
|
-
#
|
63
|
-
# @param access_token [String] the Facebook user access token for the user to add.
|
39
|
+
# @param access_token [String] the Facebook user access token for the user.
|
64
40
|
# @param uuid [String] a per-user unique identifier or `nil` to use the value of {Carrot#uuid}. We suggest using email address or the Facebook 'third_party_id'.
|
65
41
|
#
|
66
42
|
# @return [Symbol] one of: `:authorized`, `:read_only`, `:not_authorized` or `:unknown`
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gocarrot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Interface with your app on http://gocarrot.com
|
15
15
|
email: pat@gocarrot.com
|