fastlane-plugin-firebase_app_distribution 0.7.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31b34bdb303bcc029291767ec3396329550ed6ac8f038774b37d78fb5121f1dc
4
- data.tar.gz: 220323bd4dab4e6cd20fca8a863aa184d4b88fdf261549ecb115d8ef4aaf0b6b
3
+ metadata.gz: 825076928662d5ad48eb2ad1990c68952c93785d118c46911a5aa5cdc365cc03
4
+ data.tar.gz: 6ac4fe07a6460242f75e08f13bb57cf2079365f89bca7c981d82574908947904
5
5
  SHA512:
6
- metadata.gz: 7256d3eb6e7ac59dd8bffbd3ce3d1fda8b98d1284c6576ad556e1f43d46d7adc0b86a59fc5a30577438a525fea8f46b76027b28278a2c3a025d98b3c6e8636e7
7
- data.tar.gz: a4469ffccd6a38a78dfaf3729433ab5961ade3fc251f97c791123f76632c8142f25544afd6ece4c961310d45d0277be0212782ababbc8418eceb08c4d568dec3
6
+ metadata.gz: 457efecae9d8b5e9b2462f8f0557de75998d077aab9dd2177105d9ab0b958c1f13a7a53dada5ec156d08a8c330cae70c6a3d9b5d8cd5752721e95632571d6893
7
+ data.tar.gz: b8a4603cafe2e129b942a28a3d739d35048972bd8a726db4fc56295aa907703c66622563de59ca3910ee8a32a7ba89d2c2f276b7caa77ea20caaab093def915a
@@ -37,12 +37,13 @@ module Fastlane
37
37
 
38
38
  # TODO(lkellogg): This sets the send timeout for all POST requests made by the client, but
39
39
  # ideally the timeout should only apply to the binary upload
40
- client = init_client(params[:service_credentials_file],
41
- params[:firebase_cli_token],
42
- params[:debug],
43
- timeout)
40
+ client = init_v1_client(params[:service_credentials_file],
41
+ params[:firebase_cli_token],
42
+ params[:debug],
43
+ timeout)
44
44
 
45
- # If binary is an AAB, get the AAB info for this app, which includes the integration state and certificate data
45
+ # If binary is an AAB, get the AAB info for this app, which includes the integration state
46
+ # and certificate data
46
47
  if binary_type == :AAB
47
48
  aab_info = get_aab_info(client, app_name)
48
49
  validate_aab_setup!(aab_info)
@@ -50,21 +51,9 @@ module Fastlane
50
51
 
51
52
  binary_type = binary_type_from_path(binary_path)
52
53
  UI.message("⌛ Uploading the #{binary_type}.")
53
-
54
- # For some reason calling the client.upload_medium returns nil when
55
- # it should return a long running operation object
56
- # (https://github.com/googleapis/google-api-ruby-client/blob/main/generated/google-apis-firebaseappdistribution_v1/lib/google/apis/firebaseappdistribution_v1/service.rb#L79).
57
- # We could use client.http, but is much slower
58
- # (https://github.com/firebase/fastlane-plugin-firebase_app_distribution/issues/330),
59
- # so we still use the old client for now.
60
- # TODO(kbolay) Prefer client.upload_medium, assuming it is sufficiently fast
61
- fad_api_client = Client::FirebaseAppDistributionApiClient.new(client.authorization.access_token, params[:debug])
62
- operation_name = fad_api_client.upload_binary(app_name,
63
- binary_path,
64
- platform.to_s,
65
- get_upload_timeout(params))
66
-
67
- release = poll_upload_release_operation(client, operation_name, binary_type)
54
+ operation = upload_binary(app_name, binary_path, client, timeout)
55
+ UI.message("🕵️ Validating upload.")
56
+ release = poll_upload_release_operation(client, operation, binary_type)
68
57
 
