line-bot-api 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/line/bot.rb +1 -0
- data/lib/line/bot/api/version.rb +1 -1
- data/lib/line/bot/client.rb +2 -7
- data/lib/line/bot/event.rb +1 -0
- data/lib/line/bot/event/things.rb +37 -0
- data/lib/line/bot/util.rb +24 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e46e17ed076c1ef349b31a9454fe460558d3bfb
|
4
|
+
data.tar.gz: a2ac700cab74c4532e4946d61a4debfcffe9d6f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce2b4e233ca0c9d477e4ed3b63a29dd7f9ce65d969d86da802866f19c912a4148eccb9e85d4b0365a459b2fc722522b5e2ba44f08794797c0bad25dda978949
|
7
|
+
data.tar.gz: 0ed61719314460020b602fa41784b301fcc25d4f18da65f3055aa5339d75aa67d7f173b04d5d53c68103471f2d695015f5aa13b1822c6a1832b398fef7efcf5e
|
data/lib/line/bot.rb
CHANGED
data/lib/line/bot/api/version.rb
CHANGED
data/lib/line/bot/client.rb
CHANGED
@@ -466,9 +466,9 @@ module Line
|
|
466
466
|
|
467
467
|
json['events'].map { |item|
|
468
468
|
begin
|
469
|
-
klass = Line::Bot::Event.const_get(camelize(item['type']))
|
469
|
+
klass = Line::Bot::Event.const_get(Line::Bot::Util.camelize(item['type']))
|
470
470
|
klass.new(item)
|
471
|
-
rescue NameError
|
471
|
+
rescue NameError
|
472
472
|
Line::Bot::Event::Base.new(item)
|
473
473
|
end
|
474
474
|
}
|
@@ -510,11 +510,6 @@ module Line
|
|
510
510
|
b.each_byte { |byte| res |= byte ^ l.shift }
|
511
511
|
res == 0
|
512
512
|
end
|
513
|
-
|
514
|
-
# @return [String]
|
515
|
-
def camelize(string)
|
516
|
-
string.split(/_|(?=[A-Z])/).map(&:capitalize).join
|
517
|
-
end
|
518
513
|
end
|
519
514
|
end
|
520
515
|
end
|
data/lib/line/bot/event.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright 2016 LINE
|
2
|
+
#
|
3
|
+
# LINE Corporation licenses this file to you under the Apache License,
|
4
|
+
# version 2.0 (the "License"); you may not use this file except in compliance
|
5
|
+
# with the License. You may obtain a copy of the License at:
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12
|
+
# License for the specific language governing permissions and limitations
|
13
|
+
# under the License.
|
14
|
+
|
15
|
+
module Line
|
16
|
+
module Bot
|
17
|
+
module Event
|
18
|
+
module ThingsType
|
19
|
+
Link = 'link'
|
20
|
+
Unlink = 'unlink'
|
21
|
+
Unsupport = 'unsupport'
|
22
|
+
end
|
23
|
+
|
24
|
+
class Things < Base
|
25
|
+
def type
|
26
|
+
Line::Bot::Event::ThingsType.const_get(Line::Bot::Util.camelize(@src['things']['type']))
|
27
|
+
rescue NameError
|
28
|
+
Line::Bot::Event::ThingsType::Unsupport
|
29
|
+
end
|
30
|
+
|
31
|
+
def device_id
|
32
|
+
@src['things']['deviceId']
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright 2016 LINE
|
2
|
+
#
|
3
|
+
# LINE Corporation licenses this file to you under the Apache License,
|
4
|
+
# version 2.0 (the "License"); you may not use this file except in compliance
|
5
|
+
# with the License. You may obtain a copy of the License at:
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12
|
+
# License for the specific language governing permissions and limitations
|
13
|
+
# under the License.
|
14
|
+
|
15
|
+
module Line
|
16
|
+
module Bot
|
17
|
+
module Util
|
18
|
+
# @return [String]
|
19
|
+
def self.camelize(string)
|
20
|
+
string.split(/_|(?=[A-Z])/).map(&:capitalize).join
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: line-bot-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LINE Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -95,9 +95,11 @@ files:
|
|
95
95
|
- lib/line/bot/event/member_left.rb
|
96
96
|
- lib/line/bot/event/message.rb
|
97
97
|
- lib/line/bot/event/postback.rb
|
98
|
+
- lib/line/bot/event/things.rb
|
98
99
|
- lib/line/bot/event/unfollow.rb
|
99
100
|
- lib/line/bot/httpclient.rb
|
100
101
|
- lib/line/bot/request.rb
|
102
|
+
- lib/line/bot/util.rb
|
101
103
|
- line-bot-api.gemspec
|
102
104
|
homepage: https://github.com/line/line-bot-sdk-ruby
|
103
105
|
licenses:
|