jnewland-fireeagle 0.8.0.1 → 0.8.99.1
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/History.txt +5 -0
- data/lib/fireeagle.rb +0 -12
- data/lib/fireeagle/client.rb +70 -33
- data/lib/fireeagle/version.rb +2 -3
- metadata +14 -7
data/History.txt
CHANGED
data/lib/fireeagle.rb
CHANGED
@@ -52,15 +52,3 @@ class Hash
|
|
52
52
|
false_count == 0 or false_count == size
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
56
|
-
# FireEagle addition to the <code>OAuth::Consumer</code> class
|
57
|
-
class OAuth::Consumer
|
58
|
-
alias_method :create_http_with_verify, :create_http
|
59
|
-
# Monkey patch to silence the SSL warnings
|
60
|
-
def create_http_without_verify #:nodoc:
|
61
|
-
http_object = create_http_with_verify
|
62
|
-
http_object.verify_mode = OpenSSL::SSL::VERIFY_NONE if uri.scheme=="https"
|
63
|
-
http_object
|
64
|
-
end
|
65
|
-
alias_method :create_http, :create_http_without_verify
|
66
|
-
end
|
data/lib/fireeagle/client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module FireEagle
|
2
2
|
class Client
|
3
3
|
# TODO add access_token=() and request_token=() methods that check whether the tokens are usable
|
4
|
-
|
4
|
+
|
5
5
|
attr_reader :access_token, :request_token, :consumer, :format
|
6
6
|
|
7
7
|
# Initialize a FireEagle Client. Takes an options Hash.
|
@@ -20,35 +20,71 @@ module FireEagle
|
|
20
20
|
# [<tt>:app_id</tt>] Your Mobile Application ID
|
21
21
|
# [<tt>:debug</tt>] Boolean
|
22
22
|
#
|
23
|
-
# User-specific OAuth tokens tie
|
24
|
-
# distributed (with keys) to that user's
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
23
|
+
# User-specific OAuth tokens tie Fire Eagle users to your application. As
|
24
|
+
# such, they are intended to be distributed (with keys) to that user's
|
25
|
+
# mobile device and/or computer running your desktop or mobile client. For
|
26
|
+
# web-based applications User-specific tokens will be retrieved by your
|
27
|
+
# web server where they should be treated as private data. Take care to
|
28
|
+
# avoid releasing this data to the public, as the corresponding User's
|
29
|
+
# location information may be inadvertently exposed. User-specific OAuth
|
30
|
+
# tokens should be considered the property of your users.
|
31
|
+
#
|
32
|
+
# General-purpose OAuth tokens are tied to your application and allow you,
|
33
|
+
# as a developer, to make more general (often batch-style) queries against
|
34
|
+
# Fire Eagle. As a result, allowing this token/secret combination loose
|
35
|
+
# has the potential to reveal a much greater amount of personal data. In
|
36
|
+
# an attempt to mitigate this, we will only grant general-purpose tokens
|
37
|
+
# to web applications (contact us with details, if you seek an exception).
|
38
|
+
# In addition, we require developers to provide a restrictive IP range at
|
39
|
+
# registration time in order to further mitigate the risk of
|
40
|
+
# general-purpose tokens being used inappropriately.
|
41
|
+
#
|
42
|
+
# In general, OAuth tokens should be considered sacrosanct in order to
|
43
|
+
# help us respect our users' privacy. Please take this responsibility on
|
44
|
+
# as your own. If your Application Oauth tokens are compromised, Fire
|
45
|
+
# Eagle will turn off your application service until the problem is
|
46
|
+
# resolved.
|
47
|
+
#
|
48
|
+
# If the Client is initialized without an OAuth access token, it's assumed
|
49
|
+
# you're operating a non-web based application.
|
50
|
+
#
|
51
|
+
# == Example web-based authentication flow:
|
52
|
+
#
|
53
|
+
# Initialize a client with your consumer key and consumer secret.
|
54
|
+
#
|
55
|
+
# >> c = FireEagle::Client.new(:consumer_key => "key", :consumer_secret => "sekret")
|
56
|
+
# => #<FireEagle::Client:0x1ce2e70 ... >
|
57
|
+
#
|
58
|
+
# Generate a request token with a +callback_url+:
|
29
59
|
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
# loose has the potential to reveal a much greater amount of personal data. In an attempt to mitigate this, we will
|
33
|
-
# only grant general-purpose tokens to web applications (contact us with details, if you seek an exception). In
|
34
|
-
# addition, we require developers to provide a restrictive IP range at registration time in order to further mitigate
|
35
|
-
# the risk of general-purpose tokens being used inappropriately.
|
60
|
+
# >> c.get_request_token("http://example.com/cb")
|
61
|
+
# => #<OAuth::Token:0x1cdb5bc @token="request_token", @secret="sekret">
|
36
62
|
#
|
37
|
-
#
|
38
|
-
# take this responsibility on as your own. If your Application Oauth tokens are compromised, FireEagle will
|
39
|
-
# turn off your application service until the problem is resolved.
|
63
|
+
# Prompt your user to visit your app's authorization url:
|
40
64
|
#
|
41
|
-
#
|
65
|
+
# >> c.authorization_url
|
66
|
+
# => "http://fireeagle.yahoo.net/oauth/authorize?oauth_token=request_token"
|
67
|
+
#
|
68
|
+
# When the user has completed this step, s/he will be redirected back to
|
69
|
+
# the callback url you configured when obtaining a request token.
|
70
|
+
# +oauth_verifier+ will be present in the callback.
|
71
|
+
#
|
72
|
+
# >> c.convert_to_access_token(oauth_verifier)
|
73
|
+
# => #<OAuth::Token:0x1cd3bf0 @token="access_token", @secret="access_token_secret">
|
42
74
|
#
|
43
75
|
# == Non web-based applications
|
44
76
|
#
|
45
|
-
# For non web-based applications, such as a mobile client application, the
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
77
|
+
# For non web-based applications, such as a mobile client application, the
|
78
|
+
# authentication between the user and the application is slightly
|
79
|
+
# different. The request token is displayed to the user by the client
|
80
|
+
# application. The user then logs into the FireEagle website (using
|
81
|
+
# mobile_authorization_url) and enters this code to authorize the
|
82
|
+
# application. When the user finishes the authorization step the client
|
83
|
+
# application exchanges the request token for an access token (using
|
84
|
+
# +convert_to_access_token+). This is a lightweight method for non-web
|
85
|
+
# application users to authenticate an application without entering any
|
86
|
+
# identifying information into a potentially insecure application. Request
|
87
|
+
# tokens are valid for only 1 hour after being issued.
|
52
88
|
#
|
53
89
|
# == Example mobile-based authentication flow:
|
54
90
|
#
|
@@ -67,9 +103,10 @@ module FireEagle
|
|
67
103
|
# >> c.mobile_authorization_url
|
68
104
|
# => "http://fireeagle.yahoo.net/oauth/mobile_auth/12345"
|
69
105
|
#
|
70
|
-
# Once the user has indicated to you that they've done this
|
106
|
+
# Once the user has indicated to you that they've done this (and provided
|
107
|
+
# a verification code), convert their request token to an access token:
|
71
108
|
#
|
72
|
-
# >> c.convert_to_access_token
|
109
|
+
# >> c.convert_to_access_token(oauth_verifier)
|
73
110
|
# => #<OAuth::Token:0x1cd3bf0 @token="access_token", @secret="access_token_secret">
|
74
111
|
#
|
75
112
|
# You're done!
|
@@ -100,10 +137,10 @@ module FireEagle
|
|
100
137
|
end
|
101
138
|
end
|
102
139
|
|
103
|
-
# Obtain
|
104
|
-
def get_request_token(force_token_regeneration = false)
|
140
|
+
# Obtain a <strong>new</strong> unauthorized OAuth Request token
|
141
|
+
def get_request_token(callback_url = "", force_token_regeneration = false)
|
105
142
|
if force_token_regeneration || @request_token.nil?
|
106
|
-
@request_token = consumer.get_request_token
|
143
|
+
@request_token = consumer.get_request_token(:oauth_callback => callback_url)
|
107
144
|
end
|
108
145
|
@request_token
|
109
146
|
end
|
@@ -120,10 +157,10 @@ module FireEagle
|
|
120
157
|
request_token.authorize_url
|
121
158
|
end
|
122
159
|
|
123
|
-
#Exchange an authorized OAuth Request token for an access token. For use by desktop-based and mobile applications.
|
124
|
-
def convert_to_access_token
|
125
|
-
raise FireEagle::ArgumentError, "call #get_request_token and have user authorize the token first" if @request_token.nil?
|
126
|
-
@access_token = request_token.get_access_token
|
160
|
+
# Exchange an authorized OAuth Request token for an access token. For use by desktop-based and mobile applications.
|
161
|
+
def convert_to_access_token(oauth_verifier)
|
162
|
+
raise FireEagle::ArgumentError, "call #get_request_token and have the user authorize the token first" if @request_token.nil?
|
163
|
+
@access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)
|
127
164
|
end
|
128
165
|
|
129
166
|
# Disambiguates potential values for update query. Results from lookup can be passed to
|
data/lib/fireeagle/version.rb
CHANGED
metadata
CHANGED
@@ -1,28 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jnewland-fireeagle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.99.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Newland
|
8
|
+
- Seth Fitzsimmons
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date: 2009-
|
13
|
+
date: 2009-05-26 00:00:00 -07:00
|
13
14
|
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
|
-
name: oauth
|
17
|
+
name: mojodna-oauth
|
18
|
+
type: :runtime
|
17
19
|
version_requirement:
|
18
20
|
version_requirements: !ruby/object:Gem::Requirement
|
19
21
|
requirements:
|
20
22
|
- - ">="
|
21
23
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.3.
|
24
|
+
version: 0.3.5
|
23
25
|
version:
|
24
26
|
- !ruby/object:Gem::Dependency
|
25
27
|
name: happymapper
|
28
|
+
type: :runtime
|
26
29
|
version_requirement:
|
27
30
|
version_requirements: !ruby/object:Gem::Requirement
|
28
31
|
requirements:
|
@@ -32,6 +35,7 @@ dependencies:
|
|
32
35
|
version:
|
33
36
|
- !ruby/object:Gem::Dependency
|
34
37
|
name: GeoRuby
|
38
|
+
type: :runtime
|
35
39
|
version_requirement:
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
37
41
|
requirements:
|
@@ -41,6 +45,7 @@ dependencies:
|
|
41
45
|
version:
|
42
46
|
- !ruby/object:Gem::Dependency
|
43
47
|
name: hoe
|
48
|
+
type: :development
|
44
49
|
version_requirement:
|
45
50
|
version_requirements: !ruby/object:Gem::Requirement
|
46
51
|
requirements:
|
@@ -48,9 +53,10 @@ dependencies:
|
|
48
53
|
- !ruby/object:Gem::Version
|
49
54
|
version: 1.8.0
|
50
55
|
version:
|
51
|
-
description: Ruby wrapper for Yahoo!'s
|
56
|
+
description: Ruby wrapper for Yahoo!'s Fire Eagle
|
52
57
|
email:
|
53
58
|
- jnewland@gmail.com
|
59
|
+
- seth@mojodna.net
|
54
60
|
executables: []
|
55
61
|
|
56
62
|
extensions: []
|
@@ -97,6 +103,7 @@ files:
|
|
97
103
|
- tasks/rspec.rake
|
98
104
|
has_rdoc: true
|
99
105
|
homepage: http://fireeagle.rubyforge.org
|
106
|
+
licenses:
|
100
107
|
post_install_message:
|
101
108
|
rdoc_options:
|
102
109
|
- --main
|
@@ -118,9 +125,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
125
|
requirements: []
|
119
126
|
|
120
127
|
rubyforge_project: fireeagle
|
121
|
-
rubygems_version: 1.
|
128
|
+
rubygems_version: 1.3.5
|
122
129
|
signing_key:
|
123
130
|
specification_version: 2
|
124
|
-
summary: Ruby wrapper for Yahoo!'s
|
131
|
+
summary: Ruby wrapper for Yahoo!'s Fire Eagle
|
125
132
|
test_files: []
|
126
133
|
|