69
58
  if binary_type == :AAB && aab_info && !aab_certs_included?(aab_info.test_certificate)
70
59
  updated_aab_info = get_aab_info(client, app_name)
@@ -86,6 +75,7 @@ module Fastlane
86
75
  release.release_notes = Google::Apis::FirebaseappdistributionV1::GoogleFirebaseAppdistroV1ReleaseNotes.new(
87
76
  text: release_notes
88
77
  )
78
+ UI.message("📜 Setting release notes.")
89
79
  release = update_release(client, release)
90
80
  end
91
81
 
@@ -98,6 +88,7 @@ module Fastlane
98
88
  tester_emails: emails,
99
89
  group_aliases: group_aliases
100
90
  )
91
+ UI.message("📦 Distributing release.")
101
92
  distribute_release(client, release, request)
102
93
  else
103
94
  UI.message("⏩ No testers or groups passed in. Skipping this step.")
@@ -222,8 +213,8 @@ module Fastlane
222
213
  release_notes_param || Actions.lane_context[SharedValues::FL_CHANGELOG]
223
214
  end
224
215
 
225
- def self.poll_upload_release_operation(client, operation_name, binary_type)
226
- operation = client.get_project_app_release_operation(operation_name)
216
+ def self.poll_upload_release_operation(client, operation, binary_type)
217
+ operation = client.get_project_app_release_operation(operation.name)
227
218
  MAX_POLLING_RETRIES.times do
228
219
  if operation.done && operation.response && operation.response['release']
229
220
  release = extract_release(operation)
@@ -257,6 +248,30 @@ module Fastlane
257
248
  extract_release(operation)
258
249
  end
259
250
 
251
+ def self.upload_binary(app_name, binary_path, client, timeout)
252
+ options = Google::Apis::RequestOptions.new
253
+ options.max_elapsed_time = timeout # includes retries (default = no retries)
254
+ options.header = {
255
+ 'Content-Type' => 'application/octet-stream',
256
+ 'X-Goog-Upload-File-Name' => CGI.escape(File.basename(binary_path)),
257
+ 'X-Goog-Upload-Protocol' => 'raw'
258
+ }
259
+
260
+ # For some reason calling the client.upload_medium returns nil when
261
+ # it should return a long running operation object, so we make a
262
+ # standard http call instead and convert it to a long running object
263
+ # https://github.com/googleapis/google-api-ruby-client/blob/main/generated/google-apis-firebaseappdistribution_v1/lib/google/apis/firebaseappdistribution_v1/service.rb#L79
264
+ # TODO(kbolay) Prefer client.upload_medium
265
+ response = client.http(
266
+ :post,
267
+ "https://firebaseappdistribution.googleapis.com/upload/v1/#{app_name}/releases:upload",
268
+ body: File.open(binary_path, 'rb'),
269
+ options: options
270
+ )
271
+
272
+ Google::Apis::FirebaseappdistributionV1::GoogleLongrunningOperation.from_json(response)
273
+ end
274
+
260
275
  def self.extract_release(operation)
261
276
  Google::Apis::FirebaseappdistributionV1::GoogleFirebaseAppdistroV1Release.from_json(operation.response['release'].to_json)
262
277
  end
@@ -11,7 +11,7 @@ module Fastlane
11
11
  extend Helper::FirebaseAppDistributionHelper
12
12
 
13
13
  def self.run(params)
14
- client = init_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
14
+ client = init_v1_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
15
15
 
16
16
  if blank?(params[:emails]) && blank?(params[:file])
17
17
  UI.user_error!("Must specify `emails` or `file`.")
@@ -11,8 +11,6 @@ module Fastlane
11
11
  extend Auth::FirebaseAppDistributionAuthClient
12
12
  extend Helper::FirebaseAppDistributionHelper
13
13
 
14
- FirebaseAppDistributionV1 = Google::Apis::FirebaseappdistributionV1
15
-
16
14
  def self.run(params)
