Class: Line::Bot::V2::Liff::ApiClient
- Inherits:
-
Object
- Object
- Line::Bot::V2::Liff::ApiClient
- Defined in:
- lib/line/bot/v2/liff/api/liff_client.rb
Instance Method Summary collapse
-
#add_liff_app(add_liff_app_request:) ⇒ Line::Bot::V2::Liff::AddLiffAppResponse, ...
Adding the LIFF app to a channel This requests to
POST https://api.line.me/liff/v1/apps
When you want to get HTTP status code or response headers, use #add_liff_app_with_http_info instead of this. -
#add_liff_app_with_http_info(add_liff_app_request:) ⇒ Array(Line::Bot::V2::Liff::AddLiffAppResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Adding the LIFF app to a channel This requests to
POST https://api.line.me/liff/v1/apps
This returns an array containing response, HTTP status code, and header in order. -
#delete_liff_app(liff_id:) ⇒ String?
Deletes a LIFF app from a channel.
-
#delete_liff_app_with_http_info(liff_id:) ⇒ Array((String|nil), Integer, Hash{String => String})
Deletes a LIFF app from a channel.
-
#get_all_liff_apps ⇒ Line::Bot::V2::Liff::GetAllLiffAppsResponse, ...
Gets information on all the LIFF apps added to the channel.
-
#get_all_liff_apps_with_http_info ⇒ Array(Line::Bot::V2::Liff::GetAllLiffAppsResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Gets information on all the LIFF apps added to the channel.
-
#initialize(base_url: nil, channel_access_token:, http_options: {}) ⇒ ApiClient
constructor
Initializes a new ApiClient instance.
-
#update_liff_app(liff_id:, update_liff_app_request:) ⇒ String?
Update LIFF app settings This requests to
PUT https://api.line.me/liff/v1/apps/{liffId}
When you want to get HTTP status code or response headers, use #update_liff_app_with_http_info instead of this. -
#update_liff_app_with_http_info(liff_id:, update_liff_app_request:) ⇒ Array((String|nil), Integer, Hash{String => String})
Update LIFF app settings This requests to
PUT https://api.line.me/liff/v1/apps/{liffId}
This returns an array containing response, HTTP status code, and header in order.
Constructor Details
#initialize(base_url: nil, channel_access_token:, http_options: {}) ⇒ ApiClient
Initializes a new Line::Bot::V2::Liff::ApiClient instance.
38 39 40 41 42 43 44 45 46 |
# File 'lib/line/bot/v2/liff/api/liff_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
#add_liff_app(add_liff_app_request:) ⇒ Line::Bot::V2::Liff::AddLiffAppResponse, ...
Adding the LIFF app to a channel This requests to POST https://api.line.me/liff/v1/apps
When you want to get HTTP status code or response headers, use #add_liff_app_with_http_info instead of this.
95 96 97 98 99 100 101 102 103 |
# File 'lib/line/bot/v2/liff/api/liff_client.rb', line 95 def add_liff_app( add_liff_app_request: ) response_body, _status_code, _headers = add_liff_app_with_http_info( add_liff_app_request: add_liff_app_request ) response_body end |
#add_liff_app_with_http_info(add_liff_app_request:) ⇒ Array(Line::Bot::V2::Liff::AddLiffAppResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Adding the LIFF app to a channel This requests to POST https://api.line.me/liff/v1/apps
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/line/bot/v2/liff/api/liff_client.rb', line 58 def add_liff_app_with_http_info( # steep:ignore MethodBodyTypeMismatch add_liff_app_request: ) path = "/liff/v1/apps" response = @http_client.post( path: path, body_params: add_liff_app_request, ) 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::Liff::AddLiffAppResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 200, response.each_header.to_h] when 400 [response.body, 400, response.each_header.to_h] when 401 [response.body, 401, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#delete_liff_app(liff_id:) ⇒ String?
Deletes a LIFF app from a channel. This requests to DELETE https://api.line.me/liff/v1/apps/{liffId}
When you want to get HTTP status code or response headers, use #delete_liff_app_with_http_info instead of this.
147 148 149 150 151 152 153 154 155 |
# File 'lib/line/bot/v2/liff/api/liff_client.rb', line 147 def delete_liff_app( liff_id: ) response_body, _status_code, _headers = delete_liff_app_with_http_info( liff_id: liff_id ) response_body end |
#delete_liff_app_with_http_info(liff_id:) ⇒ Array((String|nil), Integer, Hash{String => String})
Deletes a LIFF app from a channel. This requests to DELETE https://api.line.me/liff/v1/apps/{liffId}
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/line/bot/v2/liff/api/liff_client.rb', line 115 def delete_liff_app_with_http_info( # steep:ignore MethodBodyTypeMismatch liff_id: ) path = "/liff/v1/apps/{liffId}" .gsub(/{liffId}/, liff_id.to_s) response = @http_client.delete( path: path, ) case response.code.to_i when 200 [response.body, 200, response.each_header.to_h] when 401 [response.body, 401, response.each_header.to_h] when 404 [response.body, 404, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#get_all_liff_apps ⇒ Line::Bot::V2::Liff::GetAllLiffAppsResponse, ...
Gets information on all the LIFF apps added to the channel. This requests to GET https://api.line.me/liff/v1/apps
When you want to get HTTP status code or response headers, use #get_all_liff_apps_with_http_info instead of this.
200 201 202 203 204 205 206 |
# File 'lib/line/bot/v2/liff/api/liff_client.rb', line 200 def get_all_liff_apps( ) response_body, _status_code, _headers = get_all_liff_apps_with_http_info( ) response_body end |
#get_all_liff_apps_with_http_info ⇒ Array(Line::Bot::V2::Liff::GetAllLiffAppsResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Gets information on all the LIFF apps added to the channel. This requests to GET https://api.line.me/liff/v1/apps
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/line/bot/v2/liff/api/liff_client.rb', line 166 def get_all_liff_apps_with_http_info( # steep:ignore MethodBodyTypeMismatch ) path = "/liff/v1/apps" 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::Liff::GetAllLiffAppsResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 200, response.each_header.to_h] when 401 [response.body, 401, response.each_header.to_h] when 404 [response.body, 404, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#update_liff_app(liff_id:, update_liff_app_request:) ⇒ String?
Update LIFF app settings This requests to PUT https://api.line.me/liff/v1/apps/{liffId}
When you want to get HTTP status code or response headers, use #update_liff_app_with_http_info instead of this.
258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/line/bot/v2/liff/api/liff_client.rb', line 258 def update_liff_app( liff_id:, update_liff_app_request: ) response_body, _status_code, _headers = update_liff_app_with_http_info( liff_id: liff_id, update_liff_app_request: update_liff_app_request ) response_body end |
#update_liff_app_with_http_info(liff_id:, update_liff_app_request:) ⇒ Array((String|nil), Integer, Hash{String => String})
Update LIFF app settings This requests to PUT https://api.line.me/liff/v1/apps/{liffId}
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/line/bot/v2/liff/api/liff_client.rb', line 220 def update_liff_app_with_http_info( # steep:ignore MethodBodyTypeMismatch liff_id:, update_liff_app_request: ) path = "/liff/v1/apps/{liffId}" .gsub(/{liffId}/, liff_id.to_s) response = @http_client.put( path: path, body_params: update_liff_app_request, ) case response.code.to_i when 200 [response.body, 200, response.each_header.to_h] when 400 [response.body, 400, response.each_header.to_h] when 401 [response.body, 401, response.each_header.to_h] when 404 [response.body, 404, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |