line-bot-api 2.0.0 → 2.1.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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +49 -1
  3. data/README.md +34 -16
  4. data/lib/line/bot/v2/messaging_api/api/messaging_api_client.rb +269 -0
  5. data/lib/line/bot/v2/messaging_api/core.rb +39 -0
  6. data/lib/line/bot/v2/messaging_api/model/acquisition_condition_request.rb +77 -0
  7. data/lib/line/bot/v2/messaging_api/model/acquisition_condition_response.rb +78 -0
  8. data/lib/line/bot/v2/messaging_api/model/cash_back_fixed_price_info_request.rb +72 -0
  9. data/lib/line/bot/v2/messaging_api/model/cash_back_fixed_price_info_response.rb +78 -0
  10. data/lib/line/bot/v2/messaging_api/model/cash_back_percentage_price_info_request.rb +72 -0
  11. data/lib/line/bot/v2/messaging_api/model/cash_back_percentage_price_info_response.rb +72 -0
  12. data/lib/line/bot/v2/messaging_api/model/cash_back_price_info_request.rb +77 -0
  13. data/lib/line/bot/v2/messaging_api/model/cash_back_price_info_response.rb +77 -0
  14. data/lib/line/bot/v2/messaging_api/model/coupon_cash_back_reward_request.rb +72 -0
  15. data/lib/line/bot/v2/messaging_api/model/coupon_cash_back_reward_response.rb +72 -0
  16. data/lib/line/bot/v2/messaging_api/model/coupon_create_request.rb +139 -0
  17. data/lib/line/bot/v2/messaging_api/model/coupon_create_response.rb +67 -0
  18. data/lib/line/bot/v2/messaging_api/model/coupon_discount_reward_request.rb +72 -0
  19. data/lib/line/bot/v2/messaging_api/model/coupon_discount_reward_response.rb +72 -0
  20. data/lib/line/bot/v2/messaging_api/model/coupon_free_reward_request.rb +66 -0
  21. data/lib/line/bot/v2/messaging_api/model/coupon_free_reward_response.rb +66 -0
  22. data/lib/line/bot/v2/messaging_api/model/coupon_gift_reward_request.rb +66 -0
  23. data/lib/line/bot/v2/messaging_api/model/coupon_gift_reward_response.rb +66 -0
  24. data/lib/line/bot/v2/messaging_api/model/coupon_list_response.rb +73 -0
  25. data/lib/line/bot/v2/messaging_api/model/coupon_message.rb +91 -0
  26. data/lib/line/bot/v2/messaging_api/model/coupon_others_reward_request.rb +66 -0
  27. data/lib/line/bot/v2/messaging_api/model/coupon_others_reward_response.rb +66 -0
  28. data/lib/line/bot/v2/messaging_api/model/coupon_response.rb +169 -0
  29. data/lib/line/bot/v2/messaging_api/model/coupon_reward_request.rb +80 -0
  30. data/lib/line/bot/v2/messaging_api/model/coupon_reward_response.rb +80 -0
  31. data/lib/line/bot/v2/messaging_api/model/discount_explicit_price_info_request.rb +78 -0
  32. data/lib/line/bot/v2/messaging_api/model/discount_explicit_price_info_response.rb +84 -0
  33. data/lib/line/bot/v2/messaging_api/model/discount_fixed_price_info_request.rb +72 -0
  34. data/lib/line/bot/v2/messaging_api/model/discount_fixed_price_info_response.rb +78 -0
  35. data/lib/line/bot/v2/messaging_api/model/discount_percentage_price_info_request.rb +72 -0
  36. data/lib/line/bot/v2/messaging_api/model/discount_percentage_price_info_response.rb +72 -0
  37. data/lib/line/bot/v2/messaging_api/model/discount_price_info_request.rb +78 -0
  38. data/lib/line/bot/v2/messaging_api/model/discount_price_info_response.rb +78 -0
  39. data/lib/line/bot/v2/messaging_api/model/lottery_acquisition_condition_request.rb +78 -0
  40. data/lib/line/bot/v2/messaging_api/model/lottery_acquisition_condition_response.rb +78 -0
  41. data/lib/line/bot/v2/messaging_api/model/message.rb +1 -0
  42. data/lib/line/bot/v2/messaging_api/model/messaging_api_pager_coupon_list_response.rb +79 -0
  43. data/lib/line/bot/v2/messaging_api/model/normal_acquisition_condition_request.rb +66 -0
  44. data/lib/line/bot/v2/messaging_api/model/normal_acquisition_condition_response.rb +66 -0
  45. data/lib/line/bot/v2/messaging_api/model/referral_acquisition_condition_response.rb +66 -0
  46. data/lib/line/bot/version.rb +1 -1
  47. data/line-bot-api.gemspec +1 -1
  48. data/sig/line/bot/v2/messaging_api/api/messaging_api_client.rbs +156 -0
  49. data/sig/line/bot/v2/messaging_api/model/acquisition_condition_request.rbs +43 -0
  50. data/sig/line/bot/v2/messaging_api/model/acquisition_condition_response.rbs +43 -0
  51. data/sig/line/bot/v2/messaging_api/model/cash_back_fixed_price_info_request.rbs +40 -0
  52. data/sig/line/bot/v2/messaging_api/model/cash_back_fixed_price_info_response.rbs +43 -0
  53. data/sig/line/bot/v2/messaging_api/model/cash_back_percentage_price_info_request.rbs +40 -0
  54. data/sig/line/bot/v2/messaging_api/model/cash_back_percentage_price_info_response.rbs +40 -0
  55. data/sig/line/bot/v2/messaging_api/model/cash_back_price_info_request.rbs +43 -0
  56. data/sig/line/bot/v2/messaging_api/model/cash_back_price_info_response.rbs +43 -0
  57. data/sig/line/bot/v2/messaging_api/model/coupon_cash_back_reward_request.rbs +40 -0
  58. data/sig/line/bot/v2/messaging_api/model/coupon_cash_back_reward_response.rbs +40 -0
  59. data/sig/line/bot/v2/messaging_api/model/coupon_create_request.rbs +76 -0
  60. data/sig/line/bot/v2/messaging_api/model/coupon_create_response.rbs +40 -0
  61. data/sig/line/bot/v2/messaging_api/model/coupon_discount_reward_request.rbs +40 -0
  62. data/sig/line/bot/v2/messaging_api/model/coupon_discount_reward_response.rbs +40 -0
  63. data/sig/line/bot/v2/messaging_api/model/coupon_free_reward_request.rbs +37 -0
  64. data/sig/line/bot/v2/messaging_api/model/coupon_free_reward_response.rbs +37 -0
  65. data/sig/line/bot/v2/messaging_api/model/coupon_gift_reward_request.rbs +37 -0
  66. data/sig/line/bot/v2/messaging_api/model/coupon_gift_reward_response.rbs +37 -0
  67. data/sig/line/bot/v2/messaging_api/model/coupon_list_response.rbs +43 -0
  68. data/sig/line/bot/v2/messaging_api/model/coupon_message.rbs +50 -0
  69. data/sig/line/bot/v2/messaging_api/model/coupon_others_reward_request.rbs +37 -0
  70. data/sig/line/bot/v2/messaging_api/model/coupon_others_reward_response.rbs +37 -0
  71. data/sig/line/bot/v2/messaging_api/model/coupon_response.rbs +91 -0
  72. data/sig/line/bot/v2/messaging_api/model/coupon_reward_request.rbs +43 -0
  73. data/sig/line/bot/v2/messaging_api/model/coupon_reward_response.rbs +43 -0
  74. data/sig/line/bot/v2/messaging_api/model/discount_explicit_price_info_request.rbs +43 -0
  75. data/sig/line/bot/v2/messaging_api/model/discount_explicit_price_info_response.rbs +46 -0
  76. data/sig/line/bot/v2/messaging_api/model/discount_fixed_price_info_request.rbs +40 -0
  77. data/sig/line/bot/v2/messaging_api/model/discount_fixed_price_info_response.rbs +43 -0
  78. data/sig/line/bot/v2/messaging_api/model/discount_percentage_price_info_request.rbs +40 -0
  79. data/sig/line/bot/v2/messaging_api/model/discount_percentage_price_info_response.rbs +40 -0
  80. data/sig/line/bot/v2/messaging_api/model/discount_price_info_request.rbs +43 -0
  81. data/sig/line/bot/v2/messaging_api/model/discount_price_info_response.rbs +43 -0
  82. data/sig/line/bot/v2/messaging_api/model/lottery_acquisition_condition_request.rbs +43 -0
  83. data/sig/line/bot/v2/messaging_api/model/lottery_acquisition_condition_response.rbs +43 -0
  84. data/sig/line/bot/v2/messaging_api/model/messaging_api_pager_coupon_list_response.rbs +43 -0
  85. data/sig/line/bot/v2/messaging_api/model/normal_acquisition_condition_request.rbs +37 -0
  86. data/sig/line/bot/v2/messaging_api/model/normal_acquisition_condition_response.rbs +37 -0
  87. data/sig/line/bot/v2/messaging_api/model/referral_acquisition_condition_response.rbs +37 -0
  88. metadata +81 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b046b49fcf0cca9aa1a7d59650aaf5265e71ddd27099bc876b64d4e73cd812b3
