wechat 0.15.0 → 0.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fce405bc512324a4f862cab6f746833ec387b6a5eed1fc9f720a9bda16e309da
4
- data.tar.gz: 932fba467df6c8f357e713bd63e6a5537436fe8e34fc1a9c50f0c9d5010a6707
3
+ metadata.gz: a4b435dd326d145908b8d8bfd395a3c6f8238b0fcbba8c1c75610665f11dac23
4
+ data.tar.gz: 760ac7cb8cb35629c1f4724b6edad484702dd62f5ba1b9125aac1e3f2414310c
5
5
  SHA512:
6
- metadata.gz: 6a2f9892ae32dd7c86f9e4f80d026cef254f738dbb93cab3d8ae3a411307144eb767077e0b781652d2fcc768d2a51cb504e3134bc0c4e0efc4b30066b78152ce
7
- data.tar.gz: 2fba8e299e8cb2614852d587bd84287463a57ae91248dcc8d729ee0539038160ff2ec3f469c4ffad9e3906ae87c2b12020bc6c47501b12127593202da2483322
6
+ metadata.gz: ab4bddc39dcd6c471b128e7ba01dd8a5876215d26b8257b22db535355cfcd4a862c7740098d440fe86633f79191ea9dece7b0b4ff633e4f3994c3d121bc3ec22
7
+ data.tar.gz: f3ed54350f992c62584f3ddebb130b1162d8b73103ea99ddb86f5b99a9b60383b36b122b253ab37b6ddbe4303388319d858ec53b4f033255bd5261c39b992a50
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.15.1 (released at 2022-02-16)
4
+
5
+ * fix "Psych::BadAlias (Unknown alias: default)" in ruby 3.1.0 #309, reported by @otorain
6
+
3
7
  ## v0.15.0 (released at 2021-12-21)
4
8
 
5
9
  * Add wechat message json format support, by @younthu #306
data/bin/wechat CHANGED
@@ -232,7 +232,7 @@ class App < Thor
232
232
 
233
233
  desc 'media_uploadnews [MPNEWS_YAML_PATH]', '上传图文消息素材'
234
234
  def media_uploadnews(mpnews_yaml_path)
235
- mpnew = YAML.load(File.read(mpnews_yaml_path))
235
+ mpnew = Wechat::ApiLoader.load_yaml(File.read(mpnews_yaml_path))
236
236
  puts wechat_api.media_uploadnews(Wechat::Message.new(MsgType: 'uploadnews').mpnews(mpnew[:articles]))
237
237
  end
238
238
 
@@ -349,13 +349,13 @@ class App < Thor
349
349
 
350
350
  desc 'menu_create [MENU_YAML_PATH]', '创建菜单'
351
351
  def menu_create(menu_yaml_path)
352
- menu = YAML.load(File.read(menu_yaml_path))
352
+ menu = Wechat::ApiLoader.load_yaml(File.read(menu_yaml_path))
353
353
  puts 'Menu created' if wechat_api.menu_create(menu)
354
354
  end
355
355
 
356
356
  desc 'menu_addconditional [CONDITIONAL_MENU_YAML_PATH]', '创建个性化菜单'
357
357
  def menu_addconditional(conditional_menu_yaml_path)
358
- conditional_menu = YAML.load(File.read(conditional_menu_yaml_path))
358
+ conditional_menu = Wechat::ApiLoader.load_yaml(File.read(conditional_menu_yaml_path))
359
359
  add_result = wechat_api.menu_addconditional(conditional_menu)
360
360
  puts "Conditional menu created: #{add_result}" if add_result
361
361
  end
@@ -408,7 +408,7 @@ class App < Thor
408
408
 
409
409
  desc 'material_add_news [MPNEWS_YAML_PATH]', '永久图文素材上传'
410
410
  def material_add_news(mpnews_yaml_path)
411
- new = YAML.load(File.read(mpnews_yaml_path))
411
+ new = Wechat::ApiLoader.load_yaml(File.read(mpnews_yaml_path))
412
412
  puts wechat_api.material_add_news(Wechat::Message.new(MsgType: 'mpnews').mpnews(new['articles']))
413
413
  end
414
414
 
@@ -479,13 +479,13 @@ class App < Thor
479
479
 
480
480
  desc 'custom_news [OPENID, NEWS_YAML_PATH]', '发送图文客服消息'
