Class: Fastlane::Actions::NativestingAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::NativestingAction
- Defined in:
- lib/fastlane/plugin/nativesting/actions/nativesting_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .download_file(url, file_path) ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
47 48 49 |
# File 'lib/fastlane/plugin/nativesting/actions/nativesting_action.rb', line 47 def self. ["Nativesting"] end |
.available_options ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/fastlane/plugin/nativesting/actions/nativesting_action.rb', line 60 def self. [ FastlaneCore::ConfigItem.new(key: :token, description: "API Token for authentication", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :suite_case_id, description: "Suite Case ID", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :platform, description: "Platform (iOS or Android)", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :output_path, description: "Output directory path", optional: false, type: String) ] end |
.description ⇒ Object
43 44 45 |
# File 'lib/fastlane/plugin/nativesting/actions/nativesting_action.rb', line 43 def self.description "Seamlessly integration with nativesting.com" end |
.details ⇒ Object
55 56 57 58 |
# File 'lib/fastlane/plugin/nativesting/actions/nativesting_action.rb', line 55 def self.details # Optional: "Seamlessly integration with nativesting.com allowing you to generate and download test cases directly from the Nativesting platform." end |
.download_file(url, file_path) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fastlane/plugin/nativesting/actions/nativesting_action.rb', line 30 def self.download_file(url, file_path) # Use Net::HTTP to download the file Net::HTTP.start(url.host, url.port, use_ssl: url.scheme == 'https') do |http| request = Net::HTTP::Get.new(url) http.request(request) do |response| open(file_path, 'wb') do |io| response.read_body { |chunk| io.write(chunk) } end end end end |
.is_supported?(platform) ⇒ Boolean
81 82 83 |
# File 'lib/fastlane/plugin/nativesting/actions/nativesting_action.rb', line 81 def self.is_supported?(platform) [:ios, :android].include?(platform) end |
.return_value ⇒ Object
51 52 53 |
# File 'lib/fastlane/plugin/nativesting/actions/nativesting_action.rb', line 51 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fastlane/plugin/nativesting/actions/nativesting_action.rb', line 7 def self.run(params) # Extract parameters token = params[:token] suite_case_id = params[:suite_case_id] platform = params[:platform] output_path = params[:output_path] # Construct the URL url = URI("https://api.nativesting.com/ci/download/#{suite_case_id}/#{platform}/#{token}") # Create the output path directory if it doesn't exist FileUtils.mkdir_p(output_path) unless File.directory?(output_path) # Set the output file name and path file_name = "nativesting_#{suite_case_id}_#{platform}.zip" file_path = File.join(output_path, file_name) # Download the file download_file(url, file_path) UI.success("File successfully downloaded to #{file_path}") end |