oauth2 0.0.13 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -18,7 +18,16 @@ tmtags
18
18
 
19
19
  ## PROJECT::GENERAL
20
20
  coverage
21
+ doc
21
22
  rdoc
23
+ log
24
+
25
+ ## BUNDLER
26
+ *.gem
27
+ .bundle
22
28
  pkg
23
29
 
30
+ ## RCOV
31
+ coverage.data
32
+
24
33
  ## PROJECT::SPECIFIC
@@ -1,2 +1,3 @@
1
1
  --color
2
2
  --backtrace
3
+ --format=nested
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,44 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ oauth2 (0.0.14)
5
+ faraday (~> 0.5.0)
6
+ multi_json (~> 0.0.4)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ addressable (2.1.2)
12
+ diff-lcs (1.1.2)
13
+ faraday (0.5.0)
14
+ addressable (~> 2.1.1)
15
+ multipart-post (~> 1.0.1)
16
+ rack (~> 1.2.1)
17
+ json_pure (1.4.6)
18
+ multi_json (0.0.4)
19
+ multipart-post (1.0.1)
20
+ rack (1.2.1)
21
+ rake (0.8.7)
22
+ rcov (0.9.9)
23
+ rspec (2.0.0)
24
+ rspec-core (= 2.0.0)
25
+ rspec-expectations (= 2.0.0)
26
+ rspec-mocks (= 2.0.0)
27
+ rspec-core (2.0.0)
28
+ rspec-expectations (2.0.0)
29
+ diff-lcs (>= 1.1.2)
30
+ rspec-mocks (2.0.0)
31
+ rspec-core (= 2.0.0)
32
+ rspec-expectations (= 2.0.0)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ faraday (~> 0.5.0)
39
+ json_pure (~> 1.4.6)
40
+ multi_json (~> 0.0.4)
41
+ oauth2!
42
+ rake (~> 0.8)
43
+ rcov (~> 0.9)
44
+ rspec (~> 2.0)
data/Rakefile CHANGED
@@ -1,51 +1,31 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
3
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "oauth2"
8
- gem.summary = %Q{A Ruby wrapper for the OAuth 2.0 protocol.}
9
- gem.description = %Q{A Ruby wrapper for the OAuth 2.0 protocol built with a similar style to the original OAuth gem.}
10
- gem.email = "michael@intridea.com"
11
- gem.homepage = "http://github.com/intridea/oauth2"
12
- gem.authors = ["Michael Bleigh"]
13
- gem.add_dependency 'faraday', '~> 0.4.1'
14
- gem.add_dependency 'multi_json', '>= 0.0.4'
15
- gem.add_development_dependency "rspec", ">= 1.2.9"
16
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
- end
18
- Jeweler::GemcutterTasks.new
19
-
20
- task :spec => :check_dependencies
21
- rescue LoadError
22
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
4
+ require 'rspec/core/rake_task'
5
+ desc "Run all examples"
6
+ RSpec::Core::RakeTask.new(:spec) do |t|
7
+ t.rspec_opts = %w[--color]
23
8
  end
24
9
 
25
- begin
26
- require 'spec/rake/spectask'
27
- Spec::Rake::SpecTask.new(:spec) do |spec|
28
- spec.libs << 'lib' << 'spec'
29
- spec.spec_files = FileList['spec/**/*_spec.rb']
30
- end
10
+ task :cleanup_rcov_files do
11
+ rm_rf 'coverage.data'
12
+ end
31
13
 
32
- Spec::Rake::SpecTask.new(:rcov) do |spec|
33
- spec.libs << 'lib' << 'spec'
34
- spec.pattern = 'spec/**/*_spec.rb'
35
- spec.rcov = true
14
+ namespace :spec do
15
+ desc "Run all examples using rcov"
16
+ RSpec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
17
+ t.rcov = true
18
+ t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,features"]
19
+ t.rcov_opts << %[--text-report --sort coverage --no-html --aggregate coverage.data]
36
20
  end
37
-
38
- task :default => :spec
39
- rescue LoadError
40
- puts "RSpec (or a dependency) not available. Install it with: gem install rspec"
41
21
  end
42
22
 
23
+ task :default => :spec
24
+
43
25
  require 'rake/rdoctask'
44
26
  Rake::RDocTask.new do |rdoc|
45
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
-
47
27
  rdoc.rdoc_dir = 'rdoc'
48
- rdoc.title = "oauth2 #{version}"
28
+ rdoc.title = "oauth2 #{Oauth2::VERSION}"
49
29
  rdoc.rdoc_files.include('README*')
