Merge pull request #99 from sapieneptus/chfuen/configurable-base-url

Allow base url to be set by environment
This commit is contained in:
Lukas Spieß 2019-07-25 10:20:54 +02:00 коммит произвёл GitHub
Родитель 8d93e50299 939908c6b6
Коммит 4803f37ba8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 12 добавлений и 23 удалений

Просмотреть файл

@ -8,7 +8,7 @@ module Fastlane
require 'faraday_middleware' require 'faraday_middleware'
options = { options = {
url: upload_url ? upload_url : "https://api.appcenter.ms" url: upload_url ? upload_url : ENV.fetch('APPCENTER_UPLOAD_URL', "https://api.appcenter.ms")
} }
Faraday.new(options) do |builder| Faraday.new(options) do |builder|
@ -31,8 +31,7 @@ module Fastlane
def self.create_release_upload(api_token, owner_name, app_name) def self.create_release_upload(api_token, owner_name, app_name)
connection = self.connection connection = self.connection
response = connection.post do |req| response = connection.post("v0.1/apps/#{owner_name}/#{app_name}/release_uploads") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/release_uploads")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
req.body = {} req.body = {}
@ -64,8 +63,7 @@ module Fastlane
def self.create_mapping_upload(api_token, owner_name, app_name, file_name, build_number, version) def self.create_mapping_upload(api_token, owner_name, app_name, file_name, build_number, version)
connection = self.connection connection = self.connection
response = connection.post do |req| response = connection.post("v0.1/apps/#{owner_name}/#{app_name}/symbol_uploads") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/symbol_uploads")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
req.body = { req.body = {
@ -100,8 +98,7 @@ module Fastlane
def self.create_dsym_upload(api_token, owner_name, app_name) def self.create_dsym_upload(api_token, owner_name, app_name)
connection = self.connection connection = self.connection
response = connection.post do |req| response = connection.post("v0.1/apps/#{owner_name}/#{app_name}/symbol_uploads") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/symbol_uploads")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
req.body = { req.body = {
@ -129,8 +126,7 @@ module Fastlane
def self.update_symbol_upload(api_token, owner_name, app_name, symbol_upload_id, status) def self.update_symbol_upload(api_token, owner_name, app_name, symbol_upload_id, status)
connection = self.connection connection = self.connection
response = connection.patch do |req| response = connection.patch("v0.1/apps/#{owner_name}/#{app_name}/symbol_uploads/#{symbol_upload_id}") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/symbol_uploads/#{symbol_upload_id}")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
req.body = { req.body = {
@ -209,8 +205,7 @@ module Fastlane
def self.update_release_upload(api_token, owner_name, app_name, upload_id, status) def self.update_release_upload(api_token, owner_name, app_name, upload_id, status)
connection = self.connection connection = self.connection
response = connection.patch do |req| response = connection.patch("v0.1/apps/#{owner_name}/#{app_name}/release_uploads/#{upload_id}") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/release_uploads/#{upload_id}")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
req.body = { req.body = {
@ -233,8 +228,7 @@ module Fastlane
# get existing release # get existing release
def self.get_release(api_token, owner_name, app_name, release_id) def self.get_release(api_token, owner_name, app_name, release_id)
connection = self.connection connection = self.connection
response = connection.get do |req| response = connection.get("v0.1/apps/#{owner_name}/#{app_name}/releases/#{release_id}") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/releases/#{release_id}")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
end end
@ -257,8 +251,7 @@ module Fastlane
def self.get_destination(api_token, owner_name, app_name, destination_type, destination_name) def self.get_destination(api_token, owner_name, app_name, destination_type, destination_name)
connection = self.connection connection = self.connection
response = connection.get do |req| response = connection.get("v0.1/apps/#{owner_name}/#{app_name}/distribution_#{destination_type}s/#{ERB::Util.url_encode(destination_name)}") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/distribution_#{destination_type}s/#{ERB::Util.url_encode(destination_name)}")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
end end
@ -281,8 +274,7 @@ module Fastlane
def self.update_release(api_token, owner_name, app_name, release_id, release_notes = '') def self.update_release(api_token, owner_name, app_name, release_id, release_notes = '')
connection = self.connection connection = self.connection
response = connection.put do |req| response = connection.put("v0.1/apps/#{owner_name}/#{app_name}/releases/#{release_id}") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/releases/#{release_id}")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
req.body = { req.body = {
@ -326,8 +318,7 @@ module Fastlane
body["notify_testers"] = notify_testers body["notify_testers"] = notify_testers
end end
response = connection.post do |req| response = connection.post("v0.1/apps/#{owner_name}/#{app_name}/releases/#{release_id}/#{destination_type}s") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/releases/#{release_id}/#{destination_type}s")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
req.body = body req.body = body
@ -361,8 +352,7 @@ module Fastlane
def self.get_app(api_token, owner_name, app_name) def self.get_app(api_token, owner_name, app_name)
connection = self.connection connection = self.connection
response = connection.get do |req| response = connection.get("v0.1/apps/#{owner_name}/#{app_name}") do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
end end
@ -384,8 +374,7 @@ module Fastlane
def self.create_app(api_token, owner_name, app_name, app_display_name, os, platform) def self.create_app(api_token, owner_name, app_name, app_display_name, os, platform)
connection = self.connection connection = self.connection
response = connection.post do |req| response = connection.post("v0.1/apps") do |req|
req.url("/v0.1/apps")
req.headers['X-API-Token'] = api_token req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane" req.headers['internal-request-source'] = "fastlane"
req.body = { req.body = {