omniauth-smugmug 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,4 @@
1
+ .DS_Store
2
+ .idea
3
+ *.gem
4
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
@@ -0,0 +1,34 @@
1
+ OmniAuth SmugMug
2
+ ================
3
+
4
+ This is an [OmniAuth 1.0](https://github.com/intridea/omniauth) strategy for authenticating to SmugMug.
5
+
6
+ Get a SmugMug API key [here](http://www.smugmug.com/hack/apikeys)
7
+
8
+
9
+ Usage
10
+ -----
11
+
12
+ In a Rack application:
13
+
14
+ ```ruby
15
+ use OmniAuth::Builder do
16
+ provider :smugmug, ENV['SMUGMUG_KEY'], ENV['SMUGMUG_SECRET']
17
+ end
18
+ ```
19
+
20
+ For Rails, put this in `config/initializers/omniauth.rb`:
21
+
22
+ ```ruby
23
+ Rails.application.config.middleware.use OmniAuth::Builder do
24
+ provider :smugmug, ENV['SMUGMUG_KEY'], ENV['SMUGMUG_SECRET']
25
+ end
26
+ ```
27
+
28
+
29
+ License
30
+ -------
31
+
32
+ Copyright (c) 2012 Birdbox, Inc.
33
+
34
+ This source code released under an MIT license.
@@ -0,0 +1,2 @@
1
+ require "omniauth-smugmug/version"
2
+ require 'omniauth/strategies/smugmug'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module SmugMug
3
+ VERSION = "1.0"
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class SmugMug < OmniAuth::Strategies::OAuth
7
+ option :name, 'smugmug'
8
+ option :client_options, {
9
+ :site => 'http://api.smugmug.com',
10
+ :request_token_path => "/services/oauth/getRequestToken.mg",
11
+ :access_token_path => "/services/oauth/getAccessToken.mg",
12
+ :authorize_path => "/services/oauth/authorize.mg"
13
+ }
14
+
15
+ uid { user['id'] }
16
+
17
+ info do
18
+ {
19
+ 'uid' => user['id'],
20
+ 'nickname' => user['NickName'],
21
+ 'name' => user['Name'],
22
+ 'urls' => {
23
+ 'website' => user['URL'],
24
+ }
25
+ }
26
+ end
27
+
28
+ extra do
29
+ { 'user_hash' => user }
30
+ end
31
+
32
+ def user
33
+ @user_hash ||= MultiJson.decode(@access_token.get('http://api.smugmug.com/services/api/json/1.2.2/?method=smugmug.auth.checkAccessToken').body)['Auth']['User']
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+
40
+ OmniAuth.config.add_camelization 'smugmug', 'SmugMug'
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-smugmug/version"
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "omniauth-smugmug"
7
+ gem.version = Omniauth::SmugMug::VERSION
8
+ gem.authors = ["Will Butler"]
9
+ gem.email = ["wbutler@birdbox.com"]
10
+ gem.homepage = "https://github.com/BirdBox/omniauth-smugmug"
11
+ gem.description = %q{OmniAuth strategy for SmugMug (OAuth 1.0)}
12
+ gem.summary = gem.description
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) }
17
+ gem.require_paths = ["lib"]
18
+
19
+ gem.add_runtime_dependency 'omniauth-oauth', '~> 1.0.1'
20
+
21
+ gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
22
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-smugmug
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Will Butler
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.1
30
+ description: OmniAuth strategy for SmugMug (OAuth 1.0)
31
+ email:
32
+ - wbutler@birdbox.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - README.md
40
+ - lib/omniauth-smugmug.rb
41
+ - lib/omniauth-smugmug/version.rb
42
+ - lib/omniauth/strategies/smugmug.rb
43
+ - omniauth-smugmug.gemspec
44
+ homepage: https://github.com/BirdBox/omniauth-smugmug
45
+ licenses: []
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.6
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 1.8.24
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: OmniAuth strategy for SmugMug (OAuth 1.0)
68
+ test_files: []