omniauth-vimeo 0.0.1 → 0.0.2

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/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-flattr.gemspec
4
+ gemspec
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Default: run specs.'
6
+ task :default => :spec
7
+
8
+ desc "Run specs"
9
+ RSpec::Core::RakeTask.new
10
+
11
+ desc 'Run specs'
12
+ task :default => :spec
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Vimeo
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -5,36 +5,50 @@ module OmniAuth
5
5
  module Strategies
6
6
  class Vimeo < OmniAuth::Strategies::OAuth
7
7
  option :name, 'vimeo'
8
- option :client_options, {:site => 'http://vimeo.com' }
9
8
 
10
- uid { user['id'] }
9
+ option :client_options, {
10
+ :access_token_path => "/oauth/access_token",
11
+ :authorize_path => "/oauth/authorize",
12
+ :request_token_path => "/oauth/request_token",
13
+ :site => "https://vimeo.com"
14
+ }
15
+
16
+ uid { user_info['id'] }
11
17
 
12
18
  info do
13
19
  {
14
- 'nickname' => user['username'],
15
- 'name' => user['display_name'],
16
- 'location' => user['location'],
17
- 'description' => user['bio'],
18
- 'image' => user['portraits']['portrait'].select{|h| h['height'] == '300'}.first['_content'],
20
+ 'nickname' => user_info['username'],
21
+ 'name' => user_info['display_name'],
22
+ 'location' => user_info['location'],
23
+ 'description' => user_info['bio'],
24
+ 'image' => user_info['portraits']['portrait'].select{|h| h['height'] == '300'}.first['_content'],
19
25
  'urls' => {
20
- 'website' => user['url'],
21
- 'vimeo' => user['profileurl']
26
+ 'website' => user_info['url'],
27
+ 'vimeo' => user_info['profileurl']
22
28
  }
23
29
  }
24
30
  end
25
31
 
26
32
  extra do
27
- { 'user_hash' => user }
33
+ {
34
+ :raw_info => raw_info
35
+ }
36
+ end
37
+
38
+ def user_info
39
+ @user_info ||= raw_info.nil? ? {} : raw_info["person"]
28
40
  end
29
41
 
30
- def user
31
- user_hash['person']
42
+ def raw_info
43
+ @raw_info ||= MultiJson.load(access_token.get('/api/rest/v2?method=vimeo.people.getInfo&format=json').body)
44
+ rescue ::Errno::ETIMEDOUT
45
+ raise ::Timeout::Error
32
46
  end
33
47
 
34
- def user_hash
35
- url = "http://vimeo.com/api/rest/v2?method=vimeo.people.getInfo&format=json"
36
- @user_hash ||= MultiJson.decode(access_token.get(url).body)
48
+ def request_phase
49
+ options[:authorize_params] = {:perms => options[:scope]} if options[:scope]
50
+ super
37
51
  end
38
52
  end
39
53
  end
40
- end
54
+ end
@@ -6,17 +6,20 @@ Gem::Specification.new do |gem|
6
6
  gem.name = "omniauth-vimeo"
7
7
  gem.version = Omniauth::Vimeo::VERSION
8
8
  gem.authors = ["Benjamin Fritsch"]
9
- gem.email = ["ben@lomography.com"]
10
- gem.homepage = "https://github.com/lomography/omniauth-vimeo"
9
+ gem.email = ["beanie@benle.de"]
10
+ gem.homepage = "https://github.com/beanieboi/omniauth-vimeo"
11
11
  gem.description = %q{OmniAuth strategy for Vimeo}
12
12
  gem.summary = gem.description
13
13
 
14
- gem.files = `git ls-files`.split("\n")
15
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
14
+ gem.files = `git ls-files`.split($\)
15
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ["lib"]
18
18
 
19
+ gem.add_runtime_dependency 'multi_json', '~> 1.3'
19
20
  gem.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
21
+ gem.add_development_dependency "rspec", "~> 2.9"
22
+ gem.add_development_dependency 'rake', '~> 0.9'
20
23
 
21
24
  gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
22
- end
25
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Vimeo do
4
+ subject do
5
+ OmniAuth::Strategies::Vimeo.new({})
6
+ end
7
+
8
+ context "client options" do
9
+ it 'should have correct name' do
10
+ subject.options.name.should eq("vimeo")
11
+ end
12
+
13
+ it 'should have correct authorize url' do
14
+ subject.options.client_options.authorize_path.should eq('/oauth/authorize')
15
+ end
16
+
17
+ it 'should have correct request url' do
18
+ subject.options.client_options.request_token_path.should eq('/oauth/request_token')
19
+ end
20
+
21
+ it 'should have correct access url' do
22
+ subject.options.client_options.access_token_path.should eq('/oauth/access_token')
23
+ end
24
+
25
+ it 'should have correct site' do
26
+ subject.options.client_options.site.should eq("https://vimeo.com")
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'rspec'
4
+ require 'omniauth'
5
+ require 'omniauth-vimeo'
6
+
7
+ RSpec.configure do |config|
8
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
9
+ end
metadata CHANGED
@@ -1,82 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: omniauth-vimeo
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 1
9
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Benjamin Fritsch
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-11-08 00:00:00 +01:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: omniauth-oauth
12
+ date: 2012-05-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: multi_json
16
+ requirement: &70093283939860 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :runtime
22
23
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
24
+ version_requirements: *70093283939860
25
+ - !ruby/object:Gem::Dependency
26
+ name: omniauth-oauth
27
+ requirement: &70093283938720 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
25
30
  - - ~>
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 0
30
- version: "1.0"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
31
33
  type: :runtime
32
- version_requirements: *id001
34
+ prerelease: false
35
+ version_requirements: *70093283938720
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70093283937180 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.9'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70093283937180
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: &70093283951800 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.9'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70093283951800
33
58
  description: OmniAuth strategy for Vimeo
34
- email:
35
- - ben@lomography.com
59
+ email:
60
+ - beanie@benle.de
36
61
  executables: []
37
-
38
62
  extensions: []
39
-
40
63
  extra_rdoc_files: []
41
-
42
- files:
64
+ files:
43
65
  - .gitignore
66
+ - Gemfile
44
67
  - README.md
68
+ - Rakefile
45
69
  - lib/omniauth-vimeo.rb
46
70
  - lib/omniauth-vimeo/version.rb
47
71
  - lib/omniauth/strategies/vimeo.rb
48
72
  - omniauth-vimeo.gemspec
49
- has_rdoc: true
50
- homepage: https://github.com/lomography/omniauth-vimeo
73
+ - spec/omniauth/strategies/vimeo_spec.rb
74
+ - spec/spec_helper.rb
75
+ homepage: https://github.com/beanieboi/omniauth-vimeo
51
76
  licenses: []
52
-
53
77
  post_install_message:
54
78
  rdoc_options: []
55
-
56
- require_paths:
79
+ require_paths:
57
80
  - lib
58
- required_ruby_version: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- segments:
63
- - 0
64
- version: "0"
65
- required_rubygems_version: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 1
71
- - 3
72
- - 6
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
73
92
  version: 1.3.6
74
93
  requirements: []
75
-
76
94
  rubyforge_project:
77
- rubygems_version: 1.3.6
95
+ rubygems_version: 1.8.17
78
96
  signing_key:
79
97
  specification_version: 3
80
98
  summary: OmniAuth strategy for Vimeo
81
- test_files: []
82
-
99
+ test_files:
100
+ - spec/omniauth/strategies/vimeo_spec.rb
101
+ - spec/spec_helper.rb