omniauth-haobtc 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/.gitignore +10 -0
- data/Gemfile +4 -0
- data/README.md +20 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/omniauth/haobtc.rb +2 -0
- data/lib/omniauth/haobtc/version.rb +5 -0
- data/lib/omniauth/strategies/haobtc.rb +48 -0
- data/omniauth-haobtc.gemspec +30 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eb69f28abea216a0acfc3f1ef1d54ba11ef624d
|
4
|
+
data.tar.gz: abeca270c82b57da38f0a88f75ba16c256bec143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 739d4279897e3effa4f4edc072269e2ec146a8a8992d2861cff3ee282e3e2345577bfb60b552cb9dfec93e271676492e507bfac45d1da2ae7dd28b15d49abe65
|
7
|
+
data.tar.gz: 8d3e6485d3d07cfa3f3bbc9a072796798c39e44a13dc8a53bad9f2d9cd44c759947af7f84a00d8ea0658236e82abccaed1d0bfa0f92a58737463129a9712d9bc
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
## Installation
|
2
|
+
|
3
|
+
Add this line to your application's Gemfile:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
gem 'omniauth-haobtc'
|
7
|
+
```
|
8
|
+
|
9
|
+
And then execute:
|
10
|
+
|
11
|
+
$ bundle
|
12
|
+
|
13
|
+
Or install it yourself as:
|
14
|
+
|
15
|
+
$ gem install omniauth-haobtc
|
16
|
+
|
17
|
+
## Contributing
|
18
|
+
|
19
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Freeza91/omniauth-haobtc.
|
20
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "omniauth/haobtc"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'omniauth/strategies/oauth2'
|
4
|
+
|
5
|
+
module OmniAuth
|
6
|
+
module Strategies
|
7
|
+
class Haobtc < OmniAuth::Strategies::OAuth2
|
8
|
+
option :name, "haobtc"
|
9
|
+
|
10
|
+
option :client_options, {
|
11
|
+
:site => 'https://haobtc.com',
|
12
|
+
:authorize_url => '/auth/oauth/authorize/',
|
13
|
+
:token_url => "/auth/oauth/get_token/"
|
14
|
+
}
|
15
|
+
|
16
|
+
uid do
|
17
|
+
@uid ||= begin
|
18
|
+
access_token.options[:mode] = :query
|
19
|
+
access_token.options[:param_name] = :access_token
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
info do
|
24
|
+
user_info = raw_info['user_info']
|
25
|
+
{
|
26
|
+
:username => user_info['username'],
|
27
|
+
:fullname => user_info['fullname'],
|
28
|
+
:address => user_info['address'],
|
29
|
+
:provider => user_info['provider'],
|
30
|
+
:uuid => user_info['uuid']
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# extra do
|
35
|
+
# {
|
36
|
+
# :raw_info => raw_info
|
37
|
+
# }
|
38
|
+
# end
|
39
|
+
|
40
|
+
def raw_info
|
41
|
+
@raw_info ||= access_token.get('https://haobtc.com/api/v1/user/profile').parsed
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
OmniAuth.config.add_camelization('haobtc', 'Haobtc')
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/haobtc/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
|
8
|
+
spec.name = "omniauth-haobtc"
|
9
|
+
spec.version = Omniauth::Haobtc::VERSION
|
10
|
+
spec.authors = ["freez91"]
|
11
|
+
spec.email = ["useyes91@gmail.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{OmniAuth strategies for haobtc}
|
14
|
+
spec.description = %q{OmniAuth strategies for haobtc}
|
15
|
+
spec.homepage = "https://github.com/Freeza91/omniauth-haobtc"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_dependency 'omniauth', '~> 1.0'
|
27
|
+
spec.add_dependency 'omniauth-oauth', '~> 1.0'
|
28
|
+
spec.add_dependency 'omniauth-oauth2', '~> 1.0'
|
29
|
+
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-haobtc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- freez91
|
@@ -86,7 +86,17 @@ email:
|
|
86
86
|
executables: []
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
|
-
files:
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- bin/console
|
95
|
+
- bin/setup
|
96
|
+
- lib/omniauth/haobtc.rb
|
97
|
+
- lib/omniauth/haobtc/version.rb
|
98
|
+
- lib/omniauth/strategies/haobtc.rb
|
99
|
+
- omniauth-haobtc.gemspec
|
90
100
|
homepage: https://github.com/Freeza91/omniauth-haobtc
|
91
101
|
licenses: []
|
92
102
|
metadata: {}
|