wy_wecall 0.1.11

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 651c20954122d230df8ad899ec6dadaa959c6099b572f7d5e2ce8943b433c503
4
+ data.tar.gz: 3aee511fc42a57ee546d6d565cd0ea7a7cfc0762e7cacc5605a2618b30748cef
5
+ SHA512:
6
+ metadata.gz: 6e31ddbf11072025e1d1394945c044f05f021ef5e254f4546863a6c8f8664a0befc71ba01bd689992fc4a5a9c048abc302043411af2929e8b9c5f4f2031584bb
7
+ data.tar.gz: 7643c505efec41efe9f093da661a8825517e41a2761114e9c1ce0d5fb17d4fca42026a3dca4ed6c2a0c26c6fcddea5a6ae6bb9186f4c77ee4474981f82a46ca9
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.4
6
+ before_install: gem install bundler -v 2.1.4
@@ -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 guoyoujin@huiliu.net. 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 [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/GEM.md ADDED
@@ -0,0 +1,23 @@
1
+ ## Create Gem
2
+
3
+ ```ruby
4
+ bundle gem wy_wecall
5
+ ```
6
+
7
+ ## build Gem
8
+
9
+ ```ruby
10
+ gem build wy_wecall.gemspec
11
+ ```
12
+
13
+ ## publishe Gem
14
+
15
+ ```ruby
16
+ gem push wy_wecall-0.1.1.gem
17
+ ```
18
+
19
+ ## rollback publishe Gem
20
+
21
+ ```ruby
22
+ gem yank wy_wecall -v 0.1.0
23
+ ```
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in wy_wecall.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wy_wecall (0.1.7)
5
+ faraday (~> 1.8.0)
6
+ faraday_middleware (~> 1.2.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.6.2)
12
+ faraday (1.8.0)
13
+ faraday-em_http (~> 1.0)
14
+ faraday-em_synchrony (~> 1.0)
15
+ faraday-excon (~> 1.1)
16
+ faraday-httpclient (~> 1.0.1)
17
+ faraday-net_http (~> 1.0)
18
+ faraday-net_http_persistent (~> 1.1)
19
+ faraday-patron (~> 1.0)
20
+ faraday-rack (~> 1.0)
21
+ multipart-post (>= 1.2, < 3)
22
+ ruby2_keywords (>= 0.0.4)
23
+ faraday-em_http (1.0.0)
24
+ faraday-em_synchrony (1.0.1)
25
+ faraday-excon (1.1.0)
26
+ faraday-httpclient (1.0.1)
27
+ faraday-net_http (1.0.2)
28
+ faraday-net_http_persistent (1.2.0)
29
+ faraday-patron (1.0.0)
30
+ faraday-rack (1.0.0)
31
+ faraday_middleware (1.2.1)
32
+ faraday (~> 1.0)
33
+ multipart-post (2.4.1)
34
+ rake (12.3.3)
35
+ rspec (3.13.1)
36
+ rspec-core (~> 3.13.0)
37
+ rspec-expectations (~> 3.13.0)
38
+ rspec-mocks (~> 3.13.0)
39
+ rspec-core (3.13.5)
40
+ rspec-support (~> 3.13.0)
41
+ rspec-expectations (3.13.5)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.13.0)
44
+ rspec-mocks (3.13.5)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.13.0)
47
+ rspec-support (3.13.4)
48
+ ruby2_keywords (0.0.5)
49
+
50
+ PLATFORMS
51
+ ruby
52
+
53
+ DEPENDENCIES
54
+ rake (~> 12.0)
55
+ rspec (~> 3.0)
56
+ wy_wecall!
57
+
58
+ BUNDLED WITH
59
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 youjin
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,74 @@
1
+ # WyWecall
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/wy_wecall`. 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 'wy_wecall'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install wy_wecall
22
+
23
+ ## Usage
24
+
25
+ Ruby Common Program(irb)
26
+
27
+ First Step:
28
+ ```
29
+ require 'wy_wecall'
30
+ ```
31
+ Second Step:
32
+ ```
33
+ $wecall_client = WyWecall::Client.new(
34
+ app_key: 'app_key',
35
+ app_secret: 'app_secret',
36
+ app_type: 'app_type',
37
+ base_url: 'https://b.163.com',
38
+ debug_flag: true,
39
+ algorithm: 'SHA256',
40
+ connection_adapter: Faraday.default_adapter,
41
+ headers: { 'Content-Type' => 'application/json' },
42
+ timeout: 10,
43
+ open_timeout: 10,
44
+ api_path: '/open/api/wecall',
45
+ api_version: 'v1'
46
+ )
47
+ ```
48
+ Request Account info
49
+ ```
50
+ $wecall_client.query_account
51
+ ```
52
+ Return
53
+ ```
54
+ boyd = {\"requestId\":\"7f1c70ba5db7413783\",\"code\":200,\"msg\":\"success\",\"data\":{\"status\":\"AVAILABLE\",\"updateTime\":1751448326000}}
55
+ ```
56
+
57
+ ## Development
58
+
59
+ 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.
60
+
61
+ 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).
62
+
63
+ ## Contributing
64
+
65
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/wy_wecall. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/wy_wecall/blob/master/CODE_OF_CONDUCT.md).
66
+
67
+
68
+ ## License
69
+
70
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
71
+
72
+ ## Code of Conduct
73
+
74
+ Everyone interacting in the WyWecall project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/wy_wecall/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "wy_wecall"
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Account
6
+ def query_account
7
+ get('/account/get')
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module BackUser
6
+ # 功能说明:此接口可以查询当前存在的黑名单分组信息
7
+ def query_black_user_group_list(page = 1, page_size = 10, group_name = nil)
8
+ get('/blackUserGroup/list', { page: page, pageSize: page_size, groupName: group_name })
9
+ end
10
+
11
+ # 功能说明:通过此接口可以添加黑名单用户
12
+ def add_black_user(group_id = nil, black_user_list = nil)
13
+ post('/blackuser/add', { groupId: group_id, blackUserList: black_user_list })
14
+ end
15
+
16
+ # 功能说明:通过此接口可以删除黑名单用户
17
+ def delete_black_user(group_id = nil, phone_list = nil)
18
+ post('/blackuser/remove', { groupId: group_id, phoneList: phone_list })
19
+ end
20
+
21
+ # 功能说明:通过此接口可以查询黑名单用户
22
+ def query_black_user_by_phone(group_id = nil, phone = nil)
23
+ get('/blackuser/queryByPhone', { phone: phone, groupId: group_id })
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Bot
6
+ # 功能说明:通过接口可以分页获取话术列表,包含意向标签和导入字段信息。
7
+ def query_bot_list(page = 1, page_size = 10, bot_name = nil, status = nil)
8
+ get('/bot/getBotList', { page: page, pageSize: page_size, botName: bot_name, status: status })
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module FilterRule
6
+ # 功能说明:通过接口可以分页获取拦截规则列表,包含规则id和规则名称及描述信息。
7
+ def query_filter_rule_list(page = 1, page_size = 10, name = nil)
8
+ get('/filterRule/list', { page: page, pageSize: page_size, name: name })
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+ require 'faraday_middleware'
5
+
6
+ module WyWecall
7
+ module Api
8
+ module HttpBase
9
+ def post(url, body = {})
10
+ conn.post(api_url(url), body) do |req|
11
+ ts = current_timestamp
12
+ req.headers['X-YS-APIKEY'] = app_key
13
+ req.headers['X-YS-TIME'] = ts
14
+ req.headers['X-YS-APPTYPE'] = app_type if app_type.present?
15
+ req.headers['X-YS-SIGNATURE'] = build_body_signature(body, ts)
16
+ end
17
+ end
18
+
19
+ def get(url, params = {})
20
+ conn.get(api_url(url), params) do |req|
21
+ ts = current_timestamp
22
+ req.headers['X-YS-APIKEY'] = app_key
23
+ req.headers['X-YS-TIME'] = ts
24
+ req.headers['X-YS-APPTYPE'] = app_type if app_type.present?
25
+ req.headers['X-YS-SIGNATURE'] = build_signature(params, ts)
26
+ end
27
+ end
28
+
29
+ def api_url(url)
30
+ "#{api_path}/#{api_version}#{url}"
31
+ end
32
+
33
+ def conn
34
+ Faraday.new(url: base_url, headers: headers) do |faraday|
35
+ faraday.options.timeout = timeout
36
+ faraday.options.open_timeout = open_timeout
37
+ faraday.request :json
38
+ faraday.response :json
39
+ faraday.response :raise_error
40
+ faraday.response :logger
41
+ faraday.adapter(connection_adapter)
42
+ end
43
+ end
44
+
45
+ def current_timestamp
46
+ Time.now.to_datetime.strftime('%Q')
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Intent
6
+ # 功能说明:提供给业务方查询意向标签组列表
7
+ def query_intent_groups(page = 1, page_size = 10, name = nil)
8
+ get('/intent/getGroups', { page: page, pageSize: page_size, name: name })
9
+ end
10
+
11
+ # 功能说明:提供给业务方查询意向标签组列表
12
+ def query_intent_groups_by_ids(id_list = nil)
13
+ get('/intent/getGroupsByIds', { idList: id_list })
14
+ end
15
+
16
+ # 功能说明:提供给业务方查询某个意向标签组的意向标签列表
17
+ def query_intent_group_detail(intent_tag_group_id = nil)
18
+ get('/intent/getGroupDetail', { intentTagGroupId: intent_tag_group_id })
19
+ end
20
+
21
+ # 功能说明:提供给业务方创建意向标签组
22
+ def create_intent(name = nil, description = nil, intent_tag_grade = nil, intent_tag_grade_desc = nil)
23
+ post('/intent/create', { intentTagGroupName: name, intentTagList: description, intentTagGrade: intent_tag_grade, intentTagGradeDesc: intent_tag_grade_desc })
24
+ end
25
+
26
+ # 功能说明:提供给业务方更新某个标签组的标签
27
+ def update_intent(intent_tag_group_id = nil, name = nil, description = nil, intent_tag_grade = nil, intent_tag_grade_desc = nil)
28
+ post('/intent/update', { intentTagGroupId: intent_tag_group_id, intentTagGroupName: name, intentTagList: description, intentTagGrade: intent_tag_grade, intentTagGradeDesc: intent_tag_grade_desc })
29
+ end
30
+
31
+ # 功能说明:删除某个未被外呼任务使用过的意向标签组
32
+ # 系统内置的标签组不可删除
33
+ def delete_intent(intent_tag_group_id = nil)
34
+ post('/intent/delete', { intentTagGroupId: intent_tag_group_id })
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Line
6
+ # 通过此接口可以查询已开通的租户的可用线路列表
7
+ def query_active_lines(page = 1, page_size = 10)
8
+ get('/line/getActiveLines', { page: page, pageSize: page_size })
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module LinePolicy
6
+ # 功能说明:通过此接口可以查询智能外显策略列表,为分页查询,支持名称检索
7
+ def query_line_policy_list(page = 1, page_size = 10, search_text = nil)
8
+ get('/linePolicy/list', { page: page, pageSize: page_size, searchText: search_text })
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Order
6
+ # 功能说明:通过此接口可以获取租户消耗类订单列表
7
+ # 注意:消耗类订单,大并发呼叫情况下,剩余金额存在一定的延迟,实时数据请以钱包剩余金额为准
8
+ def query_call_order_list(page = 1, page_size = 10)
9
+ get('/wallet/order/getCallOrder', { page: page, pageSize: page_size })
10
+ end
11
+
12
+ # 功能说明:通过此接口可以获取租户短信类订单列表
13
+ def query_sms_order_list(page = 1, page_size = 10)
14
+ get('/wallet/order/getSmsOrder', { page: page, pageSize: page_size })
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Seat
6
+ # 通过此接口可以查询当前租户坐席使用情况
7
+ def query_seat_info
8
+ get('/seat/getCurrentSeatInfo')
9
+ end
10
+
11
+ # 通过此接口可以查询已开通坐席版的租户购买的坐席明细
12
+ # 如购买智能外呼套餐是消耗版时,该接口坐席情况返回为空
13
+ def query_seat_details(page = 1, page_size = 10)
14
+ get('/seat/getDetails', { page: page, pageSize: page_size })
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Sign
6
+ def build_signature(params, timestamp)
7
+ log_debug("Wecall signature params: #{params}, timestamp: #{timestamp}")
8
+ message = "#{timestamp}#{params.sort.to_h.values.compact.join}"
9
+ log_debug("Wecall signature message: #{message}, algorithm: #{algorithm}, app_secret: #{app_secret}")
10
+ signature = OpenSSL::HMAC.hexdigest(algorithm, app_secret, message)
11
+ log_debug("Wecall signature result: #{signature}")
12
+ signature
13
+ end
14
+
15
+ def build_body_signature(body, timestamp)
16
+ log_debug("Wecall signature body: #{body}, timestamp: #{timestamp}")
17
+ message = "#{timestamp}#{body.to_json}"
18
+ log_debug("Wecall signature message: #{message}, algorithm: #{algorithm}, app_secret: #{app_secret}")
19
+ signature = OpenSSL::HMAC.hexdigest(algorithm, app_secret, message)
20
+ log_debug("Wecall signature result: #{signature}")
21
+ signature
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Sms
6
+ # 功能说明: 通过此接口可以查询当前租户下的所有短信模版,包括未审核通过的。
7
+ def query_sms_template_list(keyword = nil)
8
+ get('/sms/getTemplateList', { keyword: keyword })
9
+ end
10
+
11
+ # 功能说明: 通过此接口可以查询当前租户下的已审核通过的短信模版列表
12
+ def query_valid_sms_template_list(keyword = nil)
13
+ get('/sms/getValidTemplateList', { keyword: keyword })
14
+ end
15
+
16
+ # 功能说明: 通过此接口可以查询当前租户下的所有短信发送记录。
17
+ # 注意:默认查询最近1天的记录,查询范围:#{callTime}~请求时当前时间,callTime最大支持查询近7天的记录。
18
+ # 查询条目上限为10000条。更多数据请对接短信发送结果回调。
19
+ def query_sms_send_record_list(task_id = nil, call_time = nil, page = 1, page_size = 10)
20
+ get('/sms/getSmsSendRecordList', { taskId: task_id, callTime: call_time, page: page, pageSize: page_size })
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Task
6
+ # 功能说明:通过接口可以分页获取任务列表,包含任务id、任务名称、任务状态、创建时间、更新时间。
7
+ def import_customer(task_id = nil, customer_list = [], remove_repeat = false, encrypted_phone = false, on_call = false)
8
+ post('/task/importCustomer', { taskId: task_id, customerList: customer_list, removeRepeat: remove_repeat, encryptedPhone: encrypted_phone, onCall: on_call })
9
+ end
10
+
11
+ # 通过此接口可以向指定的任务导入客户信息,用于拨打电话。(单次导入客户数量不能大于100)
12
+ # 此接口是公网服务,所有客户共用,为保证接口响应速度和吞吐量,并控制服务器压力,将单次导入个数定位100个。
13
+ # 数据量大时可以重复调用此接口来实现(qps最大可为1000)。
14
+ # 导入的客户,如果部分成功,部分失败的话,会返回200。
15
+ # 该接口会返回所有导入成功和导入失败的客户列表,成功的客户列表中包含callId,可用于后续查询该通话的详情信息。
16
+ # 支持用户手机号MD5导入和aes加密后导入。加密配置参考加密配置。接口对接参考敏感字段加密。
17
+ def import_customer_with_result(task_id = nil, customer_list = [], remove_repeat = false, encrypted_phone = false, on_call = false)
18
+ post('/task/importCustomerWhitResult', { taskId: task_id, customerList: customer_list, removeRepeat: remove_repeat, encryptedPhone: encrypted_phone, onCall: on_call })
19
+ end
20
+
21
+ # 通过此接口可以创建或者更新一个外呼任务。更新任务时,需要指定任务id。
22
+ # 注意:单个apiKey可创建的任务上限为50000(已被删除的任务不参与统计,即删除任务可以释放可创建任务额度)
23
+ def save_task(body = {})
24
+ post('/task/save', body)
25
+ end
26
+
27
+ # 通过此接口可以删除指定的任务。
28
+ def delete_task(task_id = nil)
29
+ post('/task/delete', { taskId: task_id })
30
+ end
31
+
32
+ # 通过此接口可以开启指定的外呼任务
33
+ def start_task(task_id = nil)
34
+ post('/task/start', { taskId: task_id })
35
+ end
36
+
37
+ # 通过此接口可以停止正在进行的任务
38
+ def stop_task(task_id = nil)
39
+ post('/task/stop', { taskId: task_id })
40
+ end
41
+
42
+ # 通过此接口可以开启指定的外呼任务定时,开启任务定时后,任务进入定时状态,在满足运行条件后,自动运行,不需要再手动调用开启任务
43
+ def start_timing_task(task_id = nil)
44
+ post('/task/startTiming', { taskId: task_id})
45
+ end
46
+
47
+ # 通过此接口可以停止外呼任务的定时,任务进入待运行状态
48
+ def stop_timing_task(task_id = nil)
49
+ post('/task/stopTiming', { taskId: task_id })
50
+ end
51
+
52
+ # 功能说明: 通过此接口可以获取租户的任务列表
53
+ def query_task_list(name = nil, status=nil, page = 1, page_size = 10, create_start = nil, create_end = nil)
54
+ params = {
55
+ name: name,
56
+ status: status,
57
+ page: page,
58
+ pageSize: page_size,
59
+ createStart: create_start,
60
+ createEnd: create_end
61
+ }
62
+ get('/task/getTaskList', params)
63
+ end
64
+
65
+ # 功能说明: 通过此接口可以获取租户的任务详情
66
+ def query_task_detail(task_id = nil)
67
+ get('/task/getTaskDetail', { taskId: task_id })
68
+ end
69
+
70
+ # 功能说明: 通过此接口指定任务的详情
71
+ def query_task_properties(task_id = nil)
72
+ get('/task/getTaskProperties', { taskId: task_id })
73
+ end
74
+
75
+ # 功能说明: 通过此接口获取当前租户任务统计
76
+ def query_task_summary
77
+ get('/task/taskSummary')
78
+ end
79
+
80
+ # 功能说明: 通过此接口获取当前租户文件信息
81
+ def query_console_folder_list
82
+ get('/console/folder/list')
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module TaskCall
6
+ # 功能说明:通过此接口可以获取未呼的通话记录。
7
+ # 注意:默认查询最近1天的记录,查询范围:#{callTime}~请求时当前时间,callTime最大支持查询近7天的记录。
8
+ # 查询条目上限为10000条。更多数据请对接通话完成回调接口。
9
+ def query_trask_call_un_call_list(task_id = nil, page = 1, page_size = 10, user_name = nil, phone = nil, import_time = nil)
10
+ get('/taskCall/unCallList', { taskId: task_id, page: page, pageSize: page_size, userName: user_name, phone: phone, importTime: import_time })
11
+ end
12
+
13
+ # 功能说明: 通过此接口删除未呼的通话记录
14
+ def delete_task_call(call_id = nil)
15
+ post('/taskCall/delete', { callId: call_id })
16
+ end
17
+
18
+ # 功能说明: 通过此接口可以获取已呼的通话记录
19
+ # 注意:默认查询最近1天的记录,查询范围:#{callTime}~请求时当前时间,callTime最大支持查询近7天的记录。
20
+ # 查询条目上限为10000条。更多数据请对接已呼通话记录回调
21
+ def query_task_call_list(task_id = nil, page = 1, page_size = 10, user_name = nil, phone = nil, call_time = nil)
22
+ get('/taskCall/callList', { taskId: task_id, page: page, pageSize: page_size, userName: user_name, phone: phone, callTime: call_time })
23
+ end
24
+
25
+ # 功能说明: 通通过此接口可以获取拦截的通话记录
26
+ # 注意:默认查询最近1天的记录,查询范围:#{callTime}~请求时当前时间,callTime最大支持查询近7天的记录。
27
+ # 查询条目上限为10000条。更多数据请对接已呼通话记录回调
28
+ def query_filtered_call_list(task_id = nil, page = 1, page_size = 10, user_name = nil, phone = nil, call_time = nil)
29
+ get('/taskCall/filteredCallList', { taskId: task_id, page: page, pageSize: page_size, userName: user_name, phone: phone, callTime: call_time })
30
+ end
31
+
32
+ # 功能说明: 通通过此接口可以获取拦截的通话记录
33
+ # 注意:默认查询最近1天的记录,查询范围:#{callTime}~请求时当前时间,callTime最大支持查询近7天的记录。
34
+ # 查询条目上限为10000条。更多数据请对接已呼通话记录回调
35
+ def query_task_call_detail(call_id = nil)
36
+ get('/taskCall/detail', { callId: call_id })
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ module Api
5
+ module Wallet
6
+ # 通过此接口可以查询已开通的租户的的当前钱包资源信息
7
+ def query_wallet_info
8
+ get('/wallet/getInfo')
9
+ end
10
+
11
+ # 通过此接口可以查询已开通的租户的短信资源信息
12
+ def query_wallet_sms_info
13
+ get('/wallet/getSmsInfo')
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Dir["#{File.dirname(__FILE__)}/api/*.rb"].each do |path|
4
+ require path
5
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ class Client
5
+ include Api::HttpBase
6
+ include Api::Account
7
+ include Api::BackUser
8
+ include Api::Bot
9
+ include Api::FilterRule
10
+ include Api::Intent
11
+ include Api::Line
12
+ include Api::LinePolicy
13
+ include Api::Order
14
+ include Api::Seat
15
+ include Api::Sms
16
+ include Api::Task
17
+ include Api::TaskCall
18
+ include Api::Wallet
19
+ include Api::Sign
20
+
21
+ attr_accessor :app_key, :app_secret, :app_type, :algorithm, :base_url,
22
+ :connection_adapter, :headers, :timeout, :open_timeout,
23
+ :api_path, :api_version, :debug_flag
24
+
25
+ def initialize(options = {})
26
+ @app_key = options[:app_key] || WyWecall.configuration.app_key
27
+ @app_secret = options[:app_secret] || WyWecall.configuration.app_secret
28
+ @app_type = options[:app_type] || WyWecall.configuration.app_type
29
+ @algorithm = options[:algorithm] || WyWecall.configuration.algorithm
30
+ @headers = options[:headers] || WyWecall.configuration.headers
31
+ @base_url = options[:base_url] || WyWecall.configuration.base_url || WyWecall::Configuration::DEFAULT_BASE_URL
32
+ @connection_adapter = options[:connection_adapter] || WyWecall.configuration.connection_adapter
33
+ @timeout = options[:timeout] || WyWecall.configuration.timeout
34
+ @open_timeout = options[:open_timeout] || WyWecall.configuration.open_timeout
35
+ @api_path = options[:api_path] || WyWecall.configuration.api_path || WyWecall::Configuration::DEFAULT_API_PATH
36
+ @api_version = options[:api_version] || WyWecall.configuration.api_version || WyWecall::Configuration::DEFAULT_API_VERSION
37
+ @debug_flag = options[:debug_flag] || WyWecall.configuration.debug_flag
38
+ end
39
+
40
+ def log_debug(message)
41
+ return unless @debug_flag
42
+
43
+ puts message
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ class Configuration
5
+ DEFAULT_BASE_URL = 'https://b.163.com'
6
+ DEFAULT_API_PATH = '/open/api/wecall'
7
+ DEFAULT_API_VERSION = 'v1'
8
+ DEFAULT_ALGORITHM = 'SHA256'
9
+ attr_accessor :app_key, :app_secret, :app_type, :algorithm, :base_url,
10
+ :connection_adapter, :headers, :timeout, :open_timeout,
11
+ :api_path, :api_version, :debug_flag
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WyWecall
4
+ VERSION = '0.1.11'
5
+ end
data/lib/wy_wecall.rb ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'wy_wecall/version'
4
+ require 'wy_wecall/configuration'
5
+ require 'wy_wecall/api'
6
+ require 'wy_wecall/client'
7
+
8
+ module WyWecall
9
+ class << self
10
+ attr_writer :configuration
11
+
12
+ def configure
13
+ yield(configuration)
14
+ end
15
+
16
+ def configuration
17
+ @configuration ||= Configuration.new
18
+ end
19
+ end
20
+ end
data/wy_wecall.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ require_relative 'lib/wy_wecall/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "wy_wecall"
5
+ spec.version = WyWecall::VERSION
6
+ spec.authors = ["TryCatch"]
7
+ spec.email = ["guoyoujin123@gmail.com"]
8
+
9
+ spec.summary = %q{支持网易云商智能外呼的 Ruby Api 客户端}
10
+ spec.description = %q{支持网易云商智能外呼的 Ruby Api客户端}
11
+ spec.homepage = "https://rubygems.org/gems/wy_wecall"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/guoyoujin/wy_wecall"
19
+ spec.metadata["changelog_uri"] = "https://github.com/guoyoujin/wy_wecall"
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
+ spec.add_dependency "faraday", "~> 1.8.0"
30
+ spec.add_dependency "faraday_middleware", "~> 1.2.1"
31
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wy_wecall
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.11
5
+ platform: ruby
6
+ authors:
7
+ - TryCatch
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-07-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.8.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.1
41
+ description: 支持网易云商智能外呼的 Ruby Api客户端
42
+ email:
43
+ - guoyoujin123@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".travis.yml"
51
+ - CODE_OF_CONDUCT.md
52
+ - GEM.md
53
+ - Gemfile
54
+ - Gemfile.lock
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - bin/console
59
+ - bin/setup
60
+ - lib/wy_wecall.rb
61
+ - lib/wy_wecall/api.rb
62
+ - lib/wy_wecall/api/account.rb
63
+ - lib/wy_wecall/api/back_user.rb
64
+ - lib/wy_wecall/api/bot.rb
65
+ - lib/wy_wecall/api/filter_rule.rb
66
+ - lib/wy_wecall/api/http_base.rb
67
+ - lib/wy_wecall/api/intent.rb
68
+ - lib/wy_wecall/api/line.rb
69
+ - lib/wy_wecall/api/line_policy.rb
70
+ - lib/wy_wecall/api/order.rb
71
+ - lib/wy_wecall/api/seat.rb
72
+ - lib/wy_wecall/api/sign.rb
73
+ - lib/wy_wecall/api/sms.rb
74
+ - lib/wy_wecall/api/task.rb
75
+ - lib/wy_wecall/api/task_call.rb
76
+ - lib/wy_wecall/api/wallet.rb
77
+ - lib/wy_wecall/client.rb
78
+ - lib/wy_wecall/configuration.rb
79
+ - lib/wy_wecall/version.rb
80
+ - wy_wecall.gemspec
81
+ homepage: https://rubygems.org/gems/wy_wecall
82
+ licenses:
83
+ - MIT
84
+ metadata:
85
+ allowed_push_host: https://rubygems.org
86
+ homepage_uri: https://rubygems.org/gems/wy_wecall
87
+ source_code_uri: https://github.com/guoyoujin/wy_wecall
88
+ changelog_uri: https://github.com/guoyoujin/wy_wecall
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 2.3.0
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubygems_version: 3.1.6
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: 支持网易云商智能外呼的 Ruby Api 客户端
108
+ test_files: []