omniauth-vimeo 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a1ca6fb536eb3083346e4e32739614c29eb5176
4
- data.tar.gz: bd13e8a1a4a835e5c83a8749301beed41e5570ee
3
+ metadata.gz: d223d102e7685cd4248fcbd3b5d82033308fd966
4
+ data.tar.gz: 8ca22cdc93c1b36053114a8532f9c18f25b273a0
5
5
  SHA512:
6
- metadata.gz: 322cf7013355f7993686641c2af62c65d4293ebeb1e3ffb0498d468337dfa7b2abfa62a3b389023150ea9dba056bf238494adcc6da39d425a9389fcafa8fbdb9
7
- data.tar.gz: 419e58e80bbb00f1f62d9f45a1c1991af75ae34a5154c07845cf2e1a4c556be51e411958e21495039ba39df8ce1a46f36f54313be00112f16186a518b0102595
6
+ metadata.gz: 8276da39d9d593641775f4eff458659c366451acb80e6feb482a9be4acf5511b2e753c3a35b72e6f8e0e5751582ee02511c0a57e1b0a133e7dea23bc223d28d0
7
+ data.tar.gz: 685bb33b85a1c7b5d09d12ff7eb2f6db1608238c37e3d8e659cdd071de9744238964245ad021e091ce3592503e010bf6087d519146084c44f084dad132267f80
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  .DS_Store
2
+ app/
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.2.1
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ script: rspec spec
4
+
5
+ rvm:
6
+ - 2.0.0
7
+ - 2.1.0
8
+ - 2.2.1
9
+ - jruby-19mode
10
+ - rbx-2
11
+ - ruby-head
data/Changes.md ADDED
@@ -0,0 +1,36 @@
1
+ 2.0.0 / 2012-06-23
2
+ ==================
3
+ - implemented new OAuth2 API
4
+ - add travis.yml to test multiple rubies
5
+ - update readme
6
+ - added changelog
7
+
8
+ 1.0.2 / 2012-06-23
9
+ ==================
10
+ - converted specs to expect syntax
11
+ - bump dependencies
12
+
13
+ 1.0.1 / 2013-10-03
14
+ ==================
15
+ - split installation and usage section in Readme
16
+ - added section on how to use permissions
17
+ - added license to gemspec
18
+ - rename perms -> permissions
19
+
20
+ 1.0.0 / 2012-06-23
21
+ ==================
22
+ - Readme change
23
+ - added Travis
24
+ - added Gemnaium
25
+
26
+ 0.0.2 / 2012-05-17
27
+ ==================
28
+ - added Readme
29
+ - added missing multi_json dependency
30
+ - update author info in gemspec
31
+
32
+
33
+ 0.0.1 / 2011-11-08
34
+ ==================
35
+
36
+ - first working version
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  This is an OmniAuth strategy for authenticating to Vimeo. To
4
4
  use it, you'll need to sign up for an OAuth Application ID and Secret
