lita-glip 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/lita/adapters/glip/message_handler.rb +2 -1
- data/lib/lita/adapters/glip/user_creator.rb +10 -2
- data/lita-glip.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b73e28630b7f2b002b286a65a53c46db29d527e
|
4
|
+
data.tar.gz: 58dfe465ef6578ef594ddc1a8dec60ac32b7732d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 520d7554527cc38f616cb962a3381d399ffb37bfde161589f52fb7f49b1ee06b620fc34028a5f86bc97e1630be9b6df13836fd872aa566ab64f9e423eb7b52e4
|
7
|
+
data.tar.gz: 8365b79c691e3357afff2a20ad1937162ab6d2e667c3bbfec4b4e7e288af629460b8392038c1b897d93c105d60c9f2f3529872d1bc2b2433ca8b8f0f60830bbe
|
data/CHANGELOG.md
CHANGED
@@ -12,7 +12,8 @@ module Lita
|
|
12
12
|
|
13
13
|
def update(message)
|
14
14
|
m = message
|
15
|
-
|
15
|
+
|
16
|
+
unless m.is_a?(Hash) && m.key?('event') && m['event'].index('/glip/posts').is_a?(Integer)
|
16
17
|
return
|
17
18
|
end
|
18
19
|
unless m.key?('body') && m['body'].key?('messageType') && m['body']['messageType'] == "PostAdded"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'multi_json'
|
2
|
+
|
1
3
|
module Lita
|
2
4
|
module Adapters
|
3
5
|
class Glip < Adapter
|
@@ -9,14 +11,20 @@ module Lita
|
|
9
11
|
|
10
12
|
def create_user(user_id, glip_sdk)
|
11
13
|
res = glip_sdk.persons.get personId: user_id
|
14
|
+
Lita.logger.debug("Glip API Response Status: #{res.status}.")
|
15
|
+
|
12
16
|
if res.status == 200
|
13
17
|
glip_user_name = real_name res.body
|
14
|
-
|
15
|
-
|
18
|
+
Lita.logger.debug("Glip API Response: User Name: #{glip_user_name}/#{res.body['id']}.")
|
19
|
+
user = Lita::User.create(
|
20
|
+
res.body['id'],
|
16
21
|
name: glip_user_name,
|
17
22
|
mention_name: glip_user_name
|
18
23
|
)
|
24
|
+
Lita.logger.debug("Created New User With User Name [#{glip_user['id']}][#{glip_user_name}]")
|
25
|
+
return user
|
19
26
|
end
|
27
|
+
Lita.logger.debug("Create New User [#{user_id}]")
|
20
28
|
User.create user_id
|
21
29
|
end
|
22
30
|
|
data/lita-glip.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-glip'
|
3
|
-
spec.date = '2017-
|
4
|
-
spec.version = '0.0.
|
3
|
+
spec.date = '2017-03-13'
|
4
|
+
spec.version = '0.0.3'
|
5
5
|
spec.authors = ['John Wang']
|
6
6
|
spec.email = ["johncwang@gmail.com"]
|
7
7
|
spec.description = %q{A Glip adapter for Lita.}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-glip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|