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
29
# 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.adapter :net_http
  end
end

Instance Method Details

#create_build(platform, app_identifier, build) ⇒ Object



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

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