Permalink
Browse files

v0.0.1 - Tested and working.

  • Loading branch information...
0 parents commit 6db59ffad8a65656866f2278ecf316f18ad6b323 @daraosn committed Jan 23, 2012
@@ -0,0 +1,6 @@
+.project
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
+coverage
1 .rspec
@@ -0,0 +1 @@
+--colour
@@ -0,0 +1,7 @@
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - 1.9.3
+ - ruby-head
+ - ree
+
@@ -0,0 +1,5 @@
+source "http://rubygems.org"
+
+gem 'rake'
+# Specify your gem's dependencies in omniauth-geeklist.gemspec
+gemspec
@@ -0,0 +1,3 @@
+# OmniAuth Geeklist
+
+# TODO
@@ -0,0 +1,11 @@
+require "bundler/gem_tasks"
+require 'rspec/core/rake_task'
+
+desc 'Default: run specs.'
+task :default => :spec
+
+desc "Run specs"
+RSpec::Core::RakeTask.new
+
+desc 'Run specs'
+task :default => :spec
@@ -0,0 +1,2 @@
+require "omniauth-geeklist/version"
+require 'omniauth/strategies/geeklist'
@@ -0,0 +1,5 @@
+module Omniauth
+ module Geeklist
+ VERSION = "0.0.1"
+ end
+end
@@ -0,0 +1,53 @@
+require 'omniauth-oauth'
+require 'multi_json'
+
+module OmniAuth
+ module Strategies
+ class Geeklist < OmniAuth::Strategies::OAuth
+ option :name, 'geeklist'
+
+ option :client_options, {
+ :site => 'http://api.geekli.st/',
+ :request_token_url => 'http://api.geekli.st/v1/oauth/request_token',
+ :authorize_url => 'http://geekli.st/oauth/authorize',
+ :access_token_url => 'http://api.geekli.st/v1/oauth/access_token'
+ }
+
+ def request_phase
+ super
+ end
+
+ def callback_phase
+ super
+ end
+
+ uid { raw_info['data']['id'] }
+
+ info do
+ {
+ :nickname => raw_info['data']['screen_name'],
+ :name => raw_info['data']['name'],
+ :email => raw_info['data']['email'],
+ :location => raw_info['data']['location'],
+ :image => raw_info['data']['avatar']['small'],
+ :description => raw_info['data']['bio'],
+ :urls => {
+ 'Website' => raw_info['data']['blog_url'],
+ 'Geeklist' => 'http://geekli.st/' + raw_info['data']['screen_name'],
+ }
+ }
+ end
+
+ extra do
+ {:raw_info => raw_info}
+ end
+
+ def raw_info
+ @raw_info ||= MultiJson.decode(access_token.get('/v1/user').body)
+ rescue ::Errno::ETIMEDOUT
+ raise ::Timeout::Error
+ end
+
+ end
+ end
+end
@@ -0,0 +1,26 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "omniauth-geeklist/version"
+
+Gem::Specification.new do |s|
+ s.name = "omniauth-geeklist"
+ s.version = Omniauth::Geeklist::VERSION
+ s.authors = ["Diego Araos"]
+ s.email = ["daraosn@gmail.com"]
+ s.homepage = "https://github.com/daraosn/omniauth-geeklist"
+ s.summary = %q{OmniAuth strategy for Geeklist}
+ s.description = %q{OmniAuth strategy for Geeklist}
+
+ s.rubyforge_project = "omniauth-geeklist"
+
+ 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-oauth', '~> 1.0'
+ s.add_development_dependency 'rspec', '~> 2.7'
+ s.add_development_dependency 'rack-test'
+ s.add_development_dependency 'simplecov'
+ s.add_development_dependency 'webmock'
+end
@@ -0,0 +1,7 @@
+require 'spec_helper'
+
+describe OmniAuth::Strategies::Geeklist do
+ it 'should do some testing' do
+ pending
+ end
+end
@@ -0,0 +1,16 @@
+$:.unshift File.expand_path('..', __FILE__)
+$:.unshift File.expand_path('../../lib', __FILE__)
+require 'simplecov'
+SimpleCov.start
+require 'rspec'
+require 'rack/test'
+require 'webmock/rspec'
+require 'omniauth'
+require 'omniauth-geeklist'
+
+RSpec.configure do |config|
+ config.include WebMock::API
+ config.include Rack::Test::Methods
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
+end
+

0 comments on commit 6db59ff

Please sign in to comment.