4
- data.tar.gz: 81fb1a37c8946e4e015abcf1daa255ef5459100f939179dc0f9c418e4371a637
3
+ metadata.gz: 6d6263a9bbf4c4a5a3d6a18965c1d81b96b91aeb88bcfd7edf4a1dbdeed1d16e
4
+ data.tar.gz: ed03051dcdd9b5bdd24382113758ae84d12e7ce42b900f75ced07efae11358c1
5
5
  SHA512:
6
- metadata.gz: 6855934b0a92dbe458414a7ebc3ad894b79f2288e17a2e13105fc5505764008823d04bc9606f53c2f69f5fec09d0b84ad3bf2b83f906a3b6f32640f45b414d78
7
- data.tar.gz: 7fbfaf4bbd423ed0beb872b97797886827a0c5a629f2dabf7f410f01883d8f06288be9236736ba7cf7d2f0c30484fda340701f1ce118172eabe373fef5f98c42
6
+ metadata.gz: b5eb071cae7e4db290c9a6e8248cd6e288ae9881fb08c2be18811aa083bab6b11636e6e57ec96b662baa0163e50da68274c6a173f1a88af27da82eb4aa660632
7
+ data.tar.gz: c7e60c5813c0201f172f373b85d937a93f134b80044710a8289886da635ee0b95fe0ac5b56ca5c6a06acec8697152415f54516ac474898687d3a675913e64094
data/CONTRIBUTING.md CHANGED
@@ -9,6 +9,54 @@ It will be amazing if you could help us by doing any of the following:
9
9
  - Contribute your work by sending [a pull request](https://github.com/line/line-bot-sdk-ruby/pulls).
10
10
 
11
11
  ## Development
12
+ ### Install dependencies
13
+ Run `bundle install` to install all dependencies for development.
14
+
15
+ ### Understand the project structure
16
+ The project structure is as follows:
17
+ - `lib`: The main library code.
18
+ - `sig`: The RBS code.
19
+ - `sig-vendor`: The RBS code outside this repository.
20
+ - `spec`: The test code.
21
+ - `examples`: Example projects that use the library.
22
+ - `generator`: The code generator for the library.
23
+
24
+ ### Edit pebble template
25
+ Almost all code are generated with [pebble template](https://pebbletemplates.io/), based on [line-openapi](https://github.com/line/line-openapi)'s yaml.
26
+ Thus, you can't edit almost all code under `lib/line/bot/v2/<dir>.rb` and `sig/line/bot/v2/<dir>.rbs` directly.
27
+
28
+ You need to edit the pebble template under [resources](generator/src/main/resources) instead.
29
+
30
+ After editing the templates, run `generate-code.py` to generate the code, and then commit all affected files.
31
+ If not, CI status will be red.
32
+
33
+ When you update code, be sure to check consistencies between `lib/**.rb` and `sig/**.rbs`.
34
+
35
+ ### Add unit tests
36
+ We use [RSpec](https://rspec.info/) for unit tests.
37
+ Please add tests to the `spec` directory to verify your changes continuously.
38
+
39
+ Especially for bug fixes, please follow this flow for testing and development:
40
+ 1. Write a test before making changes to the library and confirm that the test fails.
41
+ 2. Modify the code of the library.
42
+ 3. Run the test again and confirm that it passes thanks to (2).
43
+
44
+ ### Run your code in your local
45
+ [Example projects](examples/v2) depend on this repository directly.
46
+ You can use new or fixed gem in example projects before submitting a pull request.
47
+
48
+ ### Run all CI tasks in your local
49
+ `Rakefile` defines almost all tasks.
50
+
51
+ You can run all tasks in your local by running `bundle exec rake ci` command.
52
+
53
+ ### Upgrade dependencies
54
+ The libraries that the library itself depends on are listed in the `line-bot-api.gemspec` file.
55
+ Those needed only for development are written in the `Gemfile`.
56
+ The versions in the gemspec file are set as low as possible, allowing users to specify higher versions in their application's Gemfile.
57
+
58
+ For files related to RBS, refer to `rbs_collections.yaml` and the `Steepfile`.
59
+ You can update by running `rbs collection update <LIB_NAME>`.
12
60
 
13
61
  ### YARD
14
62
 
@@ -41,5 +89,5 @@ For more details on how to write YARD doc comments, refer to YARD’s official [
41
89
 
42
90
  ### Contributor license agreement
43
91
 
44
- When you are sending a pull request and it's a non-trivial change beyond fixing typos, please make sure to sign [the ICLA (individual contributor license agreement)](https://cla-assistant.io/line/line-bot-sdk-ruby).
92
+ When you send a pull request and it's a non-trivial change beyond fixing typos, please make sure to sign [the ICLA (individual contributor license agreement)](https://cla-assistant.io/line/line-bot-sdk-ruby).
45
93
  Please [contact us](mailto:dl_oss_dev@linecorp.com) if you need the CCLA (corporate contributor license agreement).
data/README.md CHANGED
@@ -15,7 +15,8 @@ See the official API documentation for more information
15
15
 
16
16
  Also, generated documentation by YARD is available.
17
17
 
18
- - https://rubydoc.info/gems/line-bot-api
18
+ - https://line.github.io/line-bot-sdk-ruby/
19
+ - https://line.github.io/line-bot-sdk-ruby/_index.html
19
20
 
20
21
  ## Requirements
21
22
  This library requires Ruby 3.2 or later.
@@ -40,6 +41,12 @@ Or install it yourself as:
40
41
  gem install line-bot-api
41
42
  ```
42
43
 
44
+ ## Example projects
45
+ We provide examples to help you get started with the SDK.
46
+ They work in your local environment if you have owned your bot account.
47
+
48
+ Go the [examples](examples/v2) directory for more examples.
49
+
43
50
  ## Synopsis
44
51
  ### RBS
45
52
  This library provides [RBS](https://github.com/ruby/rbs) files for type checking.\
@@ -116,6 +123,28 @@ post '/callback' do
116
123
  end
117
124
  ```
118
125
 
126
+ ### Main classes
127
+ You may use this classes to use LINE Messaging API features.
128
+
129
+ #### Webhook
130
+ - [Line::Bot::V2::WebhookParser](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/WebhookParser.html) ([LINE Developers](https://developers.line.biz/en/reference/messaging-api/#webhooks))
131
+ - [Line::Bot::V2::Webhook::Event](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/Webhook/Event.html) ([LINE Developers](https://developers.line.biz/en/reference/messaging-api/#webhook-event-objects))
132
+
133
+ ### Clients
134
+
135
+ | Class(YARD documentation) | API EndPoint | LINE Developers |
136
+ |----------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|
137
+ | [Line::Bot::V2::ChannelAccessToken::ApiClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/ChannelAccessToken/ApiClient.html) | https://api.line.me/** (related to oauth) | https://developers.line.biz/en/reference/messaging-api/#channel-access-token |
138
+ | [Line::Bot::V2::Insight::ApiClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/Insight/ApiClient.html) | https://api.line.me/v2/bot/insight/** | https://developers.line.biz/en/reference/messaging-api/#get-insight |
139
+ | [Line::Bot::V2::Liff::ApiClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/Liff/ApiClient.html) | https://api.line.me/liff/** | https://developers.line.biz/en/reference/liff-server/#server-api |
140
+ | [Line::Bot::V2::ManageAudience::ApiClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/ManageAudience/ApiClient.html) | https://api.line.me/v2/bot/audienceGroup/** | https://developers.line.biz/en/reference/messaging-api/#manage-audience-group |
141
+ | [Line::Bot::V2::ManageAudience::ApiBlobClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/ManageAudience/ApiBlobClient.html) | https://api-data.line.me/v2/bot/audienceGroup/** | https://developers.line.biz/en/reference/messaging-api/#manage-audience-group |
142
+ | [Line::Bot::V2::MessagingApi::ApiClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/MessagingApi/ApiClient.html) | https://api.line.me/v2/bot/** | https://developers.line.biz/en/reference/messaging-api/<br/>https://developers.line.biz/en/reference/partner-docs/ |
143
+ | [Line::Bot::V2::MessagingApi::ApiBlobClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/MessagingApi/ApiBlobClient.html) | https://api-data.line.me/v2/bot/** | https://developers.line.biz/en/reference/messaging-api/ |
144
+ | [Line::Bot::V2::Module::ApiClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/Module/ApiClient.html) | https://api.line.me/v2/bot/** (related to module) | https://developers.line.biz/en/reference/partner-docs/#module |
145
+ | [Line::Bot::V2::ModuleAttach::ApiClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/ModuleAttach/ApiClient.html) | https://manager.line.biz/module/auth/v1/token/** | https://developers.line.biz/en/reference/partner-docs/#module |
146
+ | [Line::Bot::V2::Shop::ApiClient](https://line.github.io/line-bot-sdk-ruby/Line/Bot/V2/Shop/ApiClient.html) | https://api.line.me/shop/** | https://developers.line.biz/en/reference/partner-docs/#mission-stickers |
147
+
119
148
  ### Use HTTP Information
120
149
  You may need to store the ```x-line-request-id``` header obtained as a response from several APIs.\
121
150
  In this case, please use ```*_with_http_info``` methods. You can get headers and status codes.\
@@ -282,28 +311,17 @@ request = Line::Bot::V2::MessagingApi::PushMessageRequest.create(
282
311
  )
283
312
  ```
284
313
 
285
- ### More examples
286
- See the [examples](examples/v2) directory for more examples.
287
-
288
- ## Media
289
- News: https://developers.line.biz/en/news/
290
-
291
314
  ## Versioning
292
315
  This project respects semantic versioning.
293
316
 
294
317
  See https://semver.org/
295
318
 
296
319
  ### v1 and v2
297
- v1 and v2 are completely different implementations, v1 is all deprecated and will be removed in the future.
298
- Migration to v2 is strongly recommended.
299
-
300
- Migration guide: https://github.com/line/line-bot-sdk-ruby/releases/tag/v1.30.0
301
-
302
-
303
- #### Deprecation warnings
304
- When calling the API endpoint with v1, a deprecation warning will occur.\
305
- If you want to suppress this, please set any value to the environment variable `SUPRESS_V1_DEPRECATION_WARNINGS`.
320
+ v1 and v2 are completely different implementations. Migration to v2 is strongly recommended.
321
+ Please refer to [Migration guide](migration_from_v1_to_v2_guide.md) for migration procedure.
306
322
 
323
+ ## Media
324
+ News: https://developers.line.biz/en/news/
307
325
 
308
326
  ## Contributing
309
327
  Please check [CONTRIBUTING](CONTRIBUTING.md) before making a contribution.
@@ -172,6 +172,135 @@ module Line
172
172
  response_body
173
173
  end
174
174
 
175
+ # Close coupon
176
+ # This requests to <code>PUT https://api.line.me/v2/bot/coupon/{couponId}/close</code>
177
+ # This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
178
+ #
179
+ # @param coupon_id [String]
180
+ # @see https://developers.line.biz/en/reference/messaging-api/#discontinue-coupon
181
+ # @return [Array((String|nil), Integer, Hash{String => String})] when HTTP status code is 200
182
+ # @return [Array(Line::Bot::V2::MessagingApi::ErrorResponse, Integer, Hash{String => String})] when HTTP status code is 400
183
+ # @return [Array(Line::Bot::V2::MessagingApi::ErrorResponse, Integer, Hash{String => String})] when HTTP status code is 404
184
+ # @return [Array(Line::Bot::V2::MessagingApi::ErrorResponse, Integer, Hash{String => String})] when HTTP status code is 410
185
+ # @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
186
+ def close_coupon_with_http_info( # steep:ignore MethodBodyTypeMismatch
187
+ coupon_id:
188
+ )
189
+ path = "/v2/bot/coupon/{couponId}/close"
190
+ .gsub(/{couponId}/, coupon_id.to_s)
191
+
192
+ response = @http_client.put(
193
+ path: path,
194
+ )
195
+
196
+ case response.code.to_i
197
+ when 200
198
+ [response.body, 200, response.each_header.to_h]
199
+ when 400
200
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
201
+ json.transform_keys! do |key|
202
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
203
+ end
204
+ response_body = Line::Bot::V2::MessagingApi::ErrorResponse.create(json) # steep:ignore InsufficientKeywordArguments
205
+ [response_body, 400, response.each_header.to_h]
206
+ when 404
207
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
208
+ json.transform_keys! do |key|
209
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
210
+ end
211
+ response_body = Line::Bot::V2::MessagingApi::ErrorResponse.create(json) # steep:ignore InsufficientKeywordArguments
212
+ [response_body, 404, response.each_header.to_h]
213
+ when 410
214
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
215
+ json.transform_keys! do |key|
216
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
217
+ end
218
+ response_body = Line::Bot::V2::MessagingApi::ErrorResponse.create(json) # steep:ignore InsufficientKeywordArguments
219
+ [response_body, 410, response.each_header.to_h]
220
+ else
221
+ [response.body, response.code.to_i, response.each_header.to_h]
222
+ end
223
+ end
224
+
225
+ # Close coupon
226
+ # This requests to <code>PUT https://api.line.me/v2/bot/coupon/{couponId}/close</code>
227
+ # When you want to get HTTP status code or response headers, use {#close_coupon_with_http_info} instead of this.
228
+ #
229
+ # @param coupon_id [String]
230
+ # @see https://developers.line.biz/en/reference/messaging-api/#discontinue-coupon
231
+ # @return [String, nil] when HTTP status code is 200
232
+ # @return [Line::Bot::V2::MessagingApi::ErrorResponse] when HTTP status code is 400
233
+ # @return [Line::Bot::V2::MessagingApi::ErrorResponse] when HTTP status code is 404
234
+ # @return [Line::Bot::V2::MessagingApi::ErrorResponse] when HTTP status code is 410
235
+ # @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
236
+ def close_coupon(
237
+ coupon_id:
238
+ )
239
+ response_body, _status_code, _headers = close_coupon_with_http_info(
240
+ coupon_id: coupon_id
241
+ )
242
+
243
+ response_body
244
+ end
245
+
246
+ # Create a new coupon. Define coupon details such as type, title, and validity period.
247
+ # This requests to <code>POST https://api.line.me/v2/bot/coupon</code>
248
+ # This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
249
+ #
250
+ # @param coupon_create_request [CouponCreateRequest, nil]
251
+ # @see https://developers.line.biz/en/reference/messaging-api/#create-coupon
252
+ # @return [Array(Line::Bot::V2::MessagingApi::CouponCreateResponse, Integer, Hash{String => String})] when HTTP status code is 200
253
+ # @return [Array(Line::Bot::V2::MessagingApi::ErrorResponse, Integer, Hash{String => String})] when HTTP status code is 400
254
+ # @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
255
+ def create_coupon_with_http_info( # steep:ignore MethodBodyTypeMismatch
256
+ coupon_create_request: nil
257
+ )
258
+ path = "/v2/bot/coupon"
259
+
260
+ response = @http_client.post(
261
+ path: path,
262
+ body_params: coupon_create_request,
263
+ )
264
+
265
+ case response.code.to_i
266
+ when 200
267
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
268
+ json.transform_keys! do |key|
269
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
270
+ end
271
+ response_body = Line::Bot::V2::MessagingApi::CouponCreateResponse.create(json) # steep:ignore InsufficientKeywordArguments
272
+ [response_body, 200, response.each_header.to_h]
273
+ when 400
274
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
275
+ json.transform_keys! do |key|
276
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
277
+ end
278
+ response_body = Line::Bot::V2::MessagingApi::ErrorResponse.create(json) # steep:ignore InsufficientKeywordArguments
279
+ [response_body, 400, response.each_header.to_h]
280
+ else
281
+ [response.body, response.code.to_i, response.each_header.to_h]
282
+ end
283
+ end
284
+
285
+ # Create a new coupon. Define coupon details such as type, title, and validity period.
286
+ # This requests to <code>POST https://api.line.me/v2/bot/coupon</code>
287
+ # When you want to get HTTP status code or response headers, use {#create_coupon_with_http_info} instead of this.
288
+ #
289
+ # @param coupon_create_request [CouponCreateRequest, nil]
290
+ # @see https://developers.line.biz/en/reference/messaging-api/#create-coupon
291
+ # @return [Line::Bot::V2::MessagingApi::CouponCreateResponse] when HTTP status code is 200
292
+ # @return [Line::Bot::V2::MessagingApi::ErrorResponse] when HTTP status code is 400
293
+ # @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
294
+ def create_coupon(
295
+ coupon_create_request: nil
296
+ )
297
+ response_body, _status_code, _headers = create_coupon_with_http_info(
298
+ coupon_create_request: coupon_create_request
299
+ )
300
+
301
+ response_body
302
+ end
303
+
175
304
  # Create rich menu
176
305
  # This requests to <code>POST https://api.line.me/v2/bot/richmenu</code>
177
306
  # This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@@ -515,6 +644,73 @@ module Line
515
644
  response_body
516
645
  end
517
646
 
647
+ # Get coupon detail
648
+ # This requests to <code>GET https://api.line.me/v2/bot/coupon/{couponId}</code>
649
+ # This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
650
+ #
651
+ # @param coupon_id [String]
652
+ # @see https://developers.line.biz/en/reference/messaging-api/#get-coupon
653
+ # @return [Array(Line::Bot::V2::MessagingApi::CouponResponse, Integer, Hash{String => String})] when HTTP status code is 200
654
+ # @return [Array(Line::Bot::V2::MessagingApi::ErrorResponse, Integer, Hash{String => String})] when HTTP status code is 400
655
+ # @return [Array(Line::Bot::V2::MessagingApi::ErrorResponse, Integer, Hash{String => String})] when HTTP status code is 404
656
+ # @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
657
+ def get_coupon_detail_with_http_info( # steep:ignore MethodBodyTypeMismatch
658
+ coupon_id:
659
+ )
660
+ path = "/v2/bot/coupon/{couponId}"
661
+ .gsub(/{couponId}/, coupon_id.to_s)
662
+
663
+ response = @http_client.get(
664
+ path: path,
665
+ )
666
+
667
+ case response.code.to_i
668
+ when 200
669
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
670
+ json.transform_keys! do |key|
671
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
672
+ end
673
+ response_body = Line::Bot::V2::MessagingApi::CouponResponse.create(json) # steep:ignore InsufficientKeywordArguments
674
+ [response_body, 200, response.each_header.to_h]
675
+ when 400
676
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
677
+ json.transform_keys! do |key|
678
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
679
+ end
680
+ response_body = Line::Bot::V2::MessagingApi::ErrorResponse.create(json) # steep:ignore InsufficientKeywordArguments
681
+ [response_body, 400, response.each_header.to_h]
682
+ when 404
683
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
684
+ json.transform_keys! do |key|
685
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
686
+ end
687
+ response_body = Line::Bot::V2::MessagingApi::ErrorResponse.create(json) # steep:ignore InsufficientKeywordArguments
688
+ [response_body, 404, response.each_header.to_h]
689
+ else
690
+ [response.body, response.code.to_i, response.each_header.to_h]
691
+ end
692
+ end
693
+
694
+ # Get coupon detail
695
+ # This requests to <code>GET https://api.line.me/v2/bot/coupon/{couponId}</code>
696
+ # When you want to get HTTP status code or response headers, use {#get_coupon_detail_with_http_info} instead of this.
697
+ #
698
+ # @param coupon_id [String]
699
+ # @see https://developers.line.biz/en/reference/messaging-api/#get-coupon
700
+ # @return [Line::Bot::V2::MessagingApi::CouponResponse] when HTTP status code is 200
701
+ # @return [Line::Bot::V2::MessagingApi::ErrorResponse] when HTTP status code is 400
702
+ # @return [Line::Bot::V2::MessagingApi::ErrorResponse] when HTTP status code is 404
703
+ # @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
704
+ def get_coupon_detail(
705
+ coupon_id:
706
+ )
707
+ response_body, _status_code, _headers = get_coupon_detail_with_http_info(
708
+ coupon_id: coupon_id
709
+ )
710
+
711
+ response_body
712
+ end
713
+
518
714
  # Gets the ID of the default rich menu set with the Messaging API.
519
715
  # This requests to <code>GET https://api.line.me/v2/bot/user/all/richmenu</code>
520
716
  # This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@@ -2214,6 +2410,79 @@ module Line
2214
2410
  response_body
2215
2411
  end
2216
2412
 
2413
+ # Get a paginated list of coupons.
2414
+ # This requests to <code>GET https://api.line.me/v2/bot/coupon</code>
2415
+ # This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
2416
+ #
2417
+ # @param status [Array[String], nil] Filter coupons by their status.
2418
+ # @param start [String, nil] Pagination token to retrieve the next page of results.
2419
+ # @param limit [Integer, nil] Maximum number of coupons to return per request.
2420
+ # @see https://developers.line.biz/en/reference/messaging-api/#get-coupons-list
2421
+ # @return [Array(Line::Bot::V2::MessagingApi::MessagingApiPagerCouponListResponse, Integer, Hash{String => String})] when HTTP status code is 200
2422
+ # @return [Array(Line::Bot::V2::MessagingApi::ErrorResponse, Integer, Hash{String => String})] when HTTP status code is 400
2423
+ # @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
2424
+ def list_coupon_with_http_info( # steep:ignore MethodBodyTypeMismatch
2425
+ status: nil,
2426
+ start: nil,
2427
+ limit: nil
2428
+ )
2429
+ path = "/v2/bot/coupon"
2430
+ query_params = {
2431
+ "status": status&.join(','),
2432
+ "start": start,
2433
+ "limit": limit
2434
+ }.compact
2435
+
2436
+ response = @http_client.get(
2437
+ path: path,
2438
+ query_params: query_params,
2439
+ )
2440
+
2441
+ case response.code.to_i
2442
+ when 200
2443
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
2444
+ json.transform_keys! do |key|
2445
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
2446
+ end
2447
+ response_body = Line::Bot::V2::MessagingApi::MessagingApiPagerCouponListResponse.create(json) # steep:ignore InsufficientKeywordArguments
2448
+ [response_body, 200, response.each_header.to_h]
2449
+ when 400
2450
+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
2451
+ json.transform_keys! do |key|
2452
+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
2453
+ end
2454
+ response_body = Line::Bot::V2::MessagingApi::ErrorResponse.create(json) # steep:ignore InsufficientKeywordArguments
2455
+ [response_body, 400, response.each_header.to_h]
2456
+ else
2457
+ [response.body, response.code.to_i, response.each_header.to_h]
2458
+ end
2459
+ end
2460
+
2461
+ # Get a paginated list of coupons.
2462
+ # This requests to <code>GET https://api.line.me/v2/bot/coupon</code>
2463
+ # When you want to get HTTP status code or response headers, use {#list_coupon_with_http_info} instead of this.
2464
+ #
2465
+ # @param status [Array[String], nil] Filter coupons by their status.
2466
+ # @param start [String, nil] Pagination token to retrieve the next page of results.
2467
+ # @param limit [Integer, nil] Maximum number of coupons to return per request.
2468
+ # @see https://developers.line.biz/en/reference/messaging-api/#get-coupons-list
2469
+ # @return [Line::Bot::V2::MessagingApi::MessagingApiPagerCouponListResponse] when HTTP status code is 200
2470
+ # @return [Line::Bot::V2::MessagingApi::ErrorResponse] when HTTP status code is 400
2471
+ # @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
2472
+ def list_coupon(
2473
+ status: nil,
2474
+ start: nil,
2475
+ limit: nil
2476
+ )
2477
+ response_body, _status_code, _headers = list_coupon_with_http_info(
2478
+ status: status,
2479
+ start: start,
2480
+ limit: limit
2481
+ )
2482
+
2483
+ response_body
2484
+ end
2485
+
2217
2486
  # Mark messages from users as read
2218
2487
  # This requests to <code>POST https://api.line.me/v2/bot/message/markAsRead</code>
2219
2488
  # This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@@ -9,6 +9,8 @@
9
9
  # Do not edit the class manually.
10
10
 
11
11
  # Models
12
+ require_relative './model/acquisition_condition_request'
13
+ require_relative './model/acquisition_condition_response'
12
14
  require_relative './model/action'
13
15
  require_relative './model/age_demographic'
14
16
  require_relative './model/age_demographic_filter'
@@ -27,13 +29,44 @@ require_relative './model/camera_action'
27
29
  require_relative './model/camera_roll_action'
28
30
  require_relative './model/carousel_column'
29
31
  require_relative './model/carousel_template'
32
+ require_relative './model/cash_back_fixed_price_info_request'
33
+ require_relative './model/cash_back_fixed_price_info_response'
34
+ require_relative './model/cash_back_percentage_price_info_request'
35
+ require_relative './model/cash_back_percentage_price_info_response'
36
+ require_relative './model/cash_back_price_info_request'
37
+ require_relative './model/cash_back_price_info_response'
30
38
  require_relative './model/chat_reference'
31
39
  require_relative './model/clipboard_action'
32
40
  require_relative './model/clipboard_imagemap_action'
33
41
  require_relative './model/confirm_template'
42
+ require_relative './model/coupon_cash_back_reward_request'
43
+ require_relative './model/coupon_cash_back_reward_response'
44
+ require_relative './model/coupon_create_request'
45
+ require_relative './model/coupon_create_response'
46
+ require_relative './model/coupon_discount_reward_request'
47
+ require_relative './model/coupon_discount_reward_response'
48
+ require_relative './model/coupon_free_reward_request'
49
+ require_relative './model/coupon_free_reward_response'
50
+ require_relative './model/coupon_gift_reward_request'
51
+ require_relative './model/coupon_gift_reward_response'
52
+ require_relative './model/coupon_list_response'
53
+ require_relative './model/coupon_message'
54
+ require_relative './model/coupon_others_reward_request'
55
+ require_relative './model/coupon_others_reward_response'
56
+ require_relative './model/coupon_response'
57
+ require_relative './model/coupon_reward_request'
58
+ require_relative './model/coupon_reward_response'
34
59
  require_relative './model/create_rich_menu_alias_request'
35
60
  require_relative './model/datetime_picker_action'
36
61
  require_relative './model/demographic_filter'
62
+ require_relative './model/discount_explicit_price_info_request'
63
+ require_relative './model/discount_explicit_price_info_response'
64
+ require_relative './model/discount_fixed_price_info_request'
65
+ require_relative './model/discount_fixed_price_info_response'
66
+ require_relative './model/discount_percentage_price_info_request'
67
+ require_relative './model/discount_percentage_price_info_response'
68
+ require_relative './model/discount_price_info_request'
69
+ require_relative './model/discount_price_info_response'
37
70
  require_relative './model/emoji'
38
71
  require_relative './model/emoji_substitution_object'
39
72
  require_relative './model/error_detail'
@@ -92,6 +125,8 @@ require_relative './model/issue_link_token_response'
92
125
  require_relative './model/limit'
93
126
  require_relative './model/location_action'
94
127
  require_relative './model/location_message'
128
+ require_relative './model/lottery_acquisition_condition_request'
129
+ require_relative './model/lottery_acquisition_condition_response'
95
130
  require_relative './model/mark_messages_as_read_request'
96
131
  require_relative './model/members_ids_response'
97
132
  require_relative './model/membership'
@@ -102,9 +137,12 @@ require_relative './model/message'
102
137
  require_relative './model/message_action'
103
138
  require_relative './model/message_imagemap_action'
104
139
  require_relative './model/message_quota_response'
140
+ require_relative './model/messaging_api_pager_coupon_list_response'
105
141
  require_relative './model/multicast_request'
106
142
  require_relative './model/narrowcast_progress_response'
107
143
  require_relative './model/narrowcast_request'
144
+ require_relative './model/normal_acquisition_condition_request'
145
+ require_relative './model/normal_acquisition_condition_response'
108
146
  require_relative './model/number_of_messages_response'
109
147
  require_relative './model/operator_demographic_filter'
110
148
  require_relative './model/operator_recipient'
@@ -118,6 +156,7 @@ require_relative './model/quota_consumption_response'
118
156
  require_relative './model/quota_type'
119
157
  require_relative './model/recipient'
120
158
  require_relative './model/redelivery_recipient'
159
+ require_relative './model/referral_acquisition_condition_response'
121
160
  require_relative './model/reply_message_request'
122
161
  require_relative './model/reply_message_response'
123
162
  require_relative './model/rich_menu_alias_list_response'
@@ -0,0 +1,77 @@
1
+ # LINE Messaging API
2
+ # This document describes LINE Messaging API.
3
+ #
4
+ # The version of the OpenAPI document: 0.0.1
5
+ #
6
+ # NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
7
+ # https://openapi-generator.tech
8
+ # Do not edit the class manually.
9
+
10
+ module Line
11
+ module Bot
12
+ module V2
13
+ module MessagingApi
14
+ class AcquisitionConditionRequest
15
+ # @!attribute [rw] type
16
+ # @return [String] Determines how the coupon is distributed or used.
17
+ attr_accessor :type
18
+
19
+ # @param type [String] Determines how the coupon is distributed or used.
20
+ def initialize(
21
+ type:,
22
+ **dynamic_attributes
23
+ )
24
+
25
+ @type = type
26
+
27
+ dynamic_attributes.each do |key, value|
28
+ self.class.attr_accessor key
29
+
30
+ if value.is_a?(Hash)
31
+ struct_klass = Struct.new(*value.keys.map(&:to_sym))
32
+ struct_values = value.map { |_k, v| v.is_a?(Hash) ? Line::Bot::V2::Utils.hash_to_struct(v) : v }
33
+ instance_variable_set("@#{key}", struct_klass.new(*struct_values))
34
+ else
35
+ instance_variable_set("@#{key}", value)
36
+ end
37
+ end
38
+ end
39
+
40
+ # Create an instance of the class from a hash
41
+ # @param args [Hash] Hash containing all the required attributes
42
+ # @return [Line::Bot::V2::MessagingApi::AcquisitionConditionRequest] Instance of the class
43
+ def self.create(args) # steep:ignore
44
+ symbolized_args = Line::Bot::V2::Utils.deep_symbolize(args)
45
+ klass = detect_class(type: symbolized_args[:type])
46
+ return klass.new(**symbolized_args) if klass # steep:ignore
47
+ return new(**symbolized_args) # steep:ignore
48
+ end
49
+
50
+ # @param other [Object] Object to compare
51
+ # @return [Boolean] true if the objects are equal, false otherwise
52
+ def ==(other)
53
+ return false unless self.class == other.class
54
+
55
+ instance_variables.all? do |var|
56
+ instance_variable_get(var) == other.instance_variable_get(var)
57
+ end
58
+ end
59
+
60
+ # @return [Integer] Hash code of the object
61
+ def hash
62
+ [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash
63
+ end
64
+
65
+ private
66
+
67
+ def self.detect_class(type:)
68
+ {
69
+ lottery: Line::Bot::V2::MessagingApi::LotteryAcquisitionConditionRequest,
70
+ normal: Line::Bot::V2::MessagingApi::NormalAcquisitionConditionRequest,
71
+ }[type.to_sym]
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end