481
481
  def custom_news(openid, news_yaml_path)
482
- articles = YAML.load(File.read(news_yaml_path))
482
+ articles = Wechat::ApiLoader.load_yaml(File.read(news_yaml_path))
483
483
  puts wechat_api.custom_message_send Wechat::Message.to(openid).news(articles['articles'])
484
484
  end
485
485
 
486
486
  desc 'template_message [OPENID, TEMPLATE_YAML_PATH]', '模板消息接口'
487
487
  def template_message(openid, template_yaml_path)
488
- template = YAML.load(File.read(template_yaml_path))
488
+ template = Wechat::ApiLoader.load_yaml(File.read(template_yaml_path))
489
489
  puts wechat_api.template_message_send Wechat::Message.to(openid).template(template['template'])
490
490
  end
491
491
 
@@ -40,6 +40,10 @@ module Wechat
40
40
  @configs = loading_config!
41
41
  end
42
42
 
43
+ def self.load_yaml(result)
44
+ YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(result) : YAML.load(result)
45
+ end
46
+
43
47
  private_class_method def self.loading_config!
44
48
  configs = config_from_file || config_from_environment
45
49
  configs.merge!(config_from_db)
@@ -110,9 +114,7 @@ module Wechat
110
114
  return unless File.exist?(config_file)
111
115
 
112
116
  begin
113
- # rubocop:disable Security/YAMLLoad
114
- raw_data = YAML.load(ERB.new(File.read(config_file)).result)
115
- # rubocop:enable Security/YAMLLoad
117
+ raw_data = load_yaml(ERB.new(File.read(config_file)).result)
116
118
  rescue NameError
117
119
  puts "WARNING: If using 'Rails.application.credentials.wechat_secret!' in wechat.yml, you need run in 'rails c' and access via 'Wechat.api' or gem 'figaro' instead."
118
120
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wechat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skinnyworm
@@ -35,7 +35,7 @@ cert_chain:
35
35
  ZM9IDtdMg8E/4ujwilV8HKmgU77vVN6vSMvxx8zQFSz9a6GbdpB4egPZ++peSk/Q
36
36
  uaIJtOX6M4VC6u7eZfotARKyUy6EcoN2zNqEAQ==
37
37
  -----END CERTIFICATE-----
38
- date: 2021-12-21 00:00:00.000000000 Z
38
+ date: 2022-02-16 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: activesupport
@@ -161,14 +161,28 @@ dependencies:
161
161
  requirements:
162
162
  - - "~>"
163
163
  - !ruby/object:Gem::Version
164
- version: '5.0'
164
+ version: '5.1'
165
165
  type: :development
166
166
  prerelease: false
167
167
  version_requirements: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - "~>"
170
170
  - !ruby/object:Gem::Version
171
- version: '5.0'
171
+ version: '5.1'
172
+ - !ruby/object:Gem::Dependency
173
+ name: rspec-mocks
174
+ requirement: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - '='
177
+ - !ruby/object:Gem::Version
178
+ version: 3.10.2
179
+ type: :development
180
+ prerelease: false
181
+ version_requirements: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - '='
184
+ - !ruby/object:Gem::Version
185
+ version: 3.10.2
172
186
  - !ruby/object:Gem::Dependency
173
187
  name: sqlite3
174
188
  requirement: !ruby/object:Gem::Requirement
@@ -239,8 +253,8 @@ licenses:
239
253
  metadata:
240
254
  bug_tracker_uri: https://github.com/Eric-Guo/wechat/issues
241
255
  changelog_uri: https://github.com/Eric-Guo/wechat/releases
242
- documentation_uri: https://github.com/Eric-Guo/wechat/tree/v0.15.0#readme
243
- source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.15.0
256
+ documentation_uri: https://github.com/Eric-Guo/wechat/tree/v0.15.1#readme
257
+ source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.15.1
244
258
  rubygems_mfa_required: 'true'
245
259
  post_install_message:
246
260
  rdoc_options: []
@@ -257,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
271
  - !ruby/object:Gem::Version
258
272
  version: 1.8.11
259
273
  requirements: []
260
- rubygems_version: 3.2.33
274
+ rubygems_version: 3.3.7
261
275
  signing_key:
262
276
  specification_version: 4
263
277
  summary: DSL for wechat message handling and API
metadata.gz.sig CHANGED
Binary file