Class: Fastlane::Shuttle::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/polidea/helper/shuttle.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url, access_token) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fastlane/plugin/polidea/helper/shuttle.rb', line 7

def initialize(base_url, access_token)
  retry_options = {
    max: 2,
    interval: 0.05,
    interval_randomness: 0.5,
    backoff_factor: 2
  }

  @conn = Faraday.new(
    url: base_url,
    headers: {
      'Content-Type' => 'application/json',
      'Access-Token' => access_token
    }
  ) do |conn|
    conn.request :retry, retry_options
    conn.request :multipart
    conn.response :raise_error
    conn.response :json
    conn.adapter :net_http
  end
end

Instance Method Details

#create_build(platform, app_identifier, build) ⇒ Object



30
31
32
33
34
35
# File 'lib/fastlane/plugin/polidea/helper/shuttle.rb', line 30

def create_build(platform, app_identifier, build)
  @conn.post(
    "cd/apps/#{platform}/#{app_identifier}/builds/v2",
    { build: build }.to_json
  )
end

#get_upload_urls(platform, app_id, build_identifier) ⇒ Object



37
38
39
40
41
42
# File 'lib/fastlane/plugin/polidea/helper/shuttle.rb', line 37

def get_upload_urls(platform, app_id, build_identifier)
  response = @conn.get(
    "projects/apps/#{platform}/#{app_id}/builds/#{build_identifier}/upload-url/v2"
  )
  return response.body
end