fastlane-plugin-appscert 1.0.0 → 1.0.1
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 +4 -4
- data/lib/fastlane/plugin/appscert/helper/appscert_helper.rb +21 -12
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5dc2f61b4be1a02f45077e71647c771f8912a05198b95ad57ac6329e49d58be0
|
|
4
|
+
data.tar.gz: 56c4e7cb1e9c994dd56b4ec75a5b1d080d949c5f1c762715b6d33163df073438
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ba2aa1624d8ae63fc12fbbfc7870c1b0494c8c6780c309a1d89c0547252c9079ea3891f61ddae3e3af19619ff893bb542f652603e757bc3997ced7bd4cf07ae
|
|
7
|
+
data.tar.gz: 98f64d4d58ed7ce3ad79aeb2e604d5fe58e377948206ee040b4e47763d6390de03b54425eba9c012e1829b3be7e696947d83b4e22179cf0c9b5c5ab4cb8eb8ed
|
|
@@ -4,36 +4,45 @@ require 'json'
|
|
|
4
4
|
module Fastlane
|
|
5
5
|
module Helper
|
|
6
6
|
class AppscertHelper
|
|
7
|
-
BASE_URL = 'https://appscert.com
|
|
7
|
+
BASE_URL = 'https://appscert.com'
|
|
8
8
|
|
|
9
9
|
def self.api_client(api_key, base_url: nil)
|
|
10
10
|
url = base_url || ENV['APPSCERT_API_URL'] || BASE_URL
|
|
11
11
|
Faraday.new(url: url) do |f|
|
|
12
12
|
f.request :retry, max: 2
|
|
13
|
-
f.headers['
|
|
13
|
+
f.headers['X-API-Key'] = api_key
|
|
14
14
|
f.headers['Content-Type'] = 'application/json'
|
|
15
15
|
f.headers['User-Agent'] = 'fastlane-plugin-appscert/1.0.0'
|
|
16
16
|
f.adapter Faraday.default_adapter
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
# Returns array of certificates
|
|
21
|
+
def self.fetch_certificates(api_key, base_url: nil, bundle_id: nil, type: nil)
|
|
21
22
|
client = api_client(api_key, base_url: base_url)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
params = {}
|
|
24
|
+
params[:bundle_id] = bundle_id if bundle_id
|
|
25
|
+
params[:type] = type if type
|
|
26
|
+
response = client.get('/api/ci', params)
|
|
27
|
+
raise "AppsCert API error #{response.status}: #{response.body}" unless response.status == 200
|
|
28
|
+
data = JSON.parse(response.body)
|
|
29
|
+
data.is_a?(Array) ? data : (data['certificates'] || [])
|
|
25
30
|
end
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
# Returns array of provisioning profiles
|
|
33
|
+
def self.fetch_profiles(api_key, base_url: nil, bundle_id: nil)
|
|
28
34
|
client = api_client(api_key, base_url: base_url)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
params = { resource: 'profiles' }
|
|
36
|
+
params[:bundle_id] = bundle_id if bundle_id
|
|
37
|
+
response = client.get('/api/ci', params)
|
|
38
|
+
raise "AppsCert API error #{response.status}: #{response.body}" unless response.status == 200
|
|
39
|
+
data = JSON.parse(response.body)
|
|
40
|
+
data.is_a?(Array) ? data : (data['profiles'] || data['certificates'] || [])
|
|
32
41
|
end
|
|
33
42
|
|
|
34
43
|
def self.download_certificate(api_key, cert_id, output_path, base_url: nil)
|
|
35
44
|
client = api_client(api_key, base_url: base_url)
|
|
36
|
-
response = client.
|
|
45
|
+
response = client.post('/api/ci', JSON.generate({ action: 'download', type: 'certificate', id: cert_id }))
|
|
37
46
|
raise "Download failed: #{response.status}" unless response.status == 200
|
|
38
47
|
File.write(output_path, response.body)
|
|
39
48
|
output_path
|
|
@@ -41,7 +50,7 @@ module Fastlane
|
|
|
41
50
|
|
|
42
51
|
def self.download_profile(api_key, profile_id, output_path, base_url: nil)
|
|
43
52
|
client = api_client(api_key, base_url: base_url)
|
|
44
|
-
response = client.
|
|
53
|
+
response = client.post('/api/ci', JSON.generate({ action: 'download', type: 'profile', id: profile_id }))
|
|
45
54
|
raise "Download failed: #{response.status}" unless response.status == 200
|
|
46
55
|
File.write(output_path, response.body)
|
|
47
56
|
output_path
|