5
5
  on the [Vimeo Applications Page](https://developer.vimeo.com/apps).
6
- You can read more about Vimdeo's oauth over at their [developer page](https://developer.vimeo.com/apis/advanced#oauth)
6
+ You can read more about Vimdeo's OAuth over at their [developer page](https://developer.vimeo.com/api/authentication)
7
7
 
8
8
 
9
9
  ## Installation
@@ -40,9 +40,68 @@ Open the following URL and connect your Vimeo account with your application:
40
40
 
41
41
  /auth/vimeo
42
42
 
43
+ ## Sample Auth Hash
44
+ {
45
+ "provider"=>"vimeo",
46
+ "uid"=>5387263,
47
+ "info"=>{
48
+ "id"=>5387263,
49
+ "nickname"=>"beanieboi",
50
+ "name"=>"beanie",
51
+ "bio"=>nil,
52
+ "account"=>"basic",
53
+ "location"=>nil,
54
+ "pictures"=>[
55
+ {
56
+ "type"=>"portrait",
57
+ "width"=>30,
58
+ "height"=>30,
59
+ "link"=>"https://i.vimeocdn.com/portrait/2249717_30x30.jpg"
60
+ },
61
+ {
62
+ "type"=>"portrait",
63
+ "width"=>75,
64
+ "height"=>75,
65
+ "link"=>"https://i.vimeocdn.com/portrait/2249717_75x75.jpg"
66
+ },
67
+ {
68
+ "type"=>"portrait",
69
+ "width"=>100,
70
+ "height"=>100,
71
+ "link"=>"https://i.vimeocdn.com/portrait/2249717_100x100.jpg"
72
+ },
73
+ {
74
+ "type"=>"portrait",
75
+ "width"=>300,
76
+ "height"=>300,
77
+ "link"=>"https://i.vimeocdn.com/portrait/2249717_300x300.jpg"
78
+ }
79
+ ],
80
+ "websites"=>[],
81
+ "content_filter"=>[
82
+ "language",
83
+ "drugs",
84
+ "violence",
85
+ "nudity",
86
+ "safe",
87
+ "unrated"
88
+ ],
89
+ "created_time"=>"2010-12-03T17:57:33+00:00",
90
+ "link"=>"https://vimeo.com/beanieboi",
91
+ "uri"=>"/users/5387263"
92
+ },
93
+ "credentials"=>{
94
+ "token"=>"token",
95
+ "expires"=>false
96
+ },
97
+ "extra"=>{
98
+ "scope"=>"public private"
99
+ }
100
+ }
101
+
43
102
  ## Supported Rubies
44
103
 
45
- OmniAuth Vimeo is tested under 1.8.7, 1.9.2, 1.9.3 and Ruby Enterprise Edition.
104
+ OmniAuth Vimeo is tested under 2.0 and above
46
105
 
47
106
  [![Build Status](https://secure.travis-ci.org/beanieboi/omniauth-vimeo.png?branch=master)](http://travis-ci.org/beanieboi/omniauth-vimeo)
48
107
 
@@ -56,7 +115,7 @@ OmniAuth Vimeo is tested under 1.8.7, 1.9.2, 1.9.3 and Ruby Enterprise Edition.
56
115
 
57
116
  ## License
58
117
 
59
- Copyright (c) 2011 Benjamin Fritsch.
118
+ Copyright (c) 2015 Benjamin Fritsch.
60
119
 
61
120
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
62
121
 
@@ -1,53 +1,55 @@
1
- require 'omniauth-oauth'
2
- require 'multi_json'
1
+ require 'omniauth-oauth2'
3
2
 
4
3
  module OmniAuth
5
4
  module Strategies
6
- class Vimeo < OmniAuth::Strategies::OAuth
5
+ class Vimeo < OmniAuth::Strategies::OAuth2
7
6
  option :name, 'vimeo'
8
7
 
9
8
  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"
9
+ token_url: "/oauth/access_token",
10
+ authorize_url: "/oauth/authorize",
11
+ site: "https://api.vimeo.com"
14
12
  }
15
13
 
16
- uid { user_info['id'] }
14
+ uid { info['id'] }
17
15
 
18
16
  info do
19
17
  {
20
- 'nickname' => user_info['username'],
21
- 'name' => user_info['display_name'],
18
+ 'id' => user_info['uri'].split('/').last.to_i,
19
+ 'nickname' => user_info['link'].split('/').last,
20
+ 'name' => user_info['name'],
21
+ 'bio' => user_info['bio'],
22
+ 'account' => user_info['account'],
22
23
  'location' => user_info['location'],
23
- 'description' => user_info['bio'],
24
- 'image' => user_info['portraits']['portrait'].select{|h| h['height'] == '300'}.first['_content'],
25
- 'urls' => {
26
- 'website' => user_info['url'],
27
- 'vimeo' => user_info['profileurl']
28
- }
29
- }
30
- end
31
-
32
- extra do
33
- {
34
- :raw_info => raw_info
24
+ 'pictures' => user_info['pictures'],
25
+ 'websites' => user_info['websites'],
26
+ 'content_filter' => user_info['content_filter'],
27
+ 'created_time' => user_info['created_time'],
28
+ 'link' => user_info['link'],
29
+ 'uri' => user_info['uri'],
35
30
  }
36
31
  end
37
32
 
38
33
  def user_info
39
- @user_info ||= raw_info.nil? ? {} : raw_info["person"]
34
+ access_token.params['user']
40
35
  end
41
36
 
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
37
+ credentials do
38
+ _credentials = {'token' => access_token.token}
39
+
40
+ if access_token.expires? && access_token.refresh_token
41
+ _credentials = _credentials.merge('refresh_token' => access_token.refresh_token)
42
+ end
43
+
44
+ if access_token.expires?
45
+ _credentials = _credentials.merge('expires_at' => access_token.expires_at)
46
+ end
47
+
48
+ _credentials.merge!('expires' => access_token.expires?)
46
49
  end
47
50
 
48
- def request_phase
49
- options[:authorize_params] = {:permission => options[:scope]} if options[:scope]
50
- super
51
+ extra do
52
+ { 'scope' => access_token.params['scope'] }
51
53
  end
52
54
  end
53
55
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Vimeo
3
- VERSION = "1.0.2"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -17,10 +17,9 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency 'multi_json', '~> 1.10'
21
- gem.add_dependency 'omniauth-oauth', '~> 1.0'
20
+ gem.add_dependency 'omniauth-oauth2'
22
21
 
23
- gem.add_development_dependency "rspec", "~> 3.0"
22
+ gem.add_development_dependency "rspec", "~> 3"
24
23
  gem.add_development_dependency 'rake'
25
24
 
26
25
  gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe OmniAuth::Strategies::Vimeo do
3
+ RSpec.describe OmniAuth::Strategies::Vimeo do
4
4
  subject do
5
5
  OmniAuth::Strategies::Vimeo.new({})
6
6
  end
@@ -10,20 +10,16 @@ describe OmniAuth::Strategies::Vimeo do
10
10
  expect(subject.options.name).to eq("vimeo")
11
11
  end
12
12
 
13
- it 'should have correct authorize url' do
14
- expect(subject.options.client_options.authorize_path).to eq('/oauth/authorize')
15
- end
16
-
17
- it 'should have correct request url' do
18
- expect(subject.options.client_options.request_token_path).to eq('/oauth/request_token')
13
+ it 'should have correct token url' do
14
+ expect(subject.options.client_options.token_url).to eq('/oauth/access_token')
19
15
  end
20
16
 
21
- it 'should have correct access url' do
22
- expect(subject.options.client_options.access_token_path).to eq('/oauth/access_token')
17
+ it 'should have correct authorize url' do
18
+ expect(subject.options.client_options.authorize_url).to eq('/oauth/authorize')
23
19
  end
24
20
 
25
21
  it 'should have correct site' do
26
- expect(subject.options.client_options.site).to eq("https://vimeo.com")
22
+ expect(subject.options.client_options.site).to eq("https://api.vimeo.com")
27
23
  end
28
24
  end
29
25
  end
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,94 @@ require 'rspec'
4
4
  require 'omniauth'
5
5
  require 'omniauth-vimeo'
6
6
 
7
+ # This file was generated by the `rspec --init` command. Conventionally, all
8
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
9
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
10
+ # this file to always be loaded, without a need to explicitly require it in any
11
+ # files.
12
+ #
13
+ # Given that it is always loaded, you are encouraged to keep this file as
14
+ # light-weight as possible. Requiring heavyweight dependencies from this file
15
+ # will add to the boot time of your test suite on EVERY test run, even for an
16
+ # individual file that may not need all of that loaded. Instead, consider making
17
+ # a separate helper file that requires the additional dependencies and performs
18
+ # the additional setup, and require it from the spec files that actually need
19
+ # it.
20
+ #
21
+ # The `.rspec` file also contains a few flags that are not defaults but that
22
+ # users commonly want.
23
+ #
24
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
25
  RSpec.configure do |config|
8
26
  config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
27
+
28
+ # rspec-expectations config goes here. You can use an alternate
29
+ # assertion/expectation library such as wrong or the stdlib/minitest
30
+ # assertions if you prefer.
31
+ config.expect_with :rspec do |expectations|
32
+ # This option will default to `true` in RSpec 4. It makes the `description`
33
+ # and `failure_message` of custom matchers include text for helper methods
34
+ # defined using `chain`, e.g.:
35
+ # be_bigger_than(2).and_smaller_than(4).description
36
+ # # => "be bigger than 2 and smaller than 4"
37
+ # ...rather than:
38
+ # # => "be bigger than 2"
39
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
40
+ end
41
+
42
+ # rspec-mocks config goes here. You can use an alternate test double
43
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
44
+ config.mock_with :rspec do |mocks|
45
+ # Prevents you from mocking or stubbing a method that does not exist on
46
+ # a real object. This is generally recommended, and will default to
47
+ # `true` in RSpec 4.
48
+ mocks.verify_partial_doubles = true
49
+ end
50
+
51
+ # The settings below are suggested to provide a good initial experience
52
+ # with RSpec, but feel free to customize to your heart's content.
53
+ # These two settings work together to allow you to limit a spec run
54
+ # to individual examples or groups you care about by tagging them with
55
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
56
+ # get run.
57
+ config.filter_run :focus
58
+ config.run_all_when_everything_filtered = true
59
+
60
+ # Limits the available syntax to the non-monkey patched syntax that is
61
+ # recommended. For more details, see:
62
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
63
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
64
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
65
+ config.disable_monkey_patching!
66
+
67
+ # This setting enables warnings. It's recommended, but in some cases may
68
+ # be too noisy due to issues in dependencies.
69
+ config.warnings = true
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = 'doc'
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
9
97
  end
metadata CHANGED
@@ -1,57 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-vimeo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Fritsch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-22 00:00:00.000000000 Z
11
+ date: 2015-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: multi_json
14
+ name: omniauth-oauth2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.10'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.10'
27
- - !ruby/object:Gem::Dependency
28
- name: omniauth-oauth
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
17
+ - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '1.0'
19
+ version: '0'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - "~>"
24
+ - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: '1.0'
26
+ version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rspec
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '3.0'
33
+ version: '3'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '3.0'
40
+ version: '3'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rake
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -76,6 +62,8 @@ files:
76
62
  - ".gitignore"
77
63
  - ".rspec"
78
64
  - ".ruby-version"
65
+ - ".travis.yml"
66
+ - Changes.md
79
67
  - Gemfile
80
68
  - README.md
81
69
  - Rakefile
@@ -105,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
93
  version: 1.3.6
106
94
  requirements: []
107
95
  rubyforge_project:
108
- rubygems_version: 2.2.2
96
+ rubygems_version: 2.4.5
109
97
  signing_key:
110
98
  specification_version: 4
111
99
  summary: OmniAuth strategy for Vimeo