omniauth-daum 0.0.2

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,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in omniauth-daum.gemspec
4
+ gemspec
File without changes
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc "Run specs"
5
+ RSpec::Core::RakeTask.new
6
+
7
+ desc 'Default: run specs.'
8
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require 'omniauth-daum/version'
2
+ require 'omniauth/strategies/daum'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Daum
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -0,0 +1,43 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+
7
+ class Daum < OmniAuth::Strategies::OAuth
8
+ option :name, 'daum'
9
+
10
+ option :client_options, {
11
+ :site => 'https://apis.daum.net',
12
+ :request_token_path => '/oauth/requestToken',
13
+ :access_token_path => '/oauth/accessToken',
14
+ :authorize_path => '/oauth/authorize'
15
+ }
16
+
17
+ uid do
18
+ user_info['url_name']
19
+ end
20
+
21
+ info do
22
+ {
23
+ :nickname => user_info['nickname'],
24
+ :email => "#{user_info['url_name']}@hanmail.net"
25
+ }
26
+ end
27
+
28
+ extra do
29
+ {
30
+ :raw_onfo => raw_info
31
+ }
32
+ end
33
+
34
+ def raw_info
35
+ @raw_info ||= MultiJson.decode(access_token.get('/yozm/v1_0/user/show.json').body)
36
+ end
37
+
38
+ def user_info
39
+ @user_info ||= raw_info.nil? ? {} : raw_info['user']
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-daum/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-daum"
7
+ s.version = Omniauth::Daum::VERSION
8
+ s.authors = ["Hoseong Hwang"]
9
+ s.email = ["thefron@wafflestudio.com"]
10
+ s.homepage = "https://github.com/thefron/omniauth-daum"
11
+ s.summary = %q{OmniAuth strategy for Daum}
12
+ s.description = %q{OmniAuth strategy for Daum}
13
+
14
+ s.rubyforge_project = "omniauth-daum"
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
+ # specify any dependencies here; for example:
22
+ s.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
23
+ s.add_development_dependency 'rspec', '~> 2.7'
24
+ s.add_development_dependency 'webmock'
25
+ s.add_development_dependency 'rack-test'
26
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Daum do
4
+ subject do
5
+ OmniAuth::Strategies::Daum.new(nil, @options || {})
6
+ end
7
+
8
+ context 'client options' do
9
+ it 'should have correct name' do
10
+ subject.options.name.should eq('daum')
11
+ end
12
+
13
+ it 'should have correct site' do
14
+ subject.options.client_options.site.should eq('https://apis.daum.net')
15
+ end
16
+
17
+ it 'should have correct request token path' do
18
+ subject.options.client_options.request_token_path.should eq('/oauth/requestToken')
19
+ end
20
+
21
+ it 'should have correct access token path' do
22
+ subject.options.client_options.access_token_path.should eq('/oauth/accessToken')
23
+ end
24
+
25
+ it 'should have correct authorize path' do
26
+ subject.options.client_options.authorize_path.should eq('/oauth/authorize')
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+
4
+ require 'rspec'
5
+ require 'rack/test'
6
+ require 'webmock/rspec'
7
+ require 'omniauth'
8
+ require 'omniauth-daum'
9
+
10
+ RSpec.configure do |config|
11
+ config.include WebMock::API
12
+ config.include Rack::Test::Methods
13
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
14
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-daum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Hoseong Hwang
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth
16
+ requirement: &78723310 !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: *78723310
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &78738080 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '2.7'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *78738080
36
+ - !ruby/object:Gem::Dependency
37
+ name: webmock
38
+ requirement: &78736010 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *78736010
47
+ - !ruby/object:Gem::Dependency
48
+ name: rack-test
49
+ requirement: &78735130 !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: *78735130
58
+ description: OmniAuth strategy for Daum
59
+ email:
60
+ - thefron@wafflestudio.com
61
+ executables: []
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - .gitignore
66
+ - Gemfile
67
+ - README.md
68
+ - Rakefile
69
+ - lib/omniauth-daum.rb
70
+ - lib/omniauth-daum/version.rb
71
+ - lib/omniauth/strategies/daum.rb
72
+ - omniauth-daum.gemspec
73
+ - spec/omniauth/strategies/daum_spec.rb
74
+ - spec/spec_helper.rb
75
+ homepage: https://github.com/thefron/omniauth-daum
76
+ licenses: []
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project: omniauth-daum
95
+ rubygems_version: 1.8.15
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: OmniAuth strategy for Daum
99
+ test_files: []