exvo-auth 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
data/exvo-auth.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{exvo-auth}
8
- s.version = "0.7.0"
8
+ s.version = "0.7.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jacek Becela"]
@@ -37,7 +37,8 @@ Gem::Specification.new do |s|
37
37
  "lib/exvo_auth/strategies/interactive.rb",
38
38
  "lib/exvo_auth/strategies/non_interactive.rb",
39
39
  "test/helper.rb",
40
- "test/test_exvo_auth.rb"
40
+ "test/test_exvo_auth.rb",
41
+ "test/test_integration.rb"
41
42
  ]
42
43
  s.homepage = %q{http://github.com/Exvo/Auth}
43
44
  s.rdoc_options = ["--charset=UTF-8"]
@@ -46,7 +47,8 @@ Gem::Specification.new do |s|
46
47
  s.summary = %q{Sign in with Exvo account}
47
48
  s.test_files = [
48
49
  "test/helper.rb",
49
- "test/test_exvo_auth.rb"
50
+ "test/test_exvo_auth.rb",
51
+ "test/test_integration.rb"
50
52
  ]
51
53
 
52
54
  if s.respond_to? :specification_version then
data/lib/exvo-auth.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'omniauth/oauth'
2
2
  require 'multi_json'
3
3
  require 'httparty'
4
+ require 'uri'
4
5
 
5
6
  module ExvoAuth
6
7
  autoload :Config, 'exvo_auth/config'
@@ -50,7 +50,7 @@ class ExvoAuth::Autonomous::Consumer < ExvoAuth::Autonomous::Base
50
50
  end
51
51
 
52
52
  def authorization!
53
- response = httparty.get("/apps/consumer/authorizations/#{params[:provider_id]}.json",
53
+ response = httparty.get("/apps/consumer/authorizations/#{URI.escape(params[:provider_id])}.json",
54
54
  :base_uri => params[:site],
55
55
  :basic_auth => {
56
56
  :username => params[:client_id],
@@ -11,7 +11,7 @@ class ExvoAuth::Autonomous::Provider < ExvoAuth::Autonomous::Base
11
11
  end
12
12
 
13
13
  def scopes!
14
- response = httparty.get("/apps/provider/authorizations/#{params[:consumer_id]}.json",
14
+ response = httparty.get("/apps/provider/authorizations/#{URI.escape(params[:consumer_id])}.json",
15
15
  :base_uri => params[:site],
16
16
  :basic_auth => {
17
17
  :username => params[:client_id],
@@ -20,10 +20,10 @@ class ExvoAuth::Autonomous::Provider < ExvoAuth::Autonomous::Base
20
20
  :query => { :access_token => params[:access_token] }
21
21
  )
22
22
 
23
- if scope = response["scope"] # only cache positive responses
23
+ if scope = response["scope"]
24
24
  @@cache.write(params, scope.split)
25
25
  else
26
- []
26
+ [] # only cache positive responses
27
27
  end
28
28
  end
29
29
  end
@@ -0,0 +1,17 @@
1
+ require 'helper'
2
+
3
+ class TestIntegration < Test::Unit::TestCase
4
+ def setup
5
+ ExvoAuth::Config.host = "https://staging.auth.exvo.com"
6
+ ExvoAuth::Config.client_id = "foo"
7
+ ExvoAuth::Config.client_secret = "bar"
8
+ end
9
+
10
+ test "integration with staging.auth.exvo.com" do
11
+ c = ExvoAuth::Autonomous::Consumer.new(:provider_id => "bar")
12
+ authorization = c.send(:authorization)
13
+ assert_true authorization["access_token"].size > 0
14
+ assert_equal "https://bar/api", authorization["url"]
15
+ end
16
+
17
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 0
9
- version: 0.7.0
8
+ - 1
9
+ version: 0.7.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jacek Becela
@@ -104,6 +104,7 @@ files:
104
104
  - lib/exvo_auth/strategies/non_interactive.rb
105
105
  - test/helper.rb
106
106
  - test/test_exvo_auth.rb
107
+ - test/test_integration.rb
107
108
  has_rdoc: true
108
109
  homepage: http://github.com/Exvo/Auth
109
110
  licenses: []
@@ -137,3 +138,4 @@ summary: Sign in with Exvo account
137
138
  test_files:
138
139
  - test/helper.rb
139
140
  - test/test_exvo_auth.rb
141
+ - test/test_integration.rb