zhima_auth 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rake_tasks~ +7 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/zhima_auth/configuration.rb +15 -0
- data/lib/zhima_auth/error.rb +15 -0
- data/lib/zhima_auth/request.rb +131 -0
- data/lib/zhima_auth/sign.rb +18 -0
- data/lib/zhima_auth/validation.rb +63 -0
- data/lib/zhima_auth/version.rb +3 -0
- data/lib/zhima_auth/web_util.rb +11 -0
- data/lib/zhima_auth.rb +39 -0
- data/zhima_auth.gemspec +39 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 72c6022d4ec7ad10934852d37960bb357b2ab091
|
4
|
+
data.tar.gz: 5f84fb04bd7dfe979934a63f6cab99c42b904dd0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6bb8167eb89b62dc30abfaabcbedd564c39b17a42d1e74e7e9fda30efb4c469608f9c338c91fc852c8a79fdaa2daa67a434d86ed3a6addad7ea7738d53327b0e
|
7
|
+
data.tar.gz: 2c29257fa3673bc9a935adef2075a93fec5791e07a3650ef0d108f1cba67eb52754d326fb886105f5d551bae42474e58cc2c958ea5cff879dab9109128cee0ea
|
data/.gitignore
ADDED
data/.rake_tasks~
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at lby89757@hotmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 BranLiang
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# ZhimaAuth
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zhima_auth`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'zhima_auth'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install zhima_auth
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/zhima_auth. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "zhima_auth"
|
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,15 @@
|
|
1
|
+
module ZhimaAuth
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :app_id, :private_key, :sign_type, :format, :charset, :version, :biz_code
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@app_id = "app_id"
|
7
|
+
@private_key = "private_key"
|
8
|
+
@sign_type = "RSA2"
|
9
|
+
@format = "JSON"
|
10
|
+
@charset = "utf-8"
|
11
|
+
@version = "1.0"
|
12
|
+
@biz_code = "FACE"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ZhimaAuth
|
2
|
+
class ZhimaAuthInvalidParams < StandardError
|
3
|
+
attr_accessor :message
|
4
|
+
def initialize(msg=nil)
|
5
|
+
@message = msg
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class ZhimaAuthInvalidResponse < StandardError
|
10
|
+
attr_accessor :message
|
11
|
+
def initialize(msg=nil)
|
12
|
+
@message = msg
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
module ZhimaAuth
|
2
|
+
class BaseRequest
|
3
|
+
REQUEST_GATEWAY = 'https://openapi.alipay.com/gateway.do'
|
4
|
+
|
5
|
+
def url
|
6
|
+
REQUEST_GATEWAY
|
7
|
+
end
|
8
|
+
|
9
|
+
def base_params
|
10
|
+
@base_params ||= {
|
11
|
+
app_id: ZhimaAuth.configuration.app_id,
|
12
|
+
charset: ZhimaAuth.configuration.charset,
|
13
|
+
format: ZhimaAuth.configuration.format,
|
14
|
+
sign_type: ZhimaAuth.configuration.sign_type,
|
15
|
+
version: ZhimaAuth.configuration.version,
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def params_with_sign
|
20
|
+
params.merge({sign: Sign.encode(params)})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class InitializeRequest < BaseRequest
|
25
|
+
attr_accessor :cert_name, :cert_no, :transaction_id
|
26
|
+
# { cert_name: "Bran", cert_no: "3543563267268", transaction_id: "AIHEHUO20170101000000001" }
|
27
|
+
def initialize(biz_params)
|
28
|
+
Validation.check_initialize_params(biz_params)
|
29
|
+
|
30
|
+
@cert_name = biz_params[:cert_name]
|
31
|
+
@cert_no = biz_params[:cert_no]
|
32
|
+
@transaction_id = biz_params[:transaction_id]
|
33
|
+
end
|
34
|
+
|
35
|
+
def excute
|
36
|
+
@response ||= RestClient.post url_with_params, {}
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_biz_no
|
40
|
+
res = JSON.parse(excute)
|
41
|
+
Validation.check_initialize_response res
|
42
|
+
res["zhima_customer_certification_initialize_response"]["biz_no"]
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def params
|
48
|
+
@params ||= base_params.merge({
|
49
|
+
method: "zhima.customer.certification.initialize",
|
50
|
+
timestamp: Time.now.strftime("%Y-%m-%d %H:%M:%S"),
|
51
|
+
biz_content: {
|
52
|
+
transaction_id: @transaction_id,
|
53
|
+
product_code: "w1010100000000002978",
|
54
|
+
biz_code: ZhimaAuth.configuration.biz_code,
|
55
|
+
identity_param: {
|
56
|
+
identity_type: "CERT_INFO",
|
57
|
+
cert_type: "IDENTITY_CARD",
|
58
|
+
cert_name: @cert_name,
|
59
|
+
cert_no: @cert_no
|
60
|
+
}
|
61
|
+
}.to_json
|
62
|
+
})
|
63
|
+
end
|
64
|
+
|
65
|
+
def url_with_params
|
66
|
+
[url, WebUtil.to_query(params_with_sign)].join("?")
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
class CertifyRequest < BaseRequest
|
72
|
+
|
73
|
+
# { biz_no: "MK62873648327468", return_url: "https://www.google.com" }
|
74
|
+
def initialize(biz_params)
|
75
|
+
Validation.check_certify_params biz_params
|
76
|
+
|
77
|
+
@biz_no = biz_params[:biz_no]
|
78
|
+
@return_url = biz_params[:return_url]
|
79
|
+
end
|
80
|
+
|
81
|
+
def generate_url
|
82
|
+
[url, URI.encode_www_form(params_with_sign)].join("?")
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def params
|
88
|
+
@params ||= base_params.merge({
|
89
|
+
method: "zhima.customer.certification.certify",
|
90
|
+
return_url: @return_url,
|
91
|
+
timestamp: Time.now.strftime("%Y-%m-%d %H:%M:%S"),
|
92
|
+
biz_content: {
|
93
|
+
biz_no: @biz_no
|
94
|
+
}.to_json
|
95
|
+
})
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
class QueryRequest < BaseRequest
|
101
|
+
|
102
|
+
def initialize(biz_no)
|
103
|
+
Validation.check_biz_no biz_no
|
104
|
+
|
105
|
+
@biz_no = biz_no
|
106
|
+
end
|
107
|
+
|
108
|
+
def excute
|
109
|
+
@response ||= RestClient.post url, params_with_sign
|
110
|
+
end
|
111
|
+
|
112
|
+
def get_certify_result
|
113
|
+
res = JSON.parse(excute)
|
114
|
+
Validation.check_query_response res
|
115
|
+
res["zhima_customer_certification_query_response"]["passed"]
|
116
|
+
end
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
def params
|
121
|
+
@params ||= base_params.merge({
|
122
|
+
method: "zhima.customer.certification.query",
|
123
|
+
timestamp: Time.now.strftime("%Y-%m-%d %H:%M:%S"),
|
124
|
+
biz_content: {
|
125
|
+
biz_no: @biz_no
|
126
|
+
}.to_json
|
127
|
+
})
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ZhimaAuth
|
2
|
+
class Sign
|
3
|
+
class << self
|
4
|
+
def encode params
|
5
|
+
digest = OpenSSL::Digest::SHA256.new
|
6
|
+
signature = ZhimaAuth.mech_rsa.sign(digest, transform(params))
|
7
|
+
Base64.strict_encode64(signature)
|
8
|
+
end
|
9
|
+
|
10
|
+
def transform params
|
11
|
+
params.sort.map do |k, v|
|
12
|
+
"#{k}=#{v}"
|
13
|
+
end.join("&")
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module ZhimaAuth
|
2
|
+
class Validation
|
3
|
+
class << self
|
4
|
+
def check_initialize_params biz_params
|
5
|
+
raise ZhimaAuthInvalidParams, "Params should be a hash" unless biz_params.is_a? Hash
|
6
|
+
unless biz_params[:cert_name] && biz_params[:cert_no] && biz_params[:transaction_id]
|
7
|
+
raise ZhimaAuthInvalidParams, "Params should include cert_name, cert_no and transaction_id"
|
8
|
+
end
|
9
|
+
check_name biz_params[:cert_name]
|
10
|
+
check_id_no biz_params[:cert_no]
|
11
|
+
end
|
12
|
+
|
13
|
+
def check_certify_params biz_params
|
14
|
+
raise ZhimaAuthInvalidParams, "Params should be a hash" unless biz_params.is_a? Hash
|
15
|
+
unless biz_params[:biz_no] && biz_params[:return_url]
|
16
|
+
raise ZhimaAuthInvalidParams, "Params should include biz_no and return_url"
|
17
|
+
end
|
18
|
+
check_url biz_params[:return_url]
|
19
|
+
check_biz_no biz_params[:biz_no]
|
20
|
+
end
|
21
|
+
|
22
|
+
def check_biz_no biz_no
|
23
|
+
raise ZhimaAuthInvalidParams, "Invalid biz no" unless biz_no.length == 32
|
24
|
+
end
|
25
|
+
|
26
|
+
def check_initialize_response response
|
27
|
+
raise ZhimaAuthInvalidResponse, "Initialize request failed" unless (response.is_a? Hash) && response["zhima_customer_certification_initialize_response"]
|
28
|
+
response_code = response["zhima_customer_certification_initialize_response"]["code"]
|
29
|
+
if response_code != "10000"
|
30
|
+
response_msg = response["zhima_customer_certification_initialize_response"]["sub_msg"]
|
31
|
+
raise ZhimaAuthInvalidResponse, "#{response_code}#{response_msg}"
|
32
|
+
end
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
def check_query_response response
|
37
|
+
raise ZhimaAuthInvalidResponse, "Query request failed" unless (response.is_a? Hash) && response["zhima_customer_certification_query_response"]
|
38
|
+
response_code = response["zhima_customer_certification_query_response"]["code"]
|
39
|
+
if response_code != "10000"
|
40
|
+
response_msg = response["zhima_customer_certification_query_response"]["sub_msg"]
|
41
|
+
raise ZhimaAuthInvalidResponse, "#{response_code}#{response_msg}"
|
42
|
+
end
|
43
|
+
true
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def check_url url
|
49
|
+
raise ZhimaAuthInvalidParams, "Invalid return url" unless url =~ URI::regexp
|
50
|
+
end
|
51
|
+
|
52
|
+
def check_name name
|
53
|
+
raise ZhimaAuthInvalidParams, "Invalid name" if (name.length > 5 || name.length <= 1)
|
54
|
+
true
|
55
|
+
end
|
56
|
+
|
57
|
+
def check_id_no id_no
|
58
|
+
raise ZhimaAuthInvalidParams, "Invalid identity number" unless (id_no.length == 15 || id_no.length == 18)
|
59
|
+
true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/zhima_auth.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "openssl"
|
2
|
+
require "base64"
|
3
|
+
require "uri"
|
4
|
+
require "rest-client"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module ZhimaAuth
|
8
|
+
class << self
|
9
|
+
attr_accessor :configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.configure
|
13
|
+
self.configuration ||= Configuration.new
|
14
|
+
yield(configuration)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.mech_rsa
|
18
|
+
@mech_rsa ||= OpenSSL::PKey::RSA.new configuration.private_key
|
19
|
+
end
|
20
|
+
|
21
|
+
# expected biz_params { cert_name: "王大锤", cert_no: "32099999999999999X", transaction_id(optional): "789789", return_url: "http://www.liangboyuan.pub" }
|
22
|
+
def self.certify biz_params
|
23
|
+
params = biz_params[:transaction_id] ? biz_params : biz_params.merge({transaction_id: SecureRandom.uuid})
|
24
|
+
biz_no = InitializeRequest.new(params).get_biz_no
|
25
|
+
url = CertifyRequest.new({biz_no: biz_no, return_url: biz_params[:return_url]}).generate_url
|
26
|
+
return {
|
27
|
+
biz_no: biz_no,
|
28
|
+
certify_url: url
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
require_relative "zhima_auth/version"
|
34
|
+
require_relative "zhima_auth/configuration"
|
35
|
+
require_relative "zhima_auth/sign"
|
36
|
+
require_relative "zhima_auth/request"
|
37
|
+
require_relative "zhima_auth/web_util"
|
38
|
+
require_relative "zhima_auth/error"
|
39
|
+
require_relative "zhima_auth/validation"
|
data/zhima_auth.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'zhima_auth/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "zhima_auth"
|
8
|
+
spec.version = ZhimaAuth::VERSION
|
9
|
+
spec.authors = ["BranLiang"]
|
10
|
+
spec.email = ["lby89757@hotmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{芝麻认证}
|
13
|
+
spec.description = %q{芝麻认证 for ruby}
|
14
|
+
spec.homepage = "http://www.liangboyuan.pub"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_dependency "rest-client"
|
34
|
+
spec.add_development_dependency "pry-byebug", "~> 3.4.2"
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
38
|
+
spec.add_development_dependency "webmock", "~> 2.0"
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zhima_auth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- BranLiang
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-04-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry-byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.4.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.4.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.13'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.13'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.0'
|
97
|
+
description: 芝麻认证 for ruby
|
98
|
+
email:
|
99
|
+
- lby89757@hotmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rake_tasks~"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- CODE_OF_CONDUCT.md
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- lib/zhima_auth.rb
|
116
|
+
- lib/zhima_auth/configuration.rb
|
117
|
+
- lib/zhima_auth/error.rb
|
118
|
+
- lib/zhima_auth/request.rb
|
119
|
+
- lib/zhima_auth/sign.rb
|
120
|
+
- lib/zhima_auth/validation.rb
|
121
|
+
- lib/zhima_auth/version.rb
|
122
|
+
- lib/zhima_auth/web_util.rb
|
123
|
+
- zhima_auth.gemspec
|
124
|
+
homepage: http://www.liangboyuan.pub
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata:
|
128
|
+
allowed_push_host: https://rubygems.org
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.5.1
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: 芝麻认证
|
149
|
+
test_files: []
|