omniauth-shutterstock-contributor 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9027b86d499d41db22987580dbd984772a3443c6
4
+ data.tar.gz: bb3980446a4453543bebd5cf95147b0fd9bafcda
5
+ SHA512:
6
+ metadata.gz: 7d8e6ff7b0c7ee9af7c25cfa1bb13a0f9cd273ead253e950b0a430a3a5f77e22e590a026a038aa4d1e140e2d176adf934629debccdf798fba995abcbc3dd2e4f
7
+ data.tar.gz: 9c9878567b6c61fa6460c4ac7bb022fc6fe275024fe60b3a15de1f295596de428324feacd2af35573bbaf322529c16006e7bad9d5ac44471fd057f1efe18257c
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-shutterstock-contributor.gemspec
4
+ gemspec
@@ -0,0 +1,47 @@
1
+ # Omniauth::Shutterstock::Contributor
2
+
3
+ Shutterstock Contributor OAuth2 Strategy for OmniAuth.
4
+
5
+ Supports the OAuth 2.0 server-side and client-side flows. Read the Shutterstock API docs for more details: https://developers.shutterstock.com/guides/authentication
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'omniauth-shutterstock-contributor'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install omniauth-shutterstock-contributor
22
+
23
+ ## Usage
24
+
25
+ Register your application with Shutterstock to receive Client ID and Client Secret: https://developers.shutterstock.com/applicationsdeveloper
26
+
27
+ This is an example that you might put into a Rails initializer at `config/initializers/omniauth.rb`:
28
+
29
+ ```ruby
30
+ Rails.application.config.middleware.use OmniAuth::Builder do
31
+ provider :shutterstock_contributor, ENV['SHUTTERSTOCK_CLIENT_ID'], ENV['SHUTTERSTOCK_CLIENT_SECRET']
32
+ end
33
+ ```
34
+
35
+ OR you might put following code to `config/initializers/devise.rb`:
36
+
37
+ ```ruby
38
+ config.omniauth :shutterstock_contributor, ENV['SHUTTERSTOCK_CLIENT_ID'], ENV['SHUTTERSTOCK_CLIENT_SECRET']
39
+ ```
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+ RSpec::Core::RakeTask.new(:spec)
4
+
5
+ task default: :spec
6
+ rescue LoadError
7
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "omniauth/shutterstock/contributor"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,2 @@
1
+ require 'omniauth-shutterstock-contributor/version'
2
+ require 'omniauth/strategies/shutterstock/contributor'
@@ -0,0 +1,7 @@
1
+ module OmniAuth
2
+ module Shutterstock
3
+ module Contributor
4
+ VERSION = '0.1.0'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,46 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class ShutterstockContributor < OmniAuth::Strategies::OAuth2
6
+ # Give your strategy a name.
7
+ option :name, 'shutterstock_contributor'
8
+
9
+ # This is where you pass the options you would pass when
10
+ # initializing your consumer from the OAuth gem.
11
+ option :client_options, {
12
+ site: 'https://api.shutterstock.com/v2',
13
+ authorize_url: 'https://contributor-accounts.shutterstock.com/oauth/authorize',
14
+ token_url: 'https://contributor-accounts.shutterstock.com/oauth/access_token'
15
+ }
16
+
17
+ option :scope, 'user.view user.email user.edit collections.view collections.edit licenses.view licenses.create earnings.view purchases.view'
18
+
19
+ option :fields, ['id', 'username', 'full_name', 'email', 'customer_id']
20
+
21
+ # These are called after authentication has succeeded. If
22
+ # possible, you should try to set the UID without making
23
+ # additional calls (if the user id is returned with the token
24
+ # or as a URI parameter). This may not be possible with all
25
+ # providers.
26
+ uid { raw_info[:id].to_s }
27
+
28
+ info do
29
+ {
30
+ name: raw_info[:full_name],
31
+ email: raw_info[:email],
32
+ nickname: raw_info[:username],
33
+ customer_id: raw_info[:customer_id]
34
+ }
35
+ end
36
+
37
+ extra do
38
+ { raw_info: raw_info }
39
+ end
40
+
41
+ def raw_info
42
+ @raw_info ||= deep_symbolize(access_token.get('user').parsed)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ # lib = File.expand_path('../lib', __FILE__)
3
+ # $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ # require 'omniauth-shutterstock-contributor/version'
5
+ require File.expand_path('../lib/omniauth-shutterstock-contributor/version', __FILE__)
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'omniauth-shutterstock-contributor'
9
+ spec.version = OmniAuth::Shutterstock::Contributor::VERSION
10
+ spec.author = 'Sergey Suprunenko'
11
+ spec.authors = ['Sergey Suprunenko']
12
+ spec.email = ['suprunenko.s@gmail.com']
13
+
14
+ spec.summary = %q{A Shutterstock-Contributor OAuth2 strategy for OmniAuth.}
15
+ spec.description = %q{A Shutterstock-Contributor OAuth2 strategy for OmniAuth.}
16
+ spec.homepage = 'https://github.com/ssuprunenko/omniauth-shutterstock-contributor'
17
+ spec.license = 'MIT'
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_runtime_dependency 'omniauth', '~> 1.0'
25
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
26
+
27
+ spec.add_development_dependency 'bundler', '~> 1.8'
28
+ spec.add_development_dependency 'rake', '~> 10.0'
29
+ spec.add_development_dependency 'pry', '~> 0.10'
30
+ spec.add_development_dependency 'rspec', '~> 3.2'
31
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-shutterstock-contributor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sergey Suprunenko
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.10'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.10'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.2'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.2'
97
+ description: A Shutterstock-Contributor OAuth2 strategy for OmniAuth.
98
+ email:
99
+ - suprunenko.s@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - Gemfile
108
+ - README.md
109
+ - Rakefile
110
+ - bin/console
111
+ - bin/setup
112
+ - lib/omniauth-shutterstock-contributor.rb
113
+ - lib/omniauth-shutterstock-contributor/version.rb
114
+ - lib/omniauth/strategies/shutterstock/contributor.rb
115
+ - omniauth-shutterstock-contributor.gemspec
116
+ homepage: https://github.com/ssuprunenko/omniauth-shutterstock-contributor
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.4.6
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: A Shutterstock-Contributor OAuth2 strategy for OmniAuth.
140
+ test_files: []