Class: Fastlane::Helper::FetchVersionCodeHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::FetchVersionCodeHelper
- Defined in:
- lib/fastlane/plugin/fetch_version_code/helper/fetch_version_code_helper.rb
Class Method Summary collapse
Class Method Details
.fetch_version_code(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fastlane/plugin/fetch_version_code/helper/fetch_version_code_helper.rb', line 9 def self.fetch_version_code(params) url = self.get_api_url(params) UI.("Calling API: #{url}") method = params[:method] || :get headers = params[:secret_header] ? { params[:secret_header] => params[:secret_value] } : {} res = HTTP.headers(headers).send(method, url) if res.status != 200 UI.error("Some error occureds [status:#{res.status}]: #{res.body}") UI.crash!(res.body) end return res.body.to_s end |
.get_api_url(params) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/fastlane/plugin/fetch_version_code/helper/fetch_version_code_helper.rb', line 25 def self.get_api_url(params) if params[:endpoint] return params[:endpoint] if params[:endpoint].start_with?("http:", "https:") return "https://#{params[:endpoint]}" elsif params[:host] && params[:path] return "https://#{params[:host]}#{params[:path]}" end raise ArgumentError, 'No enough params to get api_url' end |