Class: Fastlane::Helper::LambdatestHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::LambdatestHelper
- Defined in:
- lib/fastlane/plugin/lambdatest/helper/lambdatest_helper.rb
Class Method Summary collapse
-
.show_message ⇒ Object
class methods that you define here become available in your action as ‘Helper::LambdatestHelper.your_method`.
-
.upload_file(lt_username, lt_access_key, file_path, url, custom_id, app_name, visibility) ⇒ Object
- Uploads file to Lambdatest Params :
lt_username
-
Lambdatest’s username.
- Uploads file to Lambdatest Params :
Class Method Details
.show_message ⇒ Object
class methods that you define here become available in your action as ‘Helper::LambdatestHelper.your_method`
12 13 14 |
# File 'lib/fastlane/plugin/lambdatest/helper/lambdatest_helper.rb', line 12 def self. UI.("Hello from the Lambdatest plugin helper!") end |
.upload_file(lt_username, lt_access_key, file_path, url, custom_id, app_name, visibility) ⇒ Object
Uploads file to Lambdatest Params :
lt_username
-
Lambdatest’s username.
lt_access_key
-
Lambdatest’s access key.
custom_id
-
Custom id for app upload.
file_path
-
Path to the file to be uploaded.
url
-
Lambdatest’s app upload endpoint.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fastlane/plugin/lambdatest/helper/lambdatest_helper.rb', line 23 def self.upload_file(lt_username, lt_access_key, file_path, url, custom_id,app_name, visibility) payload = { name: app_name, appFile: File.new(file_path, 'rb'), visibility: visibility } unless custom_id.nil? payload[:custom_id] = custom_id end headers = { "User-Agent" => "fastlane_plugin_lambdatest" } begin response = RestClient::Request.execute( method: :post, url: url, user: lt_username, password: lt_access_key, payload: payload, headers: headers ) response_json = JSON.parse(response.to_s) if !response_json["app_url"].nil? return response_json["app_url"] end rescue RestClient::ExceptionWithResponse => err begin error_response = JSON.parse(err.response.to_s)["message"] rescue error_response = "Internal server error" end # Give error if upload failed. UI.user_error!("App upload failed!!! Reason : #{error_response}") rescue StandardError => error UI.user_error!("App upload failed!!! Reason : #{error.}") end end |