edoc2-api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5a521af09df01968b46d3b64683dc2f16bcc26089066a58b21f90a5cada045ed
4
+ data.tar.gz: fb7bfd91970065fb8959775a2ecb09342bc0f2f4faee3b8ce28ed406bda392d5
5
+ SHA512:
6
+ metadata.gz: 3e59857907950bb5275ebd942f9e6756abe293eddc2646238f984ab363466b3aadaf2b9439b04548a8f18a30d49f83653eb5609a899d871e71fe092bb4211853
7
+ data.tar.gz: 60665d2769475a15aa2c87a6acf2c92b05218fc5b0014a8db0bad2c410ea680b7e3a4e8c20d5ad9245a93deae54aebe23b605bbdbe888eace88a4b1081c84319
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ m��w��M��a8:�� ^a�eØ���^Tz�ⳁd:)r[��:�{^]�r�ۓ�ő����j�_Ũ?���(�j� ܄�����O{�r7�����3�/h�����N}�# A���$c�E����Z�?"��C�8b�n'��- 72��]�SS1�5�M�����~�h�m>�����]N�BoS��n�j��WYR2��7���Xȗ�Ά֯$��Àe��]2)���� �q�O,l�`1(9��Xt��`�6�YL��9n�����'���;�n^�%�x\Qa�U��}g �V��2)c���"����� ���=Q�u��Ky
2
+ evMӪ<��{��y�\3����A1�:Qv
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.idea
2
+ .DS_Store
3
+ /.bundle/
4
+ /.yardoc
5
+ /Gemfile.lock
6
+ /_yardoc/
7
+ /coverage/
8
+ /doc/
9
+ /pkg/
10
+ /spec/reports/
11
+ /tmp/
12
+ *.sublime-workspace
13
+ spec/examples.txt
14
+ .byebug_history
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Eric-Guo @ Tianhua Architectural Design Co., Ltd
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ edoc2-api [![Gem Version][version-badge]][rubygems]
2
+ =======
3
+
4
+ An unofficial edoc2 API wrap gem.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'edoc2-api'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install edoc2-api
21
+
22
+ ## Usage
23
+
24
+ ### Config
25
+
26
+ Create `config/initializers/edoc2-api.rb` and put following configurations into your Rails project.
27
+
28
+ ```ruby
29
+ Edoc2.apikey = 'your_api_key'
30
+ Edoc2.secretkey = 'your_secret_key'
31
+ Edoc2.base_url = 'http://api.yunxuetang.com.cn' # notice no / at end
32
+ ```
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/thape-cn/edoc2-api. 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.
37
+
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
42
+
43
+
44
+ [version-badge]: https://badge.fury.io/rb/edoc2-api.svg
45
+ [rubygems]: https://rubygems.org/gems/edoc2-api
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Edoc2
4
+ def self.create_user(users_hash, islink: 1, is_send_notice: 0)
5
+ request 'v1/udp/sy/sv/use', islink: islink, isSendNotice: is_send_notice,
6
+ datas: users_hash.collect { |h| h.merge(isEmailValidated: 1, isMobileValidated: 1) }
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Edoc2
4
+ VERSION = '0.0.1'
5
+ end
data/lib/edoc2-api.rb ADDED
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'http'
4
+ require 'json'
5
+ require 'edoc2-api/user'
6
+ require 'edoc2-api/version'
7
+
8
+ module Edoc2
9
+ class Edoc2API_Error < RuntimeError; end
10
+
11
+ class << self
12
+ attr_accessor :loginName
13
+ attr_accessor :ipAddress
14
+ attr_accessor :integrationKey
15
+
16
+ attr_accessor :base_url
17
+ end
18
+
19
+ # Make an HTTP request with the given verb to Edoc2 API server
20
+ # @param resource [String]
21
+ # @option options [Hash]
22
+ # @return [HTTP::Response]
23
+ def self.request(resource, options = {})
24
+ @http ||= HTTP.persistent @base_url
25
+
26
+ json_params = with_signature(options)
27
+
28
+ res = @http.post("#{base_url}/#{resource}", json: json_params)
29
+
30
+ case res.code
31
+ when 40101
32
+ raise Edoc2API_Error, '授权码签名无效!'
33
+ end
34
+
35
+ res
36
+ end
37
+
38
+ private_class_method
39
+
40
+ def self.with_signature(options = {})
41
+ {
42
+ loginName: loginName,
43
+ ipAddress: ipAddress,
44
+ integrationKey: integrationKey
45
+ }.merge options
46
+ end
47
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: edoc2-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Eric Guo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMRMwEQYDVQQDDAplcmlj
14
+ Lmd1b2N6MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNj
15
+ b20wHhcNMjIxMjA5MDcyMTE1WhcNMjMxMjA5MDcyMTE1WjBBMRMwEQYDVQQDDApl
16
+ cmljLmd1b2N6MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
17
+ FgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC6jGarls5mU792
18
+ leWot9tWKXnnvVnj1oUPea8M77PpHcYMVmjUTkjgsrKiOFNv2nAjUIDrUaLJvuKi
19
+ 95zZYLIT3uWqI9QvSSDr+rs4HyIDcXuWWB89GpKN5WgyCVel6V9X5PN0C5hIiz8T
20
+ ThW7ZqkS8mTmHm2micL8/lmnelpxj9EjCin7xOCvebB9pdA7Y0kXMLbnRq4QK2lB
21
+ O2YRbLvYKWOQfO/sqLlwFsNWMNkj5ZROIqmKRvOHQdchox2RfBNsWRZ7XH8tTW1L
22
+ cqx95dI2qC6Xg+IHjN4Wc6n+Ak1KENlVjI4mGcuk+34d1S9gaZT8vW/cYcL30Nbg
23
+ AAUQvS4AQ8gmAkk1+oNs+725QLBprbnSN5PJr9VQiDteNHHkY5ugjndeAByOGy8h
24
+ /TgV4tBZQ0IT37ZRDcP4dayFMm2DVjS4uU7RUXLgc8sdOGeMmsFwdz9QrBPGeKsV
25
+ 4+dXjrzzUvwRX4K21mx4ZSP9eSOscOEuzRIRTnab0GniDhkkHc8CAwEAAaN7MHkw
26
+ CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFPGkToJNhoEfhsOYqnTH
27
+ MZDYyjQtMB8GA1UdEQQYMBaBFGVyaWMuZ3VvY3pAZ21haWwuY29tMB8GA1UdEgQY
28
+ MBaBFGVyaWMuZ3VvY3pAZ21haWwuY29tMA0GCSqGSIb3DQEBCwUAA4IBgQCdTl5T
29
+ qfcrbo4KdgZM84ZbeiUIXcRy/chbfQfPZ/qPp7qKARLxRJINmaqt/bP+RrlQypEe
30
+ 1EIYhbxLGo1TvpbRFuADUhZjGZ8Vaa+bgPfj8Dxa71ow5dF9nrqidddV7qjmk57F
31
+ klOrOl+99Ryx01OAdlxGZqz/VrHrzbhQNtiUl2BYnosZLddYPTzuhNLe72eIypkY
32
+ synsOqoXRuegCtO4sSGSvRV79/GyN0jqtptpa61MaxgYG13+P8QwXeTo2Ro86ZAJ
33
+ h+KBs65p0MiFHl6zc2oany9Pk0kqs50TDKOCT7ZdSxz5xes0SvTi3mmX3XemjQhm
34
+ qNb+5zsj4Kn5auKYA7GupfLYKS/dYt4EIfNKhSEHgkVFdVPxSAQ73UAWsndINTTA
35
+ HjK18j09PoL9vWMUtyez2xpxlRDA+bEkF74AEVwMYozjP8VNM1ERTG+8kROuQjGV
36
+ aWhGk3yVuHjmlBvfDpPqmux3ulWXnvHulcYiPxETh/m3PUfIKMTHydjAz88=
37
+ -----END CERTIFICATE-----
38
+ date: 2023-09-08 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: http
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.3
47
+ - - "<"
48
+ - !ruby/object:Gem::Version
49
+ version: '6'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 2.0.3
57
+ - - "<"
58
+ - !ruby/object:Gem::Version
59
+ version: '6'
60
+ - !ruby/object:Gem::Dependency
61
+ name: rake
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ - !ruby/object:Gem::Dependency
75
+ name: rspec
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ description: Helping rubyist integration with edoc2 API easier.
89
+ email:
90
+ - eric.guocz@gmail.com
91
+ executables: []
92
+ extensions: []
93
+ extra_rdoc_files: []
94
+ files:
95
+ - ".gitignore"
96
+ - LICENSE
97
+ - README.md
98
+ - lib/edoc2-api.rb
99
+ - lib/edoc2-api/user.rb
100
+ - lib/edoc2-api/version.rb
101
+ homepage: https://github.com/thape-cn/edoc2-api
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '2.4'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubygems_version: 3.4.19
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: An unofficial edoc2 API wrap gem
124
+ test_files: []
metadata.gz.sig ADDED
Binary file