aliyun_dypns 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +73 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +10 -0
- data/aliyun_dypns.gemspec +37 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/aliyun_dypns.rb +95 -0
- data/lib/aliyun_dypns/version.rb +3 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 17d926e0bdcc34526d11a1696c33303b36f45bdeed823464484efaf6238354ab
|
4
|
+
data.tar.gz: fb9501d11650f5f426a75b82df8bc1a6e05992fc74da99aa901a9fe624022d79
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bfe7238fa7baa418650c5a09acaf3da402905ab3d6229fcedabca73d8547178abffd040afca86dfd5f09ac1efa82dafe6ec0265afcaa317893848db71e1c95a9
|
7
|
+
data.tar.gz: 9777d63f44cded5fa984fe8f51939224fbd26995c2fd6f8544679de311afd4160e46665cab3fc52a4147be14431a7fad39bf9cf9088c496a7a42819c585de5a0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
aliyun_dypns (0.1.0)
|
5
|
+
aliyunsdkcore
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (6.1.3.2)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 1.6, < 2)
|
13
|
+
minitest (>= 5.1)
|
14
|
+
tzinfo (~> 2.0)
|
15
|
+
zeitwerk (~> 2.3)
|
16
|
+
aliyunsdkcore (0.0.17)
|
17
|
+
activesupport (>= 3.0.0)
|
18
|
+
faraday (>= 0.15.4)
|
19
|
+
coderay (1.1.3)
|
20
|
+
concurrent-ruby (1.1.9)
|
21
|
+
diff-lcs (1.4.4)
|
22
|
+
faraday (1.4.2)
|
23
|
+
faraday-em_http (~> 1.0)
|
24
|
+
faraday-em_synchrony (~> 1.0)
|
25
|
+
faraday-excon (~> 1.1)
|
26
|
+
faraday-net_http (~> 1.0)
|
27
|
+
faraday-net_http_persistent (~> 1.1)
|
28
|
+
multipart-post (>= 1.2, < 3)
|
29
|
+
ruby2_keywords (>= 0.0.4)
|
30
|
+
faraday-em_http (1.0.0)
|
31
|
+
faraday-em_synchrony (1.0.0)
|
32
|
+
faraday-excon (1.1.0)
|
33
|
+
faraday-net_http (1.0.1)
|
34
|
+
faraday-net_http_persistent (1.1.0)
|
35
|
+
i18n (1.8.10)
|
36
|
+
concurrent-ruby (~> 1.0)
|
37
|
+
method_source (1.0.0)
|
38
|
+
minitest (5.14.4)
|
39
|
+
multipart-post (2.1.1)
|
40
|
+
pry (0.14.1)
|
41
|
+
coderay (~> 1.1)
|
42
|
+
method_source (~> 1.0)
|
43
|
+
rake (12.3.3)
|
44
|
+
rspec (3.10.0)
|
45
|
+
rspec-core (~> 3.10.0)
|
46
|
+
rspec-expectations (~> 3.10.0)
|
47
|
+
rspec-mocks (~> 3.10.0)
|
48
|
+
rspec-core (3.10.1)
|
49
|
+
rspec-support (~> 3.10.0)
|
50
|
+
rspec-expectations (3.10.1)
|
51
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
+
rspec-support (~> 3.10.0)
|
53
|
+
rspec-mocks (3.10.2)
|
54
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
55
|
+
rspec-support (~> 3.10.0)
|
56
|
+
rspec-support (3.10.2)
|
57
|
+
ruby2_keywords (0.0.4)
|
58
|
+
tzinfo (2.0.4)
|
59
|
+
concurrent-ruby (~> 1.0)
|
60
|
+
zeitwerk (2.4.2)
|
61
|
+
|
62
|
+
PLATFORMS
|
63
|
+
ruby
|
64
|
+
|
65
|
+
DEPENDENCIES
|
66
|
+
aliyun_dypns!
|
67
|
+
bundler
|
68
|
+
pry
|
69
|
+
rake (~> 12.0)
|
70
|
+
rspec (~> 3.0)
|
71
|
+
|
72
|
+
BUNDLED WITH
|
73
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 TODO: Write your name
|
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,40 @@
|
|
1
|
+
# AliyunDypns
|
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/aliyun_dypns`. 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 'aliyun_dypns'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install aliyun_dypns
|
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]/aliyun_dypns.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative 'lib/aliyun_dypns/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "aliyun_dypns"
|
5
|
+
spec.version = AliyunDypns::VERSION
|
6
|
+
spec.authors = ["42up"]
|
7
|
+
spec.email = ["foobar@v2up.com"]
|
8
|
+
|
9
|
+
spec.summary = "aliyun dypns sdk"
|
10
|
+
spec.description = "aliyun dypns sdk"
|
11
|
+
spec.homepage = "https://github.com/42up/aliyun_dypns"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
|
31
|
+
spec.add_dependency "aliyunsdkcore"
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler"
|
34
|
+
spec.add_development_dependency "rake"
|
35
|
+
spec.add_development_dependency "rspec"
|
36
|
+
spec.add_development_dependency "pry"
|
37
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "aliyun_dypns"
|
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(__FILE__)
|
data/bin/setup
ADDED
data/lib/aliyun_dypns.rb
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
require "aliyun_dypns/version"
|
2
|
+
require "aliyunsdkcore"
|
3
|
+
|
4
|
+
begin
|
5
|
+
require "pry"
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
|
9
|
+
module AliyunDypns
|
10
|
+
class Configuration
|
11
|
+
attr_accessor :access_key_id, :access_key_secret,
|
12
|
+
:region_id, :api_version,
|
13
|
+
:sign_name
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@access_key_id = ""
|
17
|
+
@access_key_secret = ""
|
18
|
+
@sign_name = ""
|
19
|
+
@region_id = "cn-hangzhou"
|
20
|
+
@api_version = "2017-05-25"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class << self
|
25
|
+
attr_writer :configuration
|
26
|
+
|
27
|
+
def configuration
|
28
|
+
@configuration ||= Configuration.new
|
29
|
+
end
|
30
|
+
|
31
|
+
def configure
|
32
|
+
yield(configuration)
|
33
|
+
end
|
34
|
+
|
35
|
+
# {
|
36
|
+
# "Message": "请求成功",
|
37
|
+
# "RequestId": 8906582,
|
38
|
+
# "Code": "OK",
|
39
|
+
# "GetMobileResultDTO": {
|
40
|
+
# "Mobile": 121343241
|
41
|
+
# }
|
42
|
+
# }
|
43
|
+
|
44
|
+
def get_mobile(access_token, out_id = "")
|
45
|
+
response = client.request(
|
46
|
+
action: "GetMobile",
|
47
|
+
params: {
|
48
|
+
"RegionId": configuration.region_id,
|
49
|
+
"AccessToken": access_token,
|
50
|
+
"OutId": out_id,
|
51
|
+
},
|
52
|
+
opts: { method: "POST" },
|
53
|
+
)
|
54
|
+
response.dig("GetMobileResultDTO", "Mobile")
|
55
|
+
rescue StandardError => e
|
56
|
+
{ Code: "BadRequest", Message: "Request failed: #<#{e.class}: #{e.message}>" }
|
57
|
+
end
|
58
|
+
|
59
|
+
# {
|
60
|
+
# "GateVerifyResultDTO": {
|
61
|
+
# "VerifyResult": "PASS",
|
62
|
+
# "VerifyId": 121343241
|
63
|
+
# },
|
64
|
+
# "Message": "请求成功",
|
65
|
+
# "RequestId": 8906582,
|
66
|
+
# "Code": "OK"
|
67
|
+
# }
|
68
|
+
# PASS:一致。 REJECT:不一致。 UNKNOWN:无法判断。
|
69
|
+
def verify_mobile(access_code, phone_number, out_id = "")
|
70
|
+
response = client.request(
|
71
|
+
action: "VerifyMobile",
|
72
|
+
params: {
|
73
|
+
"RegionId": configuration.region_id,
|
74
|
+
"AccessCode": access_code,
|
75
|
+
"PhoneNumber": phone_number,
|
76
|
+
"OutId": out_id,
|
77
|
+
},
|
78
|
+
opts: { method: "POST" },
|
79
|
+
)
|
80
|
+
|
81
|
+
response.dig("GateVerifyResultDTO", "VerifyResult")
|
82
|
+
rescue StandardError => e
|
83
|
+
{ Code: "BadRequest", Message: "Request failed: #<#{e.class}: #{e.message}>" }
|
84
|
+
end
|
85
|
+
|
86
|
+
def client
|
87
|
+
@client ||= RPCClient.new(
|
88
|
+
access_key_id: configuration.access_key_id,
|
89
|
+
access_key_secret: configuration.access_key_secret,
|
90
|
+
api_version: configuration.api_version,
|
91
|
+
endpoint: "https://dypnsapi.aliyuncs.com",
|
92
|
+
)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aliyun_dypns
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 42up
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aliyunsdkcore
|
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: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: aliyun dypns sdk
|
84
|
+
email:
|
85
|
+
- foobar@v2up.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- aliyun_dypns.gemspec
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- lib/aliyun_dypns.rb
|
102
|
+
- lib/aliyun_dypns/version.rb
|
103
|
+
homepage: https://github.com/42up/aliyun_dypns
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata:
|
107
|
+
homepage_uri: https://github.com/42up/aliyun_dypns
|
108
|
+
source_code_uri: https://github.com/42up/aliyun_dypns
|
109
|
+
changelog_uri: https://github.com/42up/aliyun_dypns
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 2.3.0
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubygems_version: 3.1.4
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: aliyun dypns sdk
|
129
|
+
test_files: []
|