50
30
  rdoc.rdoc_files.include('lib/**/*.rb')
51
31
  end
data/lib/oauth2.rb CHANGED
@@ -8,5 +8,4 @@ require 'oauth2/client'
8
8
  require 'oauth2/strategy/base'
9
9
  require 'oauth2/strategy/web_server'
10
10
  require 'oauth2/access_token'
11
- require 'oauth2/response_string'
12
- require 'oauth2/response_hash'
11
+ require 'oauth2/response_object'
@@ -9,28 +9,28 @@ module OAuth2
9
9
  @expires_in = (expires_in.nil? || expires_in == '') ? nil : expires_in.to_i
10
10
  @expires_at = Time.now + @expires_in if @expires_in
11
11
  end
12
-
12
+
13
13
  # True if the token in question has an expiration time.
14
14
  def expires?
15
15
  !!@expires_in
16
16
  end
17
-
17
+
18
18
  def request(verb, path, params = {}, headers = {})
19
19
  @client.request(verb, path, params.merge('access_token' => @token), headers.merge('Authorization' => "Token token=\"#{@token}\""))
20
20
  end
21
-
21
+
22
22
  def get(path, params = {}, headers = {})
23
23
  request(:get, path, params, headers)
24
24
  end
25
-
25
+
26
26
  def post(path, params = {}, headers = {})
27
27
  request(:post, path, params, headers)
28
28
  end
29
-
29
+
30
30
  def put(path, params = {}, headers = {})
31
31
  request(:put, path, params, headers)
32
32
  end
33
-
33
+
34
34
  def delete(path, params = {}, headers = {})
35
35
  request(:delete, path, params, headers)
36
36
  end
data/lib/oauth2/client.rb CHANGED
@@ -37,7 +37,7 @@ module OAuth2
37
37
  self.options = opts
38
38
  self.connection = Faraday::Connection.new(site)
39
39
  self.json = opts.delete(:parse_json)
40
-
40
+
41
41
  if adapter && adapter != :test
42
42
  connection.build { |b| b.adapter(adapter) }
43
43
  end
@@ -62,16 +62,13 @@ module OAuth2
62
62
  else
63
63
  resp = connection.run_request(verb, url, params, headers)
64
64
  end
65
+
65
66
  case resp.status
66
- when 200...201
67
+ when 200...201
67
68
  if json?
68
- begin
69
- ResponseHash.new(resp)
70
- rescue StandardError => e
71
- ResponseString.new(resp)
72
- end
69
+ return ResponseObject.from(resp)
73
70
  else
74
- ResponseString.new(resp)
71
+ return ResponseString.new(resp)
75
72
  end
76
73
  when 401
77
74
  e = OAuth2::AccessDenied.new("Received HTTP 401 during request.")
@@ -83,9 +80,9 @@ module OAuth2
83
80
  raise e
84
81
  end
85
82
  end
86
-
83
+
87
84
  def json?; !!@json end
88
85
 
89
86
  def web_server; OAuth2::Strategy::WebServer.new(self) end
90
87
  end
91
- end
88
+ end
@@ -0,0 +1,58 @@
1
+ module OAuth2
2
+ module ResponseObject
3
+ def self.from(response)
4
+ object = MultiJson.decode(response.body)
5
+
6
+ case object
7
+ when Array
8
+ ResponseArray.new(response, object)
9
+ when Hash
10
+ ResponseHash.new(response, object)
11
+ else
12
+ ResponseString.new(response)
13
+ end
14
+ rescue
15
+ ResponseString.new(response)
16
+ end
17
+
18
+ def self.included(base)
19
+ base.class_eval do
20
+ attr_accessor :response
21
+ end
22
+ end
23
+
24
+ def headers; response.headers end
25
+ def status; response.status end
26
+ end
27
+
28
+ class ResponseHash < Hash
29
+ include ResponseObject
30
+
31
+ def initialize(response, hash)
32
+ self.response = response
33
+ hash.keys.each{|k| self[k] = hash[k]}
34
+ end
35
+ end
36
+
37
+ class ResponseArray < Array
38
+ include ResponseObject
39
+
40
+ def initialize(response, array)
41
+ self.response = response
42
+ super(array)
43
+ end
44
+ end
45
+
46
+ # This special String class is returned from HTTP requests
47
+ # and contains the original full response along with convenience
48
+ # methods for accessing the HTTP status code and headers. It
49
+ # is returned from all access token requests.
50
+ class ResponseString < String
51
+ include ResponseObject
52
+
53
+ def initialize(response)
54
+ super(response.body)
55
+ self.response = response
56
+ end
57
+ end
58
+ end
@@ -4,20 +4,20 @@ module OAuth2
4
4
  def initialize(client)#:nodoc:
5
5
  @client = client
6
6
  end
7
-
7
+
8
8
  def authorize_url(options = {}) #:nodoc:
9
9
  @client.authorize_url(authorize_params(options))
10
10
  end
11
-
11
+
12
12
  def authorize_params(options = {}) #:nodoc:
13
- options = options.inject({}){|h,(k,v)| h[k.to_s] = v; h}
13
+ options = options.inject({}){|h, (k, v)| h[k.to_s] = v; h}
14
14
  {'client_id' => @client.id}.merge(options)
15
15
  end
16
-
16
+
17
17
  def access_token_url(options = {})
18
18
  @client.access_token_url(access_token_params(options))
19
19
  end
20
-
20
+
21
21
  def access_token_params(options = {})
22
22
  {
23
23
  'client_id' => @client.id,
@@ -26,4 +26,4 @@ module OAuth2
26
26
  end
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -6,7 +6,7 @@ module OAuth2
6
6
  def authorize_params(options = {}) #:nodoc:
7
7
  super(options).merge('type' => 'web_server')
8
8
  end
9
-
9
+
10
10
  # Retrieve an access token given the specified validation code.
11
11
  # Note that you must also provide a <tt>:redirect_uri</tt> option
12
12
  # in order to successfully verify your request for most OAuth 2.0
@@ -26,13 +26,13 @@ module OAuth2
26
26
  expires_in = params['expires_in']
27
27
  OAuth2::AccessToken.new(@client, access, refresh, expires_in)
28
28
  end
29
-
29
+
30
30
  # <b>DEPRECATED:</b> Use #get_access_token instead.
31
31
  def access_token(*args)
32
32
  warn '[DEPRECATED] OAuth2::Strategy::WebServer#access_token is deprecated, use #get_access_token instead. Will be removed in 0.1.0'
33
33
  get_access_token(*args)
34
34
  end
35
-
35
+
36
36
  def access_token_params(code, options = {}) #:nodoc:
37
37
  super(options).merge({
38
38
  'type' => 'web_server',
@@ -0,0 +1,3 @@
1
+ module Oauth2
2
+ VERSION = "0.1.0"
3
+ end
data/oauth2.gemspec CHANGED
@@ -1,75 +1,25 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/oauth2/version", __FILE__)
5
3
 
6
4
  Gem::Specification.new do |s|
7
- s.name = %q{oauth2}
8
- s.version = "0.0.13"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
5
+ s.name = "oauth2"
6
+ s.version = Oauth2::VERSION
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
11
8
  s.authors = ["Michael Bleigh"]
12
- s.date = %q{2010-08-17}
13
9
  s.description = %q{A Ruby wrapper for the OAuth 2.0 protocol built with a similar style to the original OAuth gem.}
14
- s.email = %q{michael@intridea.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "CHANGELOG.rdoc",
23
- "LICENSE",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "lib/oauth2.rb",
28
- "lib/oauth2/access_token.rb",
29
- "lib/oauth2/client.rb",
30
- "lib/oauth2/response_hash.rb",
31
- "lib/oauth2/response_string.rb",
32
- "lib/oauth2/strategy/base.rb",
33
- "lib/oauth2/strategy/web_server.rb",
34
- "oauth2.gemspec",
35
- "spec/oauth2/access_token_spec.rb",
36
- "spec/oauth2/client_spec.rb",
37
- "spec/oauth2/strategy/base_spec.rb",
38
- "spec/oauth2/strategy/web_server_spec.rb",
39
- "spec/spec.opts",
40
- "spec/spec_helper.rb",
41
- "specs.watchr"
42
- ]
43
- s.homepage = %q{http://github.com/intridea/oauth2}
10
+ s.summary = %q{A Ruby wrapper for the OAuth 2.0 protocol.}
11
+ s.email = "michael@intridea.com"
12
+ s.extra_rdoc_files = ["LICENSE", "README.rdoc"]
44
13
  s.rdoc_options = ["--charset=UTF-8"]
14
+ s.homepage = "http://github.com/intridea/oauth2"
45
15
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.3.7}
47
- s.summary = %q{A Ruby wrapper for the OAuth 2.0 protocol.}
48
- s.test_files = [
49
- "spec/oauth2/access_token_spec.rb",
50
- "spec/oauth2/client_spec.rb",
51
- "spec/oauth2/strategy/base_spec.rb",
52
- "spec/oauth2/strategy/web_server_spec.rb",
53
- "spec/spec_helper.rb"
54
- ]
55
-
56
- if s.respond_to? :specification_version then
57
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
58
- s.specification_version = 3
59
-
60
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
61
- s.add_runtime_dependency(%q<faraday>, ["~> 0.4.1"])
62
- s.add_runtime_dependency(%q<multi_json>, [">= 0.0.4"])
63
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
64
- else
65
- s.add_dependency(%q<faraday>, ["~> 0.4.1"])
66
- s.add_dependency(%q<multi_json>, [">= 0.0.4"])
67
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
68
- end
69
- else
70
- s.add_dependency(%q<faraday>, ["~> 0.4.1"])
71
- s.add_dependency(%q<multi_json>, [">= 0.0.4"])
72
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
73
- end
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.add_runtime_dependency("faraday", "~> 0.5.0")
20
+ s.add_runtime_dependency("multi_json", "~> 0.0.4")
21
+ s.add_development_dependency("json_pure", "~> 1.4.6")
22
+ s.add_development_dependency("rake", "~> 0.8")
23
+ s.add_development_dependency("rcov", "~> 0.9")
24
+ s.add_development_dependency("rspec", "~> 2.0")
74
25
  end
75
-
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe OAuth2::AccessToken do
4
- let(:client) do
5
- cli = OAuth2::Client.new('abc','def', :site => 'https://api.example.com')
4
+ let(:client) do
5
+ cli = OAuth2::Client.new('abc', 'def', :site => 'https://api.example.com')
6
6
  cli.connection.build do |b|
7
7
  b.adapter :test do |stub|
8
8
  stub.get('/client?access_token=monkey') { |env| [200, {}, 'get'] }
@@ -34,27 +34,27 @@ describe OAuth2::AccessToken do
34
34
  end
35
35
  end
36
36
  end
37
-
37
+
38
38
  describe '#expires?' do
39
39
  it 'should be false if there is no expires_at' do
40
40
  OAuth2::AccessToken.new(client, token).should_not be_expires
41
41
  end
42
-
42
+
43
43
  it 'should be true if there is an expires_at' do
44
44
  OAuth2::AccessToken.new(client, token, 'abaca', 600).should be_expires
45
45
  end
46
46
  end
47
-
47
+
48
48
  describe '#expires_at' do
49
49
  before do
50
50
  @now = Time.now
51
51
  Time.stub!(:now).and_return(@now)
52
52
  end
53
-
53
+
54
54
  subject{ OAuth2::AccessToken.new(client, token, 'abaca', 600)}
55
-
55
+
56
56
  it 'should be a time representation of #expires_in' do
57
57
  subject.expires_at.should == (@now + 600)
58
58
  end
59
59
  end
60
- end
60
+ end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe OAuth2::Client do
4
4
  subject do
5
- cli = OAuth2::Client.new('abc','def', :site => 'https://api.example.com')
5
+ cli = OAuth2::Client.new('abc', 'def', :site => 'https://api.example.com')
6
6
  cli.connection.build do |b|
7
7
  b.adapter :test do |stub|
8
8
  stub.get('/success') { |env| [200, {'Content-Type' => 'text/awesome'}, 'yay'] }
@@ -13,13 +13,13 @@ describe OAuth2::Client do
13
13
  end
14
14
  cli
15
15
  end
16
-
16
+
17
17
  describe '#initialize' do
18
18
  it 'should assign id and secret' do
19
19
  subject.id.should == 'abc'
20
20
  subject.secret.should == 'def'
21
21
  end
22
-
22
+
23
23
  it 'should assign site from the options hash' do
24
24
  subject.site.should == 'https://api.example.com'
25
25
  end
@@ -28,18 +28,18 @@ describe OAuth2::Client do
28
28
  subject.connection.host.should == 'api.example.com'
29
29
  end
30
30
  end
31
-
31
+
32
32
  %w(authorize access_token).each do |path_type|
33
33
  describe "##{path_type}_url" do
34
34
  it "should default to a path of /oauth/#{path_type}" do
35
35
  subject.send("#{path_type}_url").should == "https://api.example.com/oauth/#{path_type}"
36
36
  end
37
-
37
+
38
38
  it "should be settable via the :#{path_type}_path option" do
39
39
  subject.options[:"#{path_type}_path"] = '/oauth/custom'
40
40
  subject.send("#{path_type}_url").should == 'https://api.example.com/oauth/custom'
41
41
  end
42
-
42
+
43
43
  it "should be settable via the :#{path_type}_url option" do
44
44
  subject.options[:"#{path_type}_url"] = 'https://abc.com/authorize'
45
45
  subject.send("#{path_type}_url").should == 'https://abc.com/authorize'
@@ -67,31 +67,32 @@ describe OAuth2::Client do
67
67
  it '#web_server should instantiate a WebServer strategy with this client' do
68
68
  subject.web_server.should be_kind_of(OAuth2::Strategy::WebServer)
69
69
  end
70
-
70
+
71
71
  context 'with JSON parsing' do
72
72
  before do
73
73
  subject.json = true
74
74
  end
75
-
75
+
76
76
  describe '#request' do
77
77
  it 'should return a response hash' do
78
- response = subject.request(:get, '/json', {}, {})
79
- response.should be_kind_of(ResponseHash)
78
+ response = subject.request(:get, '/json')
79
+ puts response.inspect
80
+ response.should be_kind_of(OAuth2::ResponseHash)
80
81
  response['abc'].should == 'def'
81
82
  end
82
-
83
+
83
84
  it 'should only try to decode application/json' do
84
85
  subject.request(:get, '/success').should == 'yay'
85
86
  end
86
87
  end
87
-
88
+
88
89
  it 'should set json? based on the :parse_json option' do
89
- OAuth2::Client.new('abc','def', :site => 'http://example.com', :parse_json => true).should be_json
90
- OAuth2::Client.new('abc','def', :site => 'http://example.com', :parse_json => false).should_not be_json
90
+ OAuth2::Client.new('abc', 'def', :site => 'http://example.com', :parse_json => true).should be_json
91
+ OAuth2::Client.new('abc', 'def', :site => 'http://example.com', :parse_json => false).should_not be_json
91
92
  end
92
-
93
+
93
94
  after do
94
95
  subject.json = false
95
96
  end
96
97
  end
97
- end
98
+ end
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe OAuth2::Strategy::Base do
4
4
  it 'should initialize with a Client' do
5
- lambda{ OAuth2::Strategy::Base.new(OAuth2::Client.new('abc','def')) }.should_not raise_error
5
+ lambda{ OAuth2::Strategy::Base.new(OAuth2::Client.new('abc', 'def')) }.should_not raise_error
6
6
  end
7
- end
7
+ end
@@ -2,10 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  describe OAuth2::Strategy::WebServer do
4
4
  let(:client) do
5
- cli = OAuth2::Client.new('abc','def', :site => 'http://api.example.com')
5
+ cli = OAuth2::Client.new('abc', 'def', :site => 'http://api.example.com')
6
6
  cli.connection.build do |b|
7
7
  b.adapter :test do |stub|
8
- stub.post('/oauth/access_token') do |env|
8
+ stub.post('/oauth/access_token') do |env|
9
9
  case @mode
10
10
  when "formencoded"
11
11
  [200, {}, 'expires_in=600&access_token=salmon&refresh_token=trout']
@@ -23,11 +23,11 @@ describe OAuth2::Strategy::WebServer do
23
23
  it 'should include the client_id' do
24
24
  subject.authorize_url.should be_include('client_id=abc')
25
25
  end
26
-
26
+
27
27
  it 'should include the type' do
28
28
  subject.authorize_url.should be_include('type=web_server')
29
29
  end
30
-
30
+
31
31
  it 'should include passed in options' do
32
32
  cb = 'http://myserver.local/oauth/callback'
33
33
  subject.authorize_url(:redirect_uri => cb).should be_include("redirect_uri=#{Rack::Utils.escape(cb)}")
@@ -52,14 +52,14 @@ describe OAuth2::Strategy::WebServer do
52
52
  it 'returns AccessToken with #refresh_token' do
53
53
  @access.refresh_token.should == 'trout'
54
54
  end
55
-
55
+
56
56
  it 'returns AccessToken with #expires_in' do
57
57
  @access.expires_in.should == 600
58
58
  end
59
-
59
+
60
60
  it 'returns AccessToken with #expires_at' do
61
61
  @access.expires_at.should be_kind_of(Time)
62
62
  end
63
63
  end
64
64
  end
65
- end
65
+ end
data/spec/spec_helper.rb CHANGED
@@ -2,11 +2,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'rubygems'
4
4
  require 'oauth2'
5
- require 'spec'
6
- require 'spec/autorun'
5
+ require 'rspec'
6
+ require 'rspec/autorun'
7
7
 
8
8
  Faraday.default_adapter = :test
9
-
10
- Spec::Runner.configure do |config|
11
-
12
- end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 13
10
- version: 0.0.13
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Bleigh
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-17 00:00:00 -05:00
18
+ date: 2010-10-13 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 13
29
+ hash: 11
30
30
  segments:
31
31
  - 0
32
- - 4
33
- - 1
34
- version: 0.4.1
32
+ - 5
33
+ - 0
34
+ version: 0.5.0
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ">="
43
+ - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  hash: 23
46
46
  segments:
@@ -51,21 +51,66 @@ dependencies:
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- name: rspec
54
+ name: json_pure
55
55
  prerelease: false
56
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ">="
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- hash: 13
61
+ hash: 11
62
62
  segments:
63
63
  - 1
64
- - 2
65
- - 9
66
- version: 1.2.9
64
+ - 4
65
+ - 6
66
+ version: 1.4.6
67
67
  type: :development
68
68
  version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ hash: 27
78
+ segments:
79
+ - 0
80
+ - 8
81
+ version: "0.8"
82
+ type: :development
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: rcov
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ hash: 25
93
+ segments:
94
+ - 0
95
+ - 9
96
+ version: "0.9"
97
+ type: :development
98
+ version_requirements: *id005
99
+ - !ruby/object:Gem::Dependency
100
+ name: rspec
101
+ prerelease: false
102
+ requirement: &id006 !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ~>
106
+ - !ruby/object:Gem::Version
107
+ hash: 3
108
+ segments:
109
+ - 2
110
+ - 0
111
+ version: "2.0"
112
+ type: :development
113
+ version_requirements: *id006
69
114
  description: A Ruby wrapper for the OAuth 2.0 protocol built with a similar style to the original OAuth gem.
70
115
  email: michael@intridea.com
71
116
  executables: []
@@ -78,24 +123,25 @@ extra_rdoc_files:
78
123
  files:
79
124
  - .document
80
125
  - .gitignore
126
+ - .rspec
81
127
  - CHANGELOG.rdoc
128
+ - Gemfile
129
+ - Gemfile.lock
82
130
  - LICENSE
83
131
  - README.rdoc
84
132
  - Rakefile
85
- - VERSION
86
133
  - lib/oauth2.rb
87
134
  - lib/oauth2/access_token.rb
88
135
  - lib/oauth2/client.rb
89
- - lib/oauth2/response_hash.rb
90
- - lib/oauth2/response_string.rb
136
+ - lib/oauth2/response_object.rb
91
137
  - lib/oauth2/strategy/base.rb
92
138
  - lib/oauth2/strategy/web_server.rb
139
+ - lib/oauth2/version.rb
93
140
  - oauth2.gemspec
94
141
  - spec/oauth2/access_token_spec.rb
95
142
  - spec/oauth2/client_spec.rb
96
143
  - spec/oauth2/strategy/base_spec.rb
97
144
  - spec/oauth2/strategy/web_server_spec.rb
98
- - spec/spec.opts
99
145
  - spec/spec_helper.rb
100
146
  - specs.watchr
101
147
  has_rdoc: true
@@ -121,10 +167,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
167
  requirements:
122
168
  - - ">="
123
169
  - !ruby/object:Gem::Version
124
- hash: 3
170
+ hash: 23
125
171
  segments:
126
- - 0
127
- version: "0"
172
+ - 1
173
+ - 3
174
+ - 6
175
+ version: 1.3.6
128
176
  requirements: []
129
177
 
130
178
  rubyforge_project:
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.13
@@ -1,13 +0,0 @@
1
- class ResponseHash < Hash
2
- def initialize(response)
3
- self.response = response
4
-
5
- body = MultiJson.decode(response.body)
6
- body.keys.each{|k| self[k] = body[k]}
7
- end
8
-
9
- attr_accessor :response
10
-
11
- def status; response.status end
12
- def headers; response.headers end
13
- end
@@ -1,15 +0,0 @@
1
- # This special String class is returned from HTTP requests
2
- # and contains the original full response along with convenience
3
- # methods for accessing the HTTP status code and headers. It
4
- # is returned from all access token requests.
5
- class ResponseString < String
6
- def initialize(response)
7
- super(response.body)
8
- self.response = response
9
- end
10
-
11
- attr_accessor :response
12
-
13
- def status; response.status end
14
- def headers; response.headers end
15
- end