line-bot-api 1.9.0 → 1.10.0

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
- SHA1:
3
- metadata.gz: f0ff5d8836d29365dc8f80d7caa234495228cbef
4
- data.tar.gz: f34e7b75396dcc7cf41a1eb98cdbc2c4737c62ba
2
+ SHA256:
3
+ metadata.gz: '0258918c87b7575b3311c3b5418e0902150fdddcfda4f6efba06622e44ec4bec'
4
+ data.tar.gz: 339c25cea7f80a9049591ca5236b0a35240ee57f07d4de7b0549bba91799ab31
5
5
  SHA512:
6
- metadata.gz: 6242c7d7b6b63933e3f125eb7c68c92f5a8b0811220e656219e659567829df1cf57ec8144e055b38f27b68502bca232577bd2f7d9fe00c86d0da3cd1b189f5cb
7
- data.tar.gz: af71e03c0d02a5ff32eadbe58e026df8cc78ef0d45925adb1558335d868e4145cb5cdfe5bf774ce781a6c6b6b45c041566c781d4c5d73e2f67d3c62614ac3910
6
+ metadata.gz: 554a0d06637e0887ab60e89ea4e52d7c6e0e29df6ac8878926a5a21ef3e69e0ac920d2ec465a2b164ae3adcbf0d31a031bae22def8964b66057d1246210c081a
7
+ data.tar.gz: 074c31b20b2ba958eb22542b4332624e1f0b63e854148c1d8c9b7da0c34a1b1f9d44dd342caa3d40e1bd93431d2cebc50c8f5c2deea0caa5efb3d611f7cb7be2
data/README.md CHANGED
@@ -1,15 +1,37 @@
1
- # Line::Bot::API
1
+ # LINE Messaging API SDK for Ruby
2
2
 
