omniauth-wordpress-0.2.2/0000755000004100000410000000000012532316513015416 5ustar www-datawww-dataomniauth-wordpress-0.2.2/Rakefile0000644000004100000410000000016512532316513017065 0ustar www-datawww-datarequire 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task :default => :spec omniauth-wordpress-0.2.2/Gemfile0000644000004100000410000000003212532316513016704 0ustar www-datawww-datasource :rubygems gemspec omniauth-wordpress-0.2.2/spec/0000755000004100000410000000000012532316513016350 5ustar www-datawww-dataomniauth-wordpress-0.2.2/spec/omniauth/0000755000004100000410000000000012532316513020174 5ustar www-datawww-dataomniauth-wordpress-0.2.2/spec/omniauth/strategies/0000755000004100000410000000000012532316513022346 5ustar www-datawww-dataomniauth-wordpress-0.2.2/spec/omniauth/strategies/wordpress_spec.rb0000644000004100000410000000460612532316513025743 0ustar www-datawww-datarequire 'omniauth-wordpress' describe OmniAuth::Strategies::Wordpress do before(:all) do OmniAuth.config.test_mode = true end before :each do @request = double('Request') @request.stub(:params) { {} } @request.stub(:cookies) { {} } @request.stub(:env) { {} } @client_id = '123' @client_secret = '53cr3tz' end subject do args = [@client_id, @client_secret, @options].compact OmniAuth::Strategies::Wordpress.new(nil, *args).tap do |strategy| strategy.stub(:request) { @request } end end describe '#client' do it 'should be initialized with symbolized client_options' do @options = { :client_options => { 'authorize_url' => 'https://example.com' } } subject.client.options[:authorize_url].should == 'https://example.com' end it 'has correct Wordpress site' do subject.client.site.should eq('https://public-api.wordpress.com') end it 'has correct authorize url' do subject.client.options[:authorize_url].should eq('https://public-api.wordpress.com/oauth2/authorize') end it 'has correct token url' do subject.client.options[:token_url].should eq('https://public-api.wordpress.com/oauth2/token') end end describe '#authorize_params' do it 'should include any authorize params passed in the :authorize_params option' do @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } } subject.authorize_params['foo'].should eq('bar') subject.authorize_params['baz'].should eq('zip') end it 'should include top-level options that are marked as :authorize_options' do @options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' } subject.authorize_params['scope'].should eq('bar') subject.authorize_params['foo'].should eq('baz') end end describe '#token_params' do it 'should include any authorize params passed in the :authorize_params option' do @options = { :token_params => { :foo => 'bar', :baz => 'zip' } } subject.token_params['foo'].should eq('bar') subject.token_params['baz'].should eq('zip') end it 'should include top-level options that are marked as :authorize_options' do @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' } subject.token_params['scope'].should eq('bar') subject.token_params['foo'].should eq('baz') end end end omniauth-wordpress-0.2.2/lib/0000755000004100000410000000000012532316513016164 5ustar www-datawww-dataomniauth-wordpress-0.2.2/lib/omniauth/0000755000004100000410000000000012532316513020010 5ustar www-datawww-dataomniauth-wordpress-0.2.2/lib/omniauth/strategies/0000755000004100000410000000000012532316513022162 5ustar www-datawww-dataomniauth-wordpress-0.2.2/lib/omniauth/strategies/wordpress.rb0000644000004100000410000000207112532316513024537 0ustar www-datawww-datarequire 'omniauth-oauth2' require 'multi_json' class OmniAuth::Strategies::Wordpress < OmniAuth::Strategies::OAuth2 option :name, "wordpress" option :client_options, { :site => "https://public-api.wordpress.com", :authorize_url => 'https://public-api.wordpress.com/oauth2/authorize', :token_url => 'https://public-api.wordpress.com/oauth2/token' } option :token_params, { :parse => :json } uid { access_token.params['blog_id'] } info do { :uid => access_token.params['blog_id'], :blog_url => access_token.params['blog_url'], :nickname => raw_info['username'], :name => raw_info['display_name'], :user_id => access_token['ID'], :image => raw_info['avatar_URL'], :website => raw_info['profile_URL'], :email => raw_info['email'] } end extra do {'raw_info' => raw_info.merge(access_token.params)} end def raw_info @raw_info ||= MultiJson.decode(access_token.get('/rest/v1/me').body) rescue ::Errno::ETIMEDOUT raise ::Timeout::Error end end omniauth-wordpress-0.2.2/lib/omniauth/wordpress/0000755000004100000410000000000012532316513022040 5ustar www-datawww-dataomniauth-wordpress-0.2.2/lib/omniauth/wordpress/version.rb0000644000004100000410000000010312532316513024044 0ustar www-datawww-datamodule Omniauth module Wordpress VERSION = "0.2.2" end end omniauth-wordpress-0.2.2/lib/omniauth/wordpress.rb0000644000004100000410000000011512532316513022362 0ustar www-datawww-datarequire 'omniauth/wordpress/version' require 'omniauth/strategies/wordpress' omniauth-wordpress-0.2.2/lib/omniauth-wordpress.rb0000644000004100000410000000003512532316513022361 0ustar www-datawww-datarequire 'omniauth/wordpress' omniauth-wordpress-0.2.2/metadata.yml0000644000004100000410000000571612532316513017732 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: omniauth-wordpress version: !ruby/object:Gem::Version version: 0.2.2 platform: ruby authors: - Magda Zawadzka autorequire: bindir: bin cert_chain: [] date: 2015-04-01 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: omniauth-oauth2 requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.1.0 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.1.0 - !ruby/object:Gem::Dependency name: rspec requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 2.7.0 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 2.7.0 - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: webmock requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rack-test requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' description: Wordpress strategy for OmniAuth. email: - madzia.sikorska@gmail.com executables: [] extensions: [] extra_rdoc_files: [] files: - ".gitignore" - Gemfile - LICENSE - README.md - Rakefile - lib/omniauth-wordpress.rb - lib/omniauth/strategies/wordpress.rb - lib/omniauth/wordpress.rb - lib/omniauth/wordpress/version.rb - omniauth-wordpress.gemspec - spec/omniauth/strategies/wordpress_spec.rb homepage: https://github.com/elrosa/omniauth-wordpress licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.6 signing_key: specification_version: 4 summary: Wordpress strategy for OmniAuth. test_files: [] omniauth-wordpress-0.2.2/.gitignore0000644000004100000410000000005512532316513017406 0ustar www-datawww-data*.gem .bundle .rspec .idea /Gemfile.lock tmp omniauth-wordpress-0.2.2/omniauth-wordpress.gemspec0000644000004100000410000000171612532316513022642 0ustar www-datawww-data# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "omniauth/wordpress/version" Gem::Specification.new do |s| s.name = "omniauth-wordpress" s.version = Omniauth::Wordpress::VERSION s.authors = ["Magda Zawadzka"] s.email = ["madzia.sikorska@gmail.com"] s.homepage = "https://github.com/elrosa/omniauth-wordpress" s.summary = 'Wordpress strategy for OmniAuth.' s.description = 'Wordpress strategy for OmniAuth.' s.license = 'MIT' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] s.add_runtime_dependency 'omniauth-oauth2', '>= 1.1.0' s.add_development_dependency 'rspec', '>= 2.7.0' s.add_development_dependency 'rake' s.add_development_dependency 'webmock' s.add_development_dependency 'rack-test' end omniauth-wordpress-0.2.2/LICENSE0000644000004100000410000000207412532316513016426 0ustar www-datawww-dataThe MIT License (MIT) Copyright (c) 2014 Magdalena Sikorska 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.omniauth-wordpress-0.2.2/README.md0000644000004100000410000000214212532316513016674 0ustar www-datawww-dataLicense ======= The project is licensed under MIT License. Copyright (c) 2014 Magdalena Sikorska 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.