khl 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3110943f00d66a4139d82f1f13798cde8f4ffddc0462cffeb3c47c5e131a2b47
4
- data.tar.gz: bc8cb50c6876fbbc769667525f84bcbda3c2a9aa1d1e76bfdb00a2525a443ea8
3
+ metadata.gz: 5b3ff60071d40b884b84c71573ec653fe5234c849e70adfa9d3527c8b790eb2e
4
+ data.tar.gz: cc54276f09718288a23b72b8f55e49cc12a19b20f15680af4f6478dffbe5153d
5
5
  SHA512:
6
- metadata.gz: 8b4be1d65e2cb54e3d1b1a762253bc2fa3578bf448b056d9905edc7a0823c216802a857122b6904b93484f016585b2c5d5e314500b38ad0839765526ac6f0a43
7
- data.tar.gz: 99916625ffb6cb60f9613785167cae2209ad6e0f9f61af09a2f22e4d84605d4041aefaf0d6630612bb45adc22f6cb01881e13debe15cb1be5b4701596e36d480
6
+ metadata.gz: 7f83216e039d7b3c3c088ab07d0900ecdd60b6b2f70a360933d05d41265ec6c43160c895bca64add54529dc026f5cbfdd0c8084e12afffb62b6681f87ef5fec6
7
+ data.tar.gz: 8e4558eab997c80038df0385ce67141797980c74358276dcc58ec7e56b3f5842f1d3d31eff73c8f71bb9c9a6fb86eaf13aac26075888bdd0b8bdabb9019e020f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 1.2.1 - 2022-04-18
2
+
3
+ * Add hash support for KHL::Message.parse
4
+
1
5
  ### 1.2.0 - 2022-04-08
2
6
 
3
7
  * Fix 开黑啦 Webhook API
data/lib/khl/message.rb CHANGED
@@ -22,14 +22,14 @@ module KHL
22
22
  def self.parse(raw)
23
23
  return unless raw
24
24
 
25
- data = JSON.parse(raw)
25
+ data = raw.is_a?(String) ? JSON.parse(raw) : raw
26
26
  data = ActiveSupport::HashWithIndifferentAccess.new(data)
27
27
 
28
- message = Message.new
29
- message.type = TYPES[data[:s]]
30
- message.data = data[:d]
31
- message.sn = data[:sn]
32
- message
28
+ Message.new(
29
+ type: TYPES[data[:s]],
30
+ data: data[:d],
31
+ sn: data[:sn]
32
+ )
33
33
  end
34
34
 
35
35
  def initialize(type: nil, data: nil, sn: nil)
data/lib/khl/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KHL
4
- VERSION = "1.2.0"
4
+ VERSION = "1.2.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: khl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dounx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-08 00:00:00.000000000 Z
11
+ date: 2022-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.3.10
106
+ rubygems_version: 3.3.11
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Ruby SDK for 开黑啦