class Fastlane::Shuttle::Client

Public Class Methods

new(base_url, access_token) click to toggle source
# 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

Public Instance Methods

create_build(platform, app_identifier, build) click to toggle source
# 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) click to toggle source
# 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