Class: Line::Bot::V2::Insight::ApiClient
- Inherits:
-
Object
- Object
- Line::Bot::V2::Insight::ApiClient
- Defined in:
- lib/line/bot/v2/insight/api/insight_client.rb,
sig/line/bot/v2/insight/api/insight_client.rbs
Instance Method Summary collapse
-
#get_friends_demographics ⇒ Line::Bot::V2::Insight::GetFriendsDemographicsResponse, ...
Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID).
-
#get_friends_demographics_with_http_info ⇒ Array(Line::Bot::V2::Insight::GetFriendsDemographicsResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID).
-
#get_message_event(request_id:) ⇒ Line::Bot::V2::Insight::GetMessageEventResponse, ...
Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account.
-
#get_message_event_with_http_info(request_id:) ⇒ Array(Line::Bot::V2::Insight::GetMessageEventResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account.
-
#get_number_of_followers(date: nil) ⇒ Line::Bot::V2::Insight::GetNumberOfFollowersResponse, ...
Returns the number of users who have added the LINE Official Account on or before a specified date.
-
#get_number_of_followers_with_http_info(date: nil) ⇒ Array(Line::Bot::V2::Insight::GetNumberOfFollowersResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Returns the number of users who have added the LINE Official Account on or before a specified date.
-
#get_number_of_message_deliveries(date:) ⇒ Line::Bot::V2::Insight::GetNumberOfMessageDeliveriesResponse, ...
Returns the number of messages sent from LINE Official Account on a specified day.
-
#get_number_of_message_deliveries_with_http_info(date:) ⇒ Array(Line::Bot::V2::Insight::GetNumberOfMessageDeliveriesResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Returns the number of messages sent from LINE Official Account on a specified day.
-
#get_rich_menu_insight_daily(rich_menu_id:, from:, to:) ⇒ Line::Bot::V2::Insight::GetRichMenuInsightDailyResponse, ...
Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API.
-
#get_rich_menu_insight_daily_with_http_info(rich_menu_id:, from:, to:) ⇒ Array(Line::Bot::V2::Insight::GetRichMenuInsightDailyResponse, Integer, Hash{String => String}), ...
Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API.
-
#get_rich_menu_insight_summary(rich_menu_id:, from:, to:) ⇒ Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponse, ...
Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API.
-
#get_rich_menu_insight_summary_with_http_info(rich_menu_id:, from:, to:) ⇒ Array(Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponse, Integer, Hash{String => String}), ...
Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API.
-
#get_statistics_per_unit(custom_aggregation_unit:, from:, to:) ⇒ Line::Bot::V2::Insight::GetStatisticsPerUnitResponse, ...
You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account.
-
#get_statistics_per_unit_with_http_info(custom_aggregation_unit:, from:, to:) ⇒ Array(Line::Bot::V2::Insight::GetStatisticsPerUnitResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account.
-
#initialize(base_url: nil, channel_access_token:, http_options: {}) ⇒ Object
constructor
Initializes a new ApiClient instance.
Constructor Details
#initialize(base_url: nil, channel_access_token:, http_options: {}) ⇒ Object
Initializes a new Line::Bot::V2::Insight::ApiClient instance.
38 39 40 41 42 43 44 45 46 |
# File 'lib/line/bot/v2/insight/api/insight_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
#get_friends_demographics ⇒ Line::Bot::V2::Insight::GetFriendsDemographicsResponse, ...
Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID).
This requests to GET https://api.line.me/v2/bot/insight/demographic
When you want to get HTTP status code or response headers, use {#get_friends_demographics_with_http_info} instead of this.
83 84 85 86 87 88 89 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 83 def get_friends_demographics( ) response_body, _status_code, _headers = get_friends_demographics_with_http_info( ) response_body end |
#get_friends_demographics_with_http_info ⇒ Array(Line::Bot::V2::Insight::GetFriendsDemographicsResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID).
This requests to GET https://api.line.me/v2/bot/insight/demographic
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 55 def get_friends_demographics_with_http_info( ) path = "/v2/bot/insight/demographic" response = @http_client.get( path: path, ) 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::Insight::GetFriendsDemographicsResponse.create(json) [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#get_message_event(request_id:) ⇒ Line::Bot::V2::Insight::GetMessageEventResponse, ...
Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account.
This requests to GET https://api.line.me/v2/bot/insight/message/event
When you want to get HTTP status code or response headers, use {#get_message_event_with_http_info} instead of this.
133 134 135 136 137 138 139 140 141 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 133 def ( request_id: ) response_body, _status_code, _headers = ( request_id: request_id ) response_body end |
#get_message_event_with_http_info(request_id:) ⇒ Array(Line::Bot::V2::Insight::GetMessageEventResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account.
This requests to GET https://api.line.me/v2/bot/insight/message/event
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 99 def ( request_id: ) path = "/v2/bot/insight/message/event" query_params = { "requestId": request_id }.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::Insight::GetMessageEventResponse.create(json) [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#get_number_of_followers(date: nil) ⇒ Line::Bot::V2::Insight::GetNumberOfFollowersResponse, ...
Returns the number of users who have added the LINE Official Account on or before a specified date.
This requests to GET https://api.line.me/v2/bot/insight/followers
When you want to get HTTP status code or response headers, use {#get_number_of_followers_with_http_info} instead of this.
185 186 187 188 189 190 191 192 193 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 185 def get_number_of_followers( date: nil ) response_body, _status_code, _headers = get_number_of_followers_with_http_info( date: date ) response_body end |
#get_number_of_followers_with_http_info(date: nil) ⇒ Array(Line::Bot::V2::Insight::GetNumberOfFollowersResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Returns the number of users who have added the LINE Official Account on or before a specified date.
This requests to GET https://api.line.me/v2/bot/insight/followers
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 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 151 def get_number_of_followers_with_http_info( date: nil ) path = "/v2/bot/insight/followers" query_params = { "date": date }.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::Insight::GetNumberOfFollowersResponse.create(json) [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#get_number_of_message_deliveries(date:) ⇒ Line::Bot::V2::Insight::GetNumberOfMessageDeliveriesResponse, ...
Returns the number of messages sent from LINE Official Account on a specified day.
This requests to GET https://api.line.me/v2/bot/insight/message/delivery
When you want to get HTTP status code or response headers, use {#get_number_of_message_deliveries_with_http_info} instead of this.
237 238 239 240 241 242 243 244 245 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 237 def ( date: ) response_body, _status_code, _headers = ( date: date ) response_body end |
#get_number_of_message_deliveries_with_http_info(date:) ⇒ Array(Line::Bot::V2::Insight::GetNumberOfMessageDeliveriesResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Returns the number of messages sent from LINE Official Account on a specified day.
This requests to GET https://api.line.me/v2/bot/insight/message/delivery
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 203 def ( date: ) path = "/v2/bot/insight/message/delivery" query_params = { "date": date }.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::Insight::GetNumberOfMessageDeliveriesResponse.create(json) [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#get_rich_menu_insight_daily(rich_menu_id:, from:, to:) ⇒ Line::Bot::V2::Insight::GetRichMenuInsightDailyResponse, ...
Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API. Returns the daily impression count for the whole rich menu and the daily click count for each tappable area. When the total number of unique clicks during the period is below the privacy threshold, only richMenuId is returned and the other fields are omitted.
This requests to GET https://api.line.me/v2/bot/insight/richmenu/richMenuId/daily
When you want to get HTTP status code or response headers, use {#get_rich_menu_insight_daily_with_http_info} instead of this.
316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 316 def ( rich_menu_id:, from:, to: ) response_body, _status_code, _headers = ( rich_menu_id: , from: from, to: to ) response_body end |
#get_rich_menu_insight_daily_with_http_info(rich_menu_id:, from:, to:) ⇒ Array(Line::Bot::V2::Insight::GetRichMenuInsightDailyResponse, Integer, Hash{String => String}), ...
Gets rich menu statistics broken down by day for the specified period, for a rich menu created via the Messaging API. Returns the daily impression count for the whole rich menu and the daily click count for each tappable area. When the total number of unique clicks during the period is below the privacy threshold, only richMenuId is returned and the other fields are omitted.
This requests to GET https://api.line.me/v2/bot/insight/richmenu/richMenuId/daily
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 259 def ( rich_menu_id:, from:, to: ) path = Line::Bot::V2::Utils.build_path("/v2/bot/insight/richmenu/{richMenuId}/daily", { "richMenuId": }) query_params = { "from": from, "to": to }.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::Insight::GetRichMenuInsightDailyResponse.create(json) [response_body, 200, response.each_header.to_h] when 400 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::Insight::ErrorResponse.create(json) [response_body, 400, response.each_header.to_h] when 404 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::Insight::ErrorResponse.create(json) [response_body, 404, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#get_rich_menu_insight_summary(rich_menu_id:, from:, to:) ⇒ Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponse, ...
Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API. Returns the total impression count for the whole rich menu and the click count for each tappable area, aggregated over the entire period as a single result. When the total number of unique clicks during the period is below the privacy threshold, only richMenuId is returned and the other fields are omitted.
This requests to GET https://api.line.me/v2/bot/insight/richmenu/richMenuId/summary
When you want to get HTTP status code or response headers, use {#get_rich_menu_insight_summary_with_http_info} instead of this.
399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 399 def ( rich_menu_id:, from:, to: ) response_body, _status_code, _headers = ( rich_menu_id: , from: from, to: to ) response_body end |
#get_rich_menu_insight_summary_with_http_info(rich_menu_id:, from:, to:) ⇒ Array(Line::Bot::V2::Insight::GetRichMenuInsightSummaryResponse, Integer, Hash{String => String}), ...
Gets a summary of rich menu statistics for the specified period, for a rich menu created via the Messaging API. Returns the total impression count for the whole rich menu and the click count for each tappable area, aggregated over the entire period as a single result. When the total number of unique clicks during the period is below the privacy threshold, only richMenuId is returned and the other fields are omitted.
This requests to GET https://api.line.me/v2/bot/insight/richmenu/richMenuId/summary
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 342 def ( rich_menu_id:, from:, to: ) path = Line::Bot::V2::Utils.build_path("/v2/bot/insight/richmenu/{richMenuId}/summary", { "richMenuId": }) query_params = { "from": from, "to": to }.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::Insight::GetRichMenuInsightSummaryResponse.create(json) [response_body, 200, response.each_header.to_h] when 400 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::Insight::ErrorResponse.create(json) [response_body, 400, response.each_header.to_h] when 404 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::Insight::ErrorResponse.create(json) [response_body, 404, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#get_statistics_per_unit(custom_aggregation_unit:, from:, to:) ⇒ Line::Bot::V2::Insight::GetStatisticsPerUnitResponse, ...
You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account.
This requests to GET https://api.line.me/v2/bot/insight/message/event/aggregation
When you want to get HTTP status code or response headers, use {#get_statistics_per_unit_with_http_info} instead of this.
463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 463 def get_statistics_per_unit( custom_aggregation_unit:, from:, to: ) response_body, _status_code, _headers = get_statistics_per_unit_with_http_info( custom_aggregation_unit: custom_aggregation_unit, from: from, to: to ) response_body end |
#get_statistics_per_unit_with_http_info(custom_aggregation_unit:, from:, to:) ⇒ Array(Line::Bot::V2::Insight::GetStatisticsPerUnitResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account.
This requests to GET https://api.line.me/v2/bot/insight/message/event/aggregation
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/line/bot/v2/insight/api/insight_client.rb', line 423 def get_statistics_per_unit_with_http_info( custom_aggregation_unit:, from:, to: ) path = "/v2/bot/insight/message/event/aggregation" query_params = { "customAggregationUnit": custom_aggregation_unit, "from": from, "to": to }.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::Insight::GetStatisticsPerUnitResponse.create(json) [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |