Class: Fastlane::Actions::AllureApiAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::AllureApiAction
- Defined in:
- lib/fastlane/plugin/stream_actions/actions/allure_api.rb
Documentation collapse
Class Method Summary collapse
Class Method Details
.available_options ⇒ Object
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 63 64 65 66 67 |
# File 'lib/fastlane/plugin/stream_actions/actions/allure_api.rb', line 37 def self. [ FastlaneCore::ConfigItem.new( env_name: 'ALLURE_TOKEN', key: :token, description: 'Allure API Token' ), FastlaneCore::ConfigItem.new( key: :url, description: 'Testops URL' ), FastlaneCore::ConfigItem.new( key: :path, description: 'Allure Testops endpoint path' ), FastlaneCore::ConfigItem.new( key: :request_body, description: 'Request body', optional: true ), FastlaneCore::ConfigItem.new( key: :http_method, description: 'HTTP request method', verify_block: proc do |method| unless ['GET', 'POST', 'PATCH', 'DELETE'].include?(method) UI.user_error!('Path to the Xcode project has to be specified') end end ) ] end |
.description ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/stream_actions/actions/allure_api.rb', line 33 def self.description 'Allure Testops API' end |
.is_supported?(platform) ⇒ Boolean
69 70 71 |
# File 'lib/fastlane/plugin/stream_actions/actions/allure_api.rb', line 69 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fastlane/plugin/stream_actions/actions/allure_api.rb', line 4 def self.run(params) url = URI("#{params[:url]}/#{params[:path]}") request = case params[:http_method].upcase when 'GET' Net::HTTP::Get.new(url) when 'POST' Net::HTTP::Post.new(url) when 'PATCH' Net::HTTP::Patch.new(url) when 'DELETE' Net::HTTP::Delete.new(url) end http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request['authorization'] = "Api-Token #{params[:token]}" request['content-type'] = 'application/json' request.body = params[:request_body] if params[:request_body] response_body = http.request(request).read_body JSON.parse(response_body) if !response_body.nil? && !response_body.empty? end |