class Line::Bot::V2::ManageAudience::ApiBlobClient
Public Class Methods
Source
# File lib/line/bot/v2/manage_audience/api/manage_audience_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::ManageAudience::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::ManageAudience::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/manage_audience/api/manage_audience_blob_client.rb, line 94 def add_user_ids_to_audience( file:, audience_group_id: nil, upload_description: nil ) response_body, _status_code, _headers = add_user_ids_to_audience_with_http_info( file: file, audience_group_id: audience_group_id, upload_description: upload_description ) response_body end
Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by file). This requests to PUT https://api-data.line.me/v2/bot/audienceGroup/upload/byFile
When you want to get HTTP status code or response headers, use {#add_user_ids_to_audience_with_http_info} instead of this.
@param file [File] A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 @param audience_group_id [Integer, nil] The audience ID. @param upload_description [String, nil] The description to register with the job @see developers.line.biz/en/reference/messaging-api/#update-upload-audience-group-by-file @return [String, nil] when HTTP status code is 202 @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
Source
# File lib/line/bot/v2/manage_audience/api/manage_audience_blob_client.rb, line 58 def add_user_ids_to_audience_with_http_info( # steep:ignore MethodBodyTypeMismatch file:, audience_group_id: nil, upload_description: nil ) path = "/v2/bot/audienceGroup/upload/byFile" form_params = { "audienceGroupId": audience_group_id, "uploadDescription": upload_description, "file": file }.compact response = @http_client.put_form_multipart( path: path, form_params: form_params, ) case response.code.to_i when 202 [response.body, 202, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end
Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by file). This requests to PUT https://api-data.line.me/v2/bot/audienceGroup/upload/byFile
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@param file [File] A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 @param audience_group_id [Integer, nil] The audience ID. @param upload_description [String, nil] The description to register with the job @see developers.line.biz/en/reference/messaging-api/#update-upload-audience-group-by-file @return [Array((String|nil), Integer, Hash{String => String})] when HTTP status code is 202 @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/manage_audience/api/manage_audience_blob_client.rb, line 163 def create_audience_for_uploading_user_ids( file:, description: nil, is_ifa_audience: nil, upload_description: nil ) response_body, _status_code, _headers = create_audience_for_uploading_user_ids_with_http_info( file: file, description: description, is_ifa_audience: is_ifa_audience, upload_description: upload_description ) response_body end
Create audience for uploading user IDs (by file). This requests to POST https://api-data.line.me/v2/bot/audienceGroup/upload/byFile
When you want to get HTTP status code or response headers, use {#create_audience_for_uploading_user_ids_with_http_info} instead of this.
@param file [File] A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 @param description [String, nil] The audience’s name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 @param is_ifa_audience [Boolean, nil] To specify recipients by IFAs: set ‘true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. @param upload_description [String, nil] The description to register for the job (in `jobs[].description`). @see developers.line.biz/en/reference/messaging-api/#create-upload-audience-group-by-file @return [Line::Bot::V2::ManageAudience::CreateAudienceGroupResponse] when HTTP status code is 202 @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
Source
# File lib/line/bot/v2/manage_audience/api/manage_audience_blob_client.rb, line 119 def create_audience_for_uploading_user_ids_with_http_info( # steep:ignore MethodBodyTypeMismatch file:, description: nil, is_ifa_audience: nil, upload_description: nil ) path = "/v2/bot/audienceGroup/upload/byFile" form_params = { "description": description, "isIfaAudience": is_ifa_audience, "uploadDescription": upload_description, "file": file }.compact response = @http_client.post_form_multipart( path: path, form_params: form_params, ) case response.code.to_i when 202 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::ManageAudience::CreateAudienceGroupResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 202, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end
Create audience for uploading user IDs (by file). This requests to POST https://api-data.line.me/v2/bot/audienceGroup/upload/byFile
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
@param file [File] A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 @param description [String, nil] The audience’s name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 @param is_ifa_audience [Boolean, nil] To specify recipients by IFAs: set ‘true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. @param upload_description [String, nil] The description to register for the job (in `jobs[].description`). @see developers.line.biz/en/reference/messaging-api/#create-upload-audience-group-by-file @return [Array(Line::Bot::V2::ManageAudience::CreateAudienceGroupResponse
, Integer, Hash{String => String})] when HTTP status code is 202 @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.