ruby_desk 0.8.3 → 0.9.0
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/VERSION +1 -1
- data/lib/ruby_desk/connector.rb +12 -1
- data/test/frob.json +1 -0
- data/test/test_ruby_desk.rb +12 -0
- metadata +6 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.0
|
data/lib/ruby_desk/connector.rb
CHANGED
@@ -128,13 +128,24 @@ module RubyDesk
|
|
128
128
|
return parsed_data
|
129
129
|
end
|
130
130
|
|
131
|
-
# Returns the URL that authenticates the application for the current user
|
131
|
+
# Returns the URL that authenticates the application for the current user.
|
132
|
+
# This is used for web applications only
|
132
133
|
def auth_url
|
133
134
|
auth_call = prepare_api_call("", :params=>{:api_key=>@api_key},
|
134
135
|
:base_url=>ODESK_AUTH_URL, :format=>nil, :method=>:get, :auth=>false)
|
135
136
|
data = auth_call[:params].to_a.map{|pair| pair.join '='}.join('&')
|
136
137
|
return auth_call[:url]+"?"+data
|
137
138
|
end
|
139
|
+
|
140
|
+
# Returns a URL that the desktop user should visit to activate current frob.
|
141
|
+
# This method should not be called before a frob has been requested
|
142
|
+
def desktop_auth_url
|
143
|
+
raise "Frob should be requested first. Use RubyDesk::Controller#get_frob()" unless @frob
|
144
|
+
auth_call = prepare_api_call("", :params=>{:api_key=>@api_key, :frob=>@frob},
|
145
|
+
:base_url=>ODESK_AUTH_URL, :format=>nil, :method=>:get, :auth=>false)
|
146
|
+
data = auth_call[:params].to_a.map{|pair| pair.join '='}.join('&')
|
147
|
+
return auth_call[:url]+"?"+data
|
148
|
+
end
|
138
149
|
|
139
150
|
# return the URL that logs user out of odesk applications
|
140
151
|
def logout_url
|
data/test/frob.json
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"server_time":1279785374,"frob":"954461d16a2b843f259f3c059acdd81d"}
|
data/test/test_ruby_desk.rb
CHANGED
@@ -12,6 +12,18 @@ class TestRubyDesk < Test::Unit::TestCase
|
|
12
12
|
end if result_filename
|
13
13
|
return connector
|
14
14
|
end
|
15
|
+
|
16
|
+
def test_desktop_auth_url
|
17
|
+
connector = dummy_connector('frob.json')
|
18
|
+
frob = connector.get_frob
|
19
|
+
assert_equal "954461d16a2b843f259f3c059acdd81d", frob
|
20
|
+
|
21
|
+
desktop_auth_url = connector.desktop_auth_url
|
22
|
+
assert desktop_auth_url =~ /frob=/
|
23
|
+
assert desktop_auth_url =~ /api_key=/
|
24
|
+
assert desktop_auth_url =~ /api_sig=/
|
25
|
+
end
|
26
|
+
|
15
27
|
|
16
28
|
def test_sign
|
17
29
|
connector = RubyDesk::Connector.new('824d225a889aca186c55ac49a6b23957',
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_desk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 9
|
9
|
+
- 0
|
10
|
+
version: 0.9.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ahmed ElDawy
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-22 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/ruby_desk/team_room.rb
|
57
57
|
- lib/ruby_desk/time_report.rb
|
58
58
|
- test/empty_timereport.json
|
59
|
+
- test/frob.json
|
59
60
|
- test/helper.rb
|
60
61
|
- test/jobs.json
|
61
62
|
- test/profile.json
|