fastlane-plugin-screenshotslive 0.1.0 → 0.2.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce2cfed932ddc0db4dd72bda4f1c52c70bad9947f0c6ba26a6e0ecc668123a1a
|
|
4
|
+
data.tar.gz: d6167244e7000e719e9e509dcea29e83bcbf00cc58d0a34fd4e9c36c15ef967e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32961972f18262e02291362bf2d105851912fabbc766a32452114ee079649980823502df0391db4a1856818c67b4a71d1e49e27747c0ecd8848c320ffa973d23
|
|
7
|
+
data.tar.gz: 6ba93c22b4ff5a4106f300c56e51039f848ffee6ff8032ea0d6b54d33c75e55f05be51a46fbaf01586ef7b0c7400014432f6e591877096d3151c35758696d758
|
|
@@ -17,7 +17,7 @@ module Fastlane
|
|
|
17
17
|
client = Screenshotslive::ApiClient.new(api_key: api_key, base_url: base_url)
|
|
18
18
|
|
|
19
19
|
result = client.render(yaml_config: yaml_config)
|
|
20
|
-
job_id = result.dig("data", "
|
|
20
|
+
job_id = result.dig("data", "jobId") || result.dig("data", "id")
|
|
21
21
|
UI.message("Render job dispatched: #{job_id}")
|
|
22
22
|
|
|
23
23
|
UI.message("Waiting for render to complete...")
|
|
@@ -5,15 +5,14 @@ module Fastlane
|
|
|
5
5
|
module Screenshotslive
|
|
6
6
|
class ApiClient
|
|
7
7
|
BASE_URL = "https://api.screenshots.live"
|
|
8
|
-
RENDER_PATH = "/render
|
|
8
|
+
RENDER_PATH = "/render/api"
|
|
9
|
+
POLL_PATH_PREFIX = "/render/get-render/"
|
|
9
10
|
POLL_INTERVAL = 3
|
|
10
11
|
MAX_POLL_ATTEMPTS = 200
|
|
11
12
|
|
|
12
13
|
def initialize(api_key:, base_url: nil)
|
|
13
14
|
@api_key = api_key
|
|
14
15
|
@conn = Faraday.new(url: base_url || BASE_URL) do |f|
|
|
15
|
-
f.request :multipart
|
|
16
|
-
f.request :url_encoded
|
|
17
16
|
f.adapter Faraday.default_adapter
|
|
18
17
|
end
|
|
19
18
|
end
|
|
@@ -21,8 +20,8 @@ module Fastlane
|
|
|
21
20
|
def render(yaml_config:)
|
|
22
21
|
response = @conn.post(RENDER_PATH) do |req|
|
|
23
22
|
req.headers["Authorization"] = "Bearer #{@api_key}"
|
|
24
|
-
req.headers["Content-Type"] = "
|
|
25
|
-
req.body =
|
|
23
|
+
req.headers["Content-Type"] = "text/yaml"
|
|
24
|
+
req.body = yaml_config
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
unless response.success?
|
|
@@ -41,7 +40,7 @@ module Fastlane
|
|
|
41
40
|
raise "Render job #{job_id} timed out after #{MAX_POLL_ATTEMPTS * POLL_INTERVAL}s"
|
|
42
41
|
end
|
|
43
42
|
|
|
44
|
-
response = @conn.get("
|
|
43
|
+
response = @conn.get("#{POLL_PATH_PREFIX}#{job_id}") do |req|
|
|
45
44
|
req.headers["Authorization"] = "Bearer #{@api_key}"
|
|
46
45
|
end
|
|
47
46
|
|