17
15
  if blank?(params[:alias])
18
16
  UI.user_error!("Must specify `alias`.")
@@ -22,7 +20,7 @@ module Fastlane
22
20
  UI.user_error!("Must specify `display_name`.")
23
21
  end
24
22
 
25
- client = init_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
23
+ client = init_v1_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
26
24
 
27
25
  project_number = params[:project_number]
28
26
  group_alias = params[:alias]
@@ -31,7 +29,7 @@ module Fastlane
31
29
  UI.message("⏳ Creating tester group '#{group_alias} (#{display_name})' in project #{project_number}...")
32
30
 
33
31
  parent = project_name(project_number)
34
- group = FirebaseAppDistributionV1::GoogleFirebaseAppdistroV1Group.new(
32
+ group = Google::Apis::FirebaseappdistributionV1::GoogleFirebaseAppdistroV1Group.new(
35
33
  name: group_name(project_number, group_alias),
36
34
  display_name: display_name
37
35
  )
@@ -11,7 +11,7 @@ module Fastlane
11
11
  extend Helper::FirebaseAppDistributionHelper
12
12
 
13
13
  def self.run(params)
14
- client = init_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
14
+ client = init_v1_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
15
15
 
16
16
  if blank?(params[:alias])
17
17
  UI.user_error!("Must specify `alias`.")
@@ -13,7 +13,7 @@ module Fastlane
13
13
  extend Helper::FirebaseAppDistributionHelper
14
14
 
15
15
  def self.run(params)
16
- client = init_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
16
+ client = init_v1_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
17
17
 
18
18
  UI.message("⏳ Fetching latest release for app #{params[:app]}...")
19
19
 
@@ -4,7 +4,6 @@ require 'shellwords'
4
4
  require 'googleauth'
5
5
  require_relative '../helper/firebase_app_distribution_helper'
6
6
  require_relative '../helper/firebase_app_distribution_error_message'
7
- require_relative '../client/firebase_app_distribution_api_client'
8
7
  require_relative '../helper/firebase_app_distribution_auth_client'
9
8
 
10
9
  module Fastlane
@@ -14,11 +13,17 @@ module Fastlane
14
13
  extend Helper::FirebaseAppDistributionHelper
15
14
 
16
15
  def self.run(params)
17
- client = init_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
18
- fad_api_client = Client::FirebaseAppDistributionApiClient.new(client.authorization.access_token, params[:debug])
16
+ client = init_v1alpha_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
19
17
 
20
- app_id = params[:app]
21
- udids = fad_api_client.get_udids(app_id)
18
+ project_number = params[:project_number]
19
+ if blank?(project_number)
20
+ app_id = params[:app]
21
+ if blank?(app_id)
22
+ UI.user_error!("Must specify `project_number`.")
23
+ end
24
+ project_number = project_number_from_app_id(app_id)
25
+ end
26
+ udids = client.get_project_tester_udids(project_name(project_number)).tester_udids
22
27
 
23
28
  if udids.empty?
24
29
  UI.important("App Distribution fetched 0 tester UDIDs. Nothing written to output file.")
@@ -32,7 +37,7 @@ module Fastlane
32
37
  File.open(output_file, 'w') do |f|
33
38
  f.write("Device ID\tDevice Name\tDevice Platform\n")
34
39
  udids.each do |tester_udid|
35
- f.write("#{tester_udid[:udid]}\t#{tester_udid[:name]}\t#{tester_udid[:platform]}\n")
40
+ f.write("#{tester_udid.udid}\t#{tester_udid.name}\t#{tester_udid.platform}\n")
36
41
  end
37
42
  end
38
43
  end
@@ -52,10 +57,18 @@ module Fastlane
52
57
 
53
58
  def self.available_options
54
59
  [
60
+ FastlaneCore::ConfigItem.new(key: :project_number,
61
+ conflicting_options: [:app],
62
+ env_name: "FIREBASEAPPDISTRO_PROJECT_NUMBER",
63
+ description: "Your Firebase project number. You can find the project number in the Firebase console, on the General Settings page",
64
+ type: Integer,
65
+ optional: true),
55
66
  FastlaneCore::ConfigItem.new(key: :app,
67
+ conflicting_options: [:project_number],
56
68
  env_name: "FIREBASEAPPDISTRO_APP",
57
69
  description: "Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page",
58
- optional: false,
70
+ optional: true,
71
+ deprecated: "Use project_number (FIREBASEAPPDISTRO_PROJECT_NUMBER) instead",
59
72
  type: String),
60
73
  FastlaneCore::ConfigItem.new(key: :output_file,
61
74
  env_name: "FIREBASEAPPDISTRO_OUTPUT_FILE",
@@ -11,7 +11,7 @@ module Fastlane
11
11
  extend Helper::FirebaseAppDistributionHelper
12
12
 
13
13
  def self.run(params)
14
- client = init_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
14
+ client = init_v1_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
15
15
 
16
16
  if blank?(params[:emails]) && blank?(params[:file])
17
17
  UI.user_error!("Must specify `emails` or `file`.")
@@ -38,16 +38,12 @@ module Fastlane
38
38
  elsif !ENV["FIREBASE_TOKEN"].nil? && !ENV["FIREBASE_TOKEN"].empty?
39
39
  UI.message("🔐 Authenticating with FIREBASE_TOKEN environment variable")
40
40
  firebase_token(ENV["FIREBASE_TOKEN"], debug)
41
- # TODO(lkellogg): Not using Google::Auth.get_application_default yet while we are still
42
- # using the old client for uploads. ADC also does not work for the get_udids action:
43
- # https://cloud.google.com/docs/authentication/troubleshoot-adc#user-creds-client-based
44
- # For now go back to just using the environment variable:
45
- elsif !ENV["GOOGLE_APPLICATION_CREDENTIALS"].nil? && !ENV["GOOGLE_APPLICATION_CREDENTIALS"].empty?
46
- UI.message("🔐 Authenticating with GOOGLE_APPLICATION_CREDENTIALS environment variable: #{ENV['GOOGLE_APPLICATION_CREDENTIALS']}")
47
- service_account(ENV["GOOGLE_APPLICATION_CREDENTIALS"], debug)
48
41
  elsif (refresh_token = refresh_token_from_firebase_tools)
49
- UI.message("🔐 No authentication method found. Using cached Firebase CLI credentials.")
42
+ UI.message("🔐 Authenticating with cached Firebase CLI credentials")
50
43
  firebase_token(refresh_token, debug)
44
+ elsif !application_default_creds.nil?
45
+ UI.message("🔐 Authenticating with Application Default Credentials")
46
+ application_default_creds
51
47
  else
52
48
  UI.user_error!(ErrorMessage::MISSING_CREDENTIALS)
53
49
  nil
@@ -56,6 +52,12 @@ module Fastlane
56
52
 
57
53
  private
58
54
 
55
+ def application_default_creds
56
+ Google::Auth.get_application_default([SCOPE])
57
+ rescue
58
+ nil
59
+ end
60
+
59
61
  def refresh_token_from_firebase_tools
60
62
  config_path = format_config_path
61
63
  if File.exist?(config_path)
@@ -99,7 +101,10 @@ module Fastlane
99
101
  end
100
102
 
101
103
  def service_account(google_service_path, debug)
102
- service_account_credentials = Google::Auth::ServiceAccountCredentials.make_creds(
104
+ # check if it's an external account or service account
105
+ json_file = JSON.parse(File.read(google_service_path))
106
+ auth = json_file["type"] == "external_account" ? Google::Auth::ExternalAccount::Credentials : Google::Auth::ServiceAccountCredentials
107
+ service_account_credentials = auth.make_creds(
103
108
  json_key_io: File.open(google_service_path),
104
109
  scope: SCOPE
105
110
  )
@@ -1,5 +1,8 @@
1
1
  require 'fastlane_core/ui/ui'
2
+ require 'google/apis/firebaseappdistribution_v1'
3
+ require 'google/apis/firebaseappdistribution_v1alpha'
2
4
  require 'cfpropertylist'
5
+
3
6
  module Fastlane
4
7
  UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
8
  module Helper
@@ -53,8 +56,12 @@ module Fastlane
53
56
  !blank?(value)
54
57
  end
55
58
 
59
+ def project_number_from_app_id(app_id)
60
+ app_id.split(':')[1]
61
+ end
62
+
56
63
  def app_name_from_app_id(app_id)
57
- "#{project_name(app_id.split(':')[1])}/apps/#{app_id}"
64
+ "#{project_name(project_number_from_app_id(app_id))}/apps/#{app_id}"
58
65
  end
59
66
 
60
67
  def project_name(project_number)
@@ -65,7 +72,17 @@ module Fastlane
65
72
  "#{project_name(project_number)}/groups/#{group_alias}"
66
73
  end
67
74
 
68
- def init_client(service_credentials_file, firebase_cli_token, debug, timeout = nil)
75
+ def init_v1_client(service_credentials_file, firebase_cli_token, debug, timeout = nil)
76
+ init_client(Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new,
77
+ service_credentials_file, firebase_cli_token, debug, timeout)
78
+ end
79
+
80
+ def init_v1alpha_client(service_credentials_file, firebase_cli_token, debug, timeout = nil)
81
+ init_client(Google::Apis::FirebaseappdistributionV1alpha::FirebaseAppDistributionService.new,
82
+ service_credentials_file, firebase_cli_token, debug, timeout)
83
+ end
84
+
85
+ def init_client(client, service_credentials_file, firebase_cli_token, debug, timeout = nil)
69
86
  if debug
70
87
  UI.important("Warning: Debug logging enabled. Output may include sensitive information.")
71
88
  Google::Apis.logger.level = Logger::DEBUG
@@ -77,7 +94,6 @@ module Fastlane
77
94
  Google::Apis::ClientOptions.default.send_timeout_sec = timeout
78
95
  end
79
96
 
80
- client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
81
97
  client.authorization = get_authorization(service_credentials_file, firebase_cli_token, debug)
82
98
  client
83
99
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module FirebaseAppDistribution
3
- VERSION = "0.7.3"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-firebase_app_distribution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Natchev
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-09-07 00:00:00.000000000 Z
13
+ date: 2024-01-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: google-apis-firebaseappdistribution_v1
@@ -26,6 +26,20 @@ dependencies:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: 0.3.0
29
+ - !ruby/object:Gem::Dependency
30
+ name: google-apis-firebaseappdistribution_v1alpha
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: 0.2.0
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: 0.2.0
29
43
  - !ruby/object:Gem::Dependency
30
44
  name: pry
31
45
  requirement: !ruby/object:Gem::Requirement
@@ -172,7 +186,6 @@ files:
172
186
  - lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb
173
187
  - lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb
174
188
  - lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_remove_testers_action.rb
175
- - lib/fastlane/plugin/firebase_app_distribution/client/firebase_app_distribution_api_client.rb
176
189
  - lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_auth_client.rb
177
190
  - lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_error_message.rb
178
191
  - lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb
@@ -196,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
209
  - !ruby/object:Gem::Version
197
210
  version: '0'
198
211
  requirements: []
199
- rubygems_version: 3.4.10
212
+ rubygems_version: 3.5.3
200
213
  signing_key:
201
214
  specification_version: 4
202
215
  summary: Release your beta builds to Firebase App Distribution. https://firebase.google.com/docs/app-distribution
@@ -1,97 +0,0 @@
1
- require 'fastlane_core/ui/ui'
2
- require_relative '../helper/firebase_app_distribution_helper'
3
-
4
- module Fastlane
5
- module Client
6
- class FirebaseAppDistributionApiClient
7
- include Helper::FirebaseAppDistributionHelper
8
-
9
- BASE_URL = "https://firebaseappdistribution.googleapis.com"
10
- MAX_POLLING_RETRIES = 60
11
- POLLING_INTERVAL_SECONDS = 5
12
-
13
- AUTHORIZATION = "Authorization"
14
- CONTENT_TYPE = "Content-Type"
15
- APPLICATION_OCTET_STREAM = "application/octet-stream"
16
- CLIENT_VERSION = "X-Client-Version"
17
-
18
- def initialize(auth_token, debug = false)
19
- @auth_token = auth_token
20
- @debug = debug
21
- end
22
-
23
- # Uploads the app binary to the Firebase API
24
- #
25
- # args
26
- # app_name - Firebase App resource name
27
- # binary_path - Absolute path to your app's aab/apk/ipa file
28
- # platform - 'android' or 'ios'
29
- # timeout - The amount of seconds before the upload will timeout, if not completed
30
- #
31
- # Returns the long-running operation name.
32
- #
33
- # Throws a user_error if the binary file does not exist
34
- def upload_binary(app_name, binary_path, platform, timeout)
35
- response = connection.post(binary_upload_url(app_name), read_binary(binary_path)) do |request|
36
- request.options.timeout = timeout # seconds
37
- request.headers[AUTHORIZATION] = "Bearer " + @auth_token
38
- request.headers[CONTENT_TYPE] = APPLICATION_OCTET_STREAM
39
- request.headers[CLIENT_VERSION] = client_version_header_value
40
- request.headers["X-Goog-Upload-File-Name"] = File.basename(binary_path)
41
- request.headers["X-Goog-Upload-Protocol"] = "raw"
42
- end
43
-
44
- response.body[:name] || ''
45
- rescue Errno::ENOENT # Raised when binary_path file does not exist
46
- binary_type = binary_type_from_path(binary_path)
47
- UI.user_error!("#{ErrorMessage.binary_not_found(binary_type)}: #{binary_path}")
48
- end
49
-
50
- # Get tester UDIDs
51
- #
52
- # args
53
- # app_name - Firebase App resource name
54
- #
55
- # Returns a list of hashes containing tester device info
56
- def get_udids(app_id)
57
- begin
58
- response = connection.get(get_udids_url(app_id)) do |request|
59
- request.headers[AUTHORIZATION] = "Bearer " + @auth_token
60
- request.headers[CLIENT_VERSION] = client_version_header_value
61
- end
62
- rescue Faraday::ResourceNotFound
63
- UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{app_id}")
64
- end
65
- response.body[:testerUdids] || []
66
- end
67
-
68
- private
69
-
70
- def client_version_header_value
71
- "fastlane/#{Fastlane::FirebaseAppDistribution::VERSION}"
72
- end
73
-
74
- def binary_upload_url(app_name)
75
- "/upload/v1/#{app_name}/releases:upload"
76
- end
77
-
78
- def get_udids_url(app_id)
79
- "/v1alpha/apps/#{app_id}/testers:getTesterUdids"
80
- end
81
-
82
- def connection
83
- @connection ||= Faraday.new(url: BASE_URL) do |conn|
84
- conn.response(:json, parser_options: { symbolize_names: true })
85
- conn.response(:raise_error) # raise_error middleware will run before the json middleware
86
- conn.response(:logger, nil, { headers: false, bodies: { response: true }, log_level: :debug }) if @debug
87
- conn.adapter(Faraday.default_adapter)
88
- end
89
- end
90
-
91
- def read_binary(path)
92
- # File must be read in binary mode to work on Windows
93
- File.open(path, 'rb').read
94
- end
95
- end
96
- end
97
- end