class Line::Bot::V2::MessagingApi::ApiBlobClient
Public Class Methods
Source
# File lib/line/bot/v2/messaging_api/api/messaging_api_blob_client.rb, line 38 def initialize(base_url: nil, channel_access_token:, http_options: {}) @http_client = HttpClient.new( base_url: base_url || 'https://api-data.line.me', http_headers: { Authorization: "Bearer #{channel_access_token}" }, http_options: http_options ) end
Initializes a new {Line::Bot::V2::MessagingApi::ApiBlobClient} instance.
@param base_url [String] The base URL for requests (optional).
Defaults to 'https://api-data.line.me' if none is provided. You can override this for testing or to use a mock server.
@param channel_access_token [String] The channel access token for authorization. @param http_options [Hash] HTTP options (same as Net::HTTP options).
See: https://docs.ruby-lang.org/en/3.4/Net/HTTP.html to understand the options.
@example
@client ||= Line::Bot::V2::MessagingApi::ApiBlobClient.new( channel_access_token: "YOUR_CHANNEL_ACCESS_TOKEN", http_options: { open_timeout: 5, read_timeout: 5, } )
Public Instance Methods
Source
# File lib/line/bot/v2/messaging_api/api/messaging_api_blob_client.rb, line 82 def get_message_content( message_id: ) response_body, _status_code, _headers = get_message_content_with_http_info( message_id: message_id ) response_body end
Download image, video, and audio data sent from users. This requests to GET https://api-data.line.me/v2/bot/message/{messageId}/content
When you want to get HTTP status code or response headers, use {#get_message_content_with_http_info} instead of this.
@param message_id [String] Message
ID of video or audio @see developers.line.biz/en/reference/messaging-api/#get-content @return [String, nil] when HTTP status code is 200 @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
Source
# File lib/line/bot/v2/messaging_api/api/messaging_api_blob_client.rb, line 126 def get_message_content_preview( message_id: ) response_body, _status_code, _headers = get_message_content_preview_with_http_info( message_id: message_id ) response_body end
Get a preview image of the image or video This requests to GET https://api-data.line.me/v2/bot/message/{messageId}/content/preview
When you want to get HTTP status code or response headers, use {#get_message_content_preview_with_http_info} instead of this.
@param message_id [String] Message
ID of image or video @see developers.line.biz/en/reference/messaging-api/#get-image-or-video-preview @return [String, nil] when HTTP status code is 200 @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
Source
# File lib/line/bot/v2/messaging_api/api/messaging_api_blob_client.rb, line 100 def get_message_content_preview_with_http_info( # steep:ignore MethodBodyTypeMismatch message_id: ) path = "/v2/bot/message/{messageId}/content/preview" .gsub(/{messageId}/, message_id.to_s) response = @http_client.get( 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
Get a preview image of the image or video This requests to GET https://api-data.line.me/v2/bot/message/{messageId}/content/preview
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@param message_id [String] Message
ID of image or video @see developers.line.biz/en/reference/messaging-api/#get-image-or-video-preview @return [Array((String|nil), Integer, Hash{String => String})] when HTTP status code is 200 @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
Source
# File lib/line/bot/v2/messaging_api/api/messaging_api_blob_client.rb, line 175 def get_message_content_transcoding_by_message_id( message_id: ) response_body, _status_code, _headers = get_message_content_transcoding_by_message_id_with_http_info( message_id: message_id ) response_body end
Verify the preparation status of a video or audio for getting This requests to GET https://api-data.line.me/v2/bot/message/{messageId}/content/transcoding
When you want to get HTTP status code or response headers, use {#get_message_content_transcoding_by_message_id_with_http_info} instead of this.
@param message_id [String] Message
ID of video or audio @see developers.line.biz/en/reference/messaging-api/#verify-video-or-audio-preparation-status @return [Line::Bot::V2::MessagingApi::GetMessageContentTranscodingResponse] when HTTP status code is 200 @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
Source
# File lib/line/bot/v2/messaging_api/api/messaging_api_blob_client.rb, line 144 def get_message_content_transcoding_by_message_id_with_http_info( # steep:ignore MethodBodyTypeMismatch message_id: ) path = "/v2/bot/message/{messageId}/content/transcoding" .gsub(/{messageId}/, message_id.to_s) 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::MessagingApi::GetMessageContentTranscodingResponse.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
Verify the preparation status of a video or audio for getting This requests to GET https://api-data.line.me/v2/bot/message/{messageId}/content/transcoding
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@param message_id [String] Message
ID of video or audio @see developers.line.biz/en/reference/messaging-api/#verify-video-or-audio-preparation-status @return [Array(Line::Bot::V2::MessagingApi::GetMessageContentTranscodingResponse
, Integer, Hash{String => String})] when HTTP status code is 200 @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
Source
# File lib/line/bot/v2/messaging_api/api/messaging_api_blob_client.rb, line 56 def get_message_content_with_http_info( # steep:ignore MethodBodyTypeMismatch message_id: ) path = "/v2/bot/message/{messageId}/content" .gsub(/{messageId}/, message_id.to_s) response = @http_client.get( 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
Download image, video, and audio data sent from users. This requests to GET https://api-data.line.me/v2/bot/message/{messageId}/content
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@param message_id [String] Message
ID of video or audio @see developers.line.biz/en/reference/messaging-api/#get-content @return [Array((String|nil), Integer, Hash{String => String})] when HTTP status code is 200 @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.