omniauth-picplz 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ # Specify your gem's dependencies in omniauth-picplz.gemspec
5
+ gemspec
@@ -0,0 +1,35 @@
1
+ # OmniAuth PicPlz
2
+
3
+ This gem contains the PicPlz strategy for OmniAuth.
4
+
5
+ PicPlz uses the OAuth2 flow, you can read about it here: https://sites.google.com/site/picplzapi/authentication
6
+
7
+ ## How To Use It
8
+
9
+ So let's say you're using Rails, you need to add the strategy to your `Gemfile`:
10
+
11
+ gem 'omniauth-picplz'
12
+
13
+ You can pull them in directly from github e.g.:
14
+
15
+ gem 'omniauth-picplz', :git => 'https://github.com/arunagw/omniauth-picplz.git'
16
+
17
+ Once these are in, you need to add the following to your `config/initializers/omniauth.rb`:
18
+
19
+ Rails.application.config.middleware.use OmniAuth::Builder do
20
+ provider :picplz, "consumer_key", "consumer_secret"
21
+ end
22
+
23
+ You will obviously have to put in your key and secret, which you get when you register your app with PicPlz (they call them API Key and Secret Key).
24
+
25
+ Now just follow the README at: https://github.com/intridea/omniauth
26
+
27
+ ## License
28
+
29
+ Copyright (c) 2011 by Arun Agrawal
30
+
31
+ 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:
32
+
33
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ require "omniauth-picplz/version"
2
+ require "omniauth/strategies/picplz"
3
+
4
+ module Omniauth
5
+ module Picplz
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Picplz
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,43 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class PicPlz < OmniAuth::Strategies::OAuth2
6
+ option :client_options, {
7
+ :site => 'https://picplz.com',
8
+ :authorize_url => '/oauth2/authenticate',
9
+ :token_url => '/oauth2/access_token'
10
+ }
11
+
12
+ def request_phase
13
+ options[:authorize_params] = client_params.merge(options[:authorize_params])
14
+ super
15
+ end
16
+
17
+ def auth_hash
18
+ OmniAuth::Utils.deep_merge(super, client_params.merge({
19
+ :grant_type => 'authorization_code'}))
20
+ end
21
+
22
+ info do
23
+ {
24
+ :display_name => raw_info['display_name']
25
+ }
26
+ end
27
+
28
+ def raw_info
29
+ access_token.options[:mode] = :query
30
+ access_token.options[:param_name] = :oauth_token
31
+ response = access_token.get('https://api.picplz.com/api/v2/user.json?id=self').parsed['value']
32
+ @raw_info ||= response['users'].last
33
+ end
34
+
35
+ private
36
+
37
+ def client_params
38
+ {:client_id => options[:client_id], :redirect_uri => callback_url ,:response_type => "code"}
39
+ end
40
+ end
41
+ end
42
+ end
43
+ OmniAuth.config.add_camelization 'picplz', 'PicPlz'
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-picplz/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-picplz"
7
+ s.version = Omniauth::Picplz::VERSION
8
+ s.authors = ["Arun Agrawal"]
9
+ s.email = ["arunagw@gmail.com"]
10
+ s.homepage = "https://github.com/arunagw/omniauth-picplz"
11
+ s.summary = %q{PicPlz OAuth strategy for OmniAuth}
12
+ s.description = %q{PicPlz OAuth strategy for OmniAuth}
13
+
14
+ s.rubyforge_project = "omniauth-picplz"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'omniauth', '~> 1.0'
22
+ s.add_dependency 'omniauth-oauth2', '~> 1.0'
23
+ s.add_development_dependency 'rspec', '~> 2.7'
24
+ s.add_development_dependency 'rack-test'
25
+ s.add_development_dependency 'simplecov'
26
+ s.add_development_dependency 'webmock'
27
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-picplz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Arun Agrawal
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-08 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth
16
+ requirement: &70299301400680 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70299301400680
25
+ - !ruby/object:Gem::Dependency
26
+ name: omniauth-oauth2
27
+ requirement: &70299301400100 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70299301400100
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70299301399560 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.7'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70299301399560
47
+ - !ruby/object:Gem::Dependency
48
+ name: rack-test
49
+ requirement: &70299301399040 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70299301399040
58
+ - !ruby/object:Gem::Dependency
59
+ name: simplecov
60
+ requirement: &70299301398160 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70299301398160
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: &70299301397700 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70299301397700
80
+ description: PicPlz OAuth strategy for OmniAuth
81
+ email:
82
+ - arunagw@gmail.com
83
+ executables: []
84
+ extensions: []
85
+ extra_rdoc_files: []
86
+ files:
87
+ - .gitignore
88
+ - Gemfile
89
+ - README.md
90
+ - Rakefile
91
+ - lib/omniauth-picplz.rb
92
+ - lib/omniauth-picplz/version.rb
93
+ - lib/omniauth/strategies/picplz.rb
94
+ - omniauth-picplz.gemspec
95
+ homepage: https://github.com/arunagw/omniauth-picplz
96
+ licenses: []
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ segments:
108
+ - 0
109
+ hash: 2290920911143233228
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ segments:
117
+ - 0
118
+ hash: 2290920911143233228
119
+ requirements: []
120
+ rubyforge_project: omniauth-picplz
121
+ rubygems_version: 1.8.6
122
+ signing_key:
123
+ specification_version: 3
124
+ summary: PicPlz OAuth strategy for OmniAuth
125
+ test_files: []