3
3
  [![Gem-version](https://img.shields.io/gem/v/line-bot-api.svg)](https://rubygems.org/gems/line-bot-api) [![Build Status](https://travis-ci.org/line/line-bot-sdk-ruby.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-ruby)
4
4
 
5
5
 
6
- Line::Bot::API - SDK of the LINE Messaging API for Ruby.
6
+ ## Introduction
7
+ The LINE Messaging API SDK for Ruby makes it easy to develop bots using LINE Messaging API, and you can create a sample bot within minutes.
7
8
 
8
- ## About the LINE Messaging API
9
+ ## Documentation
9
10
 
10
- See the official API reference documentation for more information.
11
+ See the official API documentation for more information
11
12
 
12
- https://developers.line.me/en/docs/messaging-api/reference/
13
+ - English: https://developers.line.biz/en/docs/messaging-api/overview/
14
+ - Japanese: https://developers.line.biz/ja/docs/messaging-api/overview/
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ ```ruby
21
+ gem 'line-bot-api'
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ ```ruby
27
+ bundle
28
+ ```
29
+
30
+ Or install it yourself as:
31
+
32
+ ```sh
33
+ gem install line-bot-api
34
+ ```
13
35
 
14
36
  ## Synopsis
15
37
 
@@ -36,7 +58,7 @@ post '/callback' do
36
58
  end
37
59
 
38
60
  events = client.parse_events_from(body)
39
- events.each { |event|
61
+ events.each do |event|
40
62
  case event
41
63
  when Line::Bot::Event::Message
42
64
  case event.type
@@ -52,40 +74,42 @@ post '/callback' do
52
74
  tf.write(response.body)
53
75
  end
54
76
  end
55
- }
77
+ end
56
78
 
57
79
  "OK"
58
80
  end
59
81
  ```
60
82
 
61
- ## Installation
83
+ ## Help and media
84
+ FAQ: https://developers.line.biz/en/faq/
62
85
 
63
- Add this line to your application's Gemfile:
86
+ Community Q&A: https://www.line-community.me/questions
64
87
 
65
- ```ruby
66
- gem 'line-bot-api'
67
- ```
88
+ News: https://developers.line.biz/en/news/
68
89
 
69
- And then execute:
90
+ Twitter: @LINE_DEV
70
91
 
71
- $ bundle
92
+ ## Versioning
93
+ This project respects semantic versioning.
72
94
 
73
- Or install it yourself as:
95
+ See https://semver.org/
74
96
 
75
- $ gem install line-bot-api
97
+ ## Contributing
98
+ Please check [CONTRIBUTING](contributing.md) before making a contribution.
76
99
 
77
100
  ## License
78
-
79
- Copyright (C) 2016 LINE Corporation.
80
-
81
- Licensed under the Apache License, Version 2.0 (the "License");
82
- you may not use this file except in compliance with the License.
83
- You may obtain a copy of the License at
84
-
85
- http://www.apache.org/licenses/LICENSE-2.0
86
-
87
- Unless required by applicable law or agreed to in writing, software
88
- distributed under the License is distributed on an "AS IS" BASIS,
89
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
90
- See the License for the specific language governing permissions and
91
- limitations under the License.
101
+ ```
102
+ Copyright (C) 2016 LINE Corp.
103
+
104
+ Licensed under the Apache License, Version 2.0 (the "License");
105
+ you may not use this file except in compliance with the License.
106
+ You may obtain a copy of the License at
107
+
108
+ http://www.apache.org/licenses/LICENSE-2.0
109
+
110
+ Unless required by applicable law or agreed to in writing, software
111
+ distributed under the License is distributed on an "AS IS" BASIS,
112
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113
+ See the License for the specific language governing permissions and
114
+ limitations under the License.
115
+ ```
@@ -15,7 +15,7 @@
15
15
  module Line
16
16
  module Bot
17
17
  module API
18
- VERSION = "1.9.0"
18
+ VERSION = "1.10.0"
19
19
  end
20
20
  end
21
21
  end
@@ -131,6 +131,27 @@ module Line
131
131
  request.post
132
132
  end
133
133
 
134
+ # Broadcast messages to users
135
+ #
136
+ # @param messages [Hash or Array]
137
+ #
138
+ # @return [Net::HTTPResponse]
139
+ def broadcast(messages)
140
+ raise Line::Bot::API::InvalidCredentialsError, 'Invalidates credentials' unless credentials?
141
+
142
+ messages = [messages] if messages.is_a?(Hash)
143
+
144
+ request = Request.new do |config|
145
+ config.httpclient = httpclient
146
+ config.endpoint = endpoint
147
+ config.endpoint_path = '/bot/message/broadcast'
148
+ config.credentials = credentials
149
+ config.messages = messages
150
+ end
151
+
152
+ request.post
153
+ end
154
+
134
155
  def leave_group(group_id)
135
156
  raise Line::Bot::API::InvalidCredentialsError, 'Invalidates credentials' unless credentials?
136
157
 
@@ -273,6 +294,16 @@ module Line
273
294
  get(endpoint_path)
274
295
  end
275
296
 
297
+ # Gets the number of messages sent with the /bot/message/multicast endpoint.
298
+ #
299
+ # @param date [String] Date the messages were sent (format: yyyyMMdd)
300
+ #
301
+ # @return [Net::HTTPResponse]
302
+ def get_message_delivery_broadcast(date)
303
+ endpoint_path = "/bot/message/delivery/broadcast?date=#{date}"
304
+ get(endpoint_path)
305
+ end
306
+
276
307
  # Create a rich menu
277
308
  #
278
309
  # @param rich_menu [Hash] The rich menu represented as a rich menu object
@@ -420,6 +451,22 @@ module Line
420
451
  post(endpoint_path)
421
452
  end
422
453
 
454
+ # Get the target limit for additional messages
455
+ #
456
+ # @return [Net::HTTPResponse]
457
+ def get_quota
458
+ endpoint_path = "/bot/message/quota"
459
+ get(endpoint_path)
460
+ end
461
+
462
+ # Get number of messages sent this month
463
+ #
464
+ # @return [Net::HTTPResponse]
465
+ def get_quota_consumption
466
+ endpoint_path = "/bot/message/quota/consumption"
467
+ get(endpoint_path)
468
+ end
469
+
423
470
  # Fetch data, get content of specified URL.
424
471
  #
425
472
  # @param endpoint_path [String]
@@ -483,14 +530,14 @@ module Line
483
530
  def parse_events_from(request_body)
484
531
  json = JSON.parse(request_body)
485
532
 
486
- json['events'].map { |item|
533
+ json['events'].map do |item|
487
534
  begin
488
535
  klass = Line::Bot::Event.const_get(Line::Bot::Util.camelize(item['type']))
489
536
  klass.new(item)
490
537
  rescue NameError
491
538
  Line::Bot::Event::Base.new(item)
492
539
  end
493
- }
540
+ end
494
541
  end
495
542
 
496
543
  # Validate signature
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.9.0
4
+ version: 1.10.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-04-01 00:00:00.000000000 Z
11
+ date: 2019-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.5.2
124
+ rubygems_version: 2.7.6
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: SDK of the LINE Messaging API