Class: Line::Bot::V2::Module::ApiClient
- Inherits:
-
Object
- Object
- Line::Bot::V2::Module::ApiClient
- Defined in:
- lib/line/bot/v2/module/api/line_module_client.rb
Instance Method Summary collapse
-
#acquire_chat_control(chat_id:, acquire_chat_control_request: nil) ⇒ String?
If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API.
-
#acquire_chat_control_with_http_info(chat_id:, acquire_chat_control_request: nil) ⇒ Array((String|nil), Integer, Hash{String => String})
If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API.
-
#detach_module(detach_module_request: nil) ⇒ String?
The module channel admin calls the Detach API to detach the module channel from a LINE Official Account.
-
#detach_module_with_http_info(detach_module_request: nil) ⇒ Array((String|nil), Integer, Hash{String => String})
The module channel admin calls the Detach API to detach the module channel from a LINE Official Account.
-
#get_modules(start: nil, limit: nil) ⇒ Line::Bot::V2::Module::GetModulesResponse, ...
Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels.
-
#get_modules_with_http_info(start: nil, limit: nil) ⇒ Array(Line::Bot::V2::Module::GetModulesResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels.
-
#initialize(base_url: nil, channel_access_token:, http_options: {}) ⇒ ApiClient
constructor
Initializes a new ApiClient instance.
-
#release_chat_control(chat_id:) ⇒ String?
To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API.
-
#release_chat_control_with_http_info(chat_id:) ⇒ Array((String|nil), Integer, Hash{String => String})
To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API.
Constructor Details
#initialize(base_url: nil, channel_access_token:, http_options: {}) ⇒ ApiClient
Initializes a new Line::Bot::V2::Module::ApiClient instance.
38 39 40 41 42 43 44 45 46 |
# File 'lib/line/bot/v2/module/api/line_module_client.rb', line 38 def initialize(base_url: nil, channel_access_token:, http_options: {}) @http_client = HttpClient.new( base_url: base_url || 'https://api.line.me', http_headers: { Authorization: "Bearer #{channel_access_token}" }, http_options: ) end |
Instance Method Details
#acquire_chat_control(chat_id:, acquire_chat_control_request: nil) ⇒ String?
If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API. The channel that was previously an Active Channel will automatically switch to a Standby Channel. This requests to POST https://api.line.me/v2/bot/chat/{chatId}/control/acquire
When you want to get HTTP status code or response headers, use #acquire_chat_control_with_http_info instead of this.
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/line/bot/v2/module/api/line_module_client.rb', line 86 def acquire_chat_control( chat_id:, acquire_chat_control_request: nil ) response_body, _status_code, _headers = acquire_chat_control_with_http_info( chat_id: chat_id, acquire_chat_control_request: acquire_chat_control_request ) response_body end |
#acquire_chat_control_with_http_info(chat_id:, acquire_chat_control_request: nil) ⇒ Array((String|nil), Integer, Hash{String => String})
If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API. The channel that was previously an Active Channel will automatically switch to a Standby Channel. This requests to POST https://api.line.me/v2/bot/chat/{chatId}/control/acquire
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/line/bot/v2/module/api/line_module_client.rb', line 57 def acquire_chat_control_with_http_info( # steep:ignore MethodBodyTypeMismatch chat_id:, acquire_chat_control_request: nil ) path = "/v2/bot/chat/{chatId}/control/acquire" .gsub(/{chatId}/, chat_id.to_s) response = @http_client.post( path: path, body_params: acquire_chat_control_request, ) case response.code.to_i when 200 [response.body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#detach_module(detach_module_request: nil) ⇒ String?
The module channel admin calls the Detach API to detach the module channel from a LINE Official Account. This requests to POST https://api.line.me/v2/bot/channel/detach
When you want to get HTTP status code or response headers, use #detach_module_with_http_info instead of this.
132 133 134 135 136 137 138 139 140 |
# File 'lib/line/bot/v2/module/api/line_module_client.rb', line 132 def detach_module( detach_module_request: nil ) response_body, _status_code, _headers = detach_module_with_http_info( detach_module_request: detach_module_request ) response_body end |
#detach_module_with_http_info(detach_module_request: nil) ⇒ Array((String|nil), Integer, Hash{String => String})
The module channel admin calls the Detach API to detach the module channel from a LINE Official Account. This requests to POST https://api.line.me/v2/bot/channel/detach
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/line/bot/v2/module/api/line_module_client.rb', line 106 def detach_module_with_http_info( # steep:ignore MethodBodyTypeMismatch detach_module_request: nil ) path = "/v2/bot/channel/detach" response = @http_client.post( path: path, body_params: detach_module_request, ) case response.code.to_i when 200 [response.body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#get_modules(start: nil, limit: nil) ⇒ Line::Bot::V2::Module::GetModulesResponse, ...
Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels. This requests to GET https://api.line.me/v2/bot/list
When you want to get HTTP status code or response headers, use #get_modules_with_http_info instead of this.
188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/line/bot/v2/module/api/line_module_client.rb', line 188 def get_modules( start: nil, limit: nil ) response_body, _status_code, _headers = get_modules_with_http_info( start: start, limit: limit ) response_body end |
#get_modules_with_http_info(start: nil, limit: nil) ⇒ Array(Line::Bot::V2::Module::GetModulesResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels. This requests to GET https://api.line.me/v2/bot/list
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/line/bot/v2/module/api/line_module_client.rb', line 151 def get_modules_with_http_info( # steep:ignore MethodBodyTypeMismatch start: nil, limit: nil ) path = "/v2/bot/list" query_params = { "start": start, "limit": limit }.compact response = @http_client.get( path: path, query_params: query_params, ) case response.code.to_i when 200 json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body)) json.transform_keys! do |key| Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key end response_body = Line::Bot::V2::Module::GetModulesResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#release_chat_control(chat_id:) ⇒ String?
To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API. This requests to POST https://api.line.me/v2/bot/chat/{chatId}/control/release
When you want to get HTTP status code or response headers, use #release_chat_control_with_http_info instead of this.
234 235 236 237 238 239 240 241 242 |
# File 'lib/line/bot/v2/module/api/line_module_client.rb', line 234 def release_chat_control( chat_id: ) response_body, _status_code, _headers = release_chat_control_with_http_info( chat_id: chat_id ) response_body end |
#release_chat_control_with_http_info(chat_id:) ⇒ Array((String|nil), Integer, Hash{String => String})
To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API. This requests to POST https://api.line.me/v2/bot/chat/{chatId}/control/release
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/line/bot/v2/module/api/line_module_client.rb', line 208 def release_chat_control_with_http_info( # steep:ignore MethodBodyTypeMismatch chat_id: ) path = "/v2/bot/chat/{chatId}/control/release" .gsub(/{chatId}/, chat_id.to_s) response = @http_client.post( path: path, ) case response.code.to_i when 200 [response.body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |