Skip to content

Commit

Permalink
AuthorizeResponse can read redirect_url when using OAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimeiniesta committed Feb 29, 2012
1 parent 16e8e81 commit 6cf1bf4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/3scale/authorize_response.rb
Expand Up @@ -9,6 +9,7 @@ def initialize

attr_accessor :plan
attr_accessor :app_key
attr_accessor :redirect_url

class UsageReport
attr_reader :metric
Expand Down
1 change: 1 addition & 0 deletions lib/3scale/client.rb
Expand Up @@ -196,6 +196,7 @@ def build_authorize_response(body)
end

response.app_key = doc.at_css('application key').content.to_s.strip
response.redirect_url = doc.at_css('application redirect_url').content.to_s.strip

response.plan = doc.at_css('plan').content.to_s.strip

Expand Down
5 changes: 3 additions & 2 deletions test/client_test.rb
Expand Up @@ -31,7 +31,7 @@ def test_successful_oauth_authorize
<application>
<id>94bd2de3</id>
<key>883bdb8dbc3b6b77dbcf26845560fdbb</key>
<redirect_url></redirect_url>
<redirect_url>http://localhost:8080/oauth/oauth_redirect</redirect_url>
</application>
<plan>Ultimate</plan>
<usage_reports>
Expand All @@ -56,6 +56,7 @@ def test_successful_oauth_authorize
assert response.success?

assert_equal '883bdb8dbc3b6b77dbcf26845560fdbb', response.app_key
assert_equal 'http://localhost:8080/oauth/oauth_redirect', response.redirect_url

assert_equal 'Ultimate', response.plan
assert_equal 2, response.usage_reports.size
Expand All @@ -80,7 +81,7 @@ def test_oauth_authorize_with_exceeded_usage_limits
<application>
<id>94bd2de3</id>
<key>883bdb8dbc3b6b77dbcf26845560fdbb</key>
<redirect_url></redirect_url>
<redirect_url>http://localhost:8080/oauth/oauth_redirect</redirect_url>
</application>
<plan>Ultimate</plan>
<usage_reports>
Expand Down

0 comments on commit 6cf1bf4

Please sign in to comment.