chat_sdk-gchat 0.1.0 → 0.3.0

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: 3bfec5f052031774aa8db868e443e960182310d8af06672d7da4a9ea6e5816f8
4
- data.tar.gz: 53dcace115831d3816b876f4048b3a693e72a46758c9e133dd24c37d8cad7f9d
3
+ metadata.gz: 0332edadb74c0a145b1191690ff9e7432910de791e57fbce427a1daec1374ed4
4
+ data.tar.gz: d0a335fa198ce5ca2dc762d69ad20321e74e7600e7108187b5ab37719019cdb9
5
5
  SHA512:
6
- metadata.gz: 1930e5a33ef72f960c3368190b578c963f79e384aad21c39950657e96d2a9c8efcedba418d4b922527198668a76083af503230c0c2f09f92c03692ee40c31529
7
- data.tar.gz: '08c9d6e254f0d552c94e70f2210b8304159ff02578989f14a1502e8f6fb1df4930eaceed9f891fdeb500879919022331ad69545ceb9c559f89e1d35ccc28f62d'
6
+ metadata.gz: b03c7d91827618a771a14490e41cf02dbc8a52cfe6ad691991df1a5e3569813fd86697314b213e599b3c580a83550bcb5f4383395e30110a54230d45d29f2644
7
+ data.tar.gz: 9313c31c3faea7e8dd903a58ca79271b3cd1dfe5fec7aa2abd14e2588cb531ff524091ce1b2339d4144b501d71bf128765b7eee4a2f765d9aa519bfc169b75f3
@@ -3,6 +3,8 @@
3
3
  module ChatSDK
4
4
  module GChat
5
5
  class Adapter < ChatSDK::Adapter::Base
6
+ include ChatSDK::GChat::ResourceName
7
+
6
8
  capabilities :edit_messages, :delete_messages, :ephemeral_messages,
7
9
  :threads, :direct_messages, :message_history,
8
10
  :reactions, :streaming_edit
@@ -35,10 +37,7 @@ module ChatSDK
35
37
  end
36
38
 
37
39
  def parse_events(rack_request)
38
- body = rack_request.body.read
39
- rack_request.body.rewind
40
-
41
- payload = JSON.parse(body)
40
+ payload = read_json_body(rack_request)
42
41
  EventParser.parse(payload)
43
42
  rescue JSON::ParserError
44
43
  []
@@ -229,11 +228,6 @@ module ChatSDK
229
228
  raw: msg
230
229
  )
231
230
  end
232
-
233
- def extract_id(resource_name)
234
- return resource_name unless resource_name.is_a?(String)
235
- resource_name.split("/").last || resource_name
236
- end
237
231
  end
238
232
  end
239
233
  end
@@ -3,6 +3,8 @@
3
3
  module ChatSDK
4
4
  module GChat
5
5
  class EventParser
6
+ extend ChatSDK::GChat::ResourceName
7
+
6
8
  class << self
7
9
  def parse(payload)
8
10
  type = payload["type"]
@@ -96,11 +98,6 @@ module ChatSDK
96
98
  annotations = msg_data["annotations"] || []
97
99
  annotations.any? { |a| a["type"] == "USER_MENTION" && a.dig("userMention", "type") == "MENTION" }
98
100
  end
99
-
100
- def extract_id(resource_name)
101
- return resource_name unless resource_name.is_a?(String)
102
- resource_name.split("/").last || resource_name
103
- end
104
101
  end
105
102
  end
106
103
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ChatSDK
4
+ module GChat
5
+ module ResourceName
6
+ def extract_id(resource_name)
7
+ return resource_name unless resource_name.is_a?(String)
8
+ resource_name.split("/").last || resource_name
9
+ end
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chat_sdk-gchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Rootly
7
+ - Quentin Rousseau
8
8
  bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: '1.0'
54
54
  description: Google Chat bot adapter for the ChatSDK framework
55
55
  email:
56
- - eng@rootly.com
56
+ - quentin@rootly.com
57
57
  executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
@@ -62,8 +62,9 @@ files:
62
62
  - lib/chat_sdk/gchat/adapter.rb
63
63
  - lib/chat_sdk/gchat/card_v2_renderer.rb
64
64
  - lib/chat_sdk/gchat/event_parser.rb
65
+ - lib/chat_sdk/gchat/resource_name.rb
65
66
  - lib/chat_sdk/gchat/token_verifier.rb
66
- homepage: https://github.com/rootlyhq/rootly-chat-sdk
67
+ homepage: https://github.com/rootlyhq/chat-sdk
67
68
  licenses:
68
69
  - MIT
69
70
  metadata: