class Dpl::Providers::Testfairy

Constants

UA
URL

Public Instance Methods

deploy() click to toggle source
# File lib/dpl/providers/testfairy.rb, line 39
def deploy
  info :deploy, pretty_print(params)
  body = JSON.parse(http.request(request).body)
  error body['message'] if body['status'] == 'fail'
  info :done, body['build_url']
end

Private Instance Methods

bool(obj) click to toggle source
# File lib/dpl/providers/testfairy.rb, line 85
def bool(obj)
  unless obj.nil?
    obj ? 'on' : 'off'
  end
end
changelog() click to toggle source
# File lib/dpl/providers/testfairy.rb, line 61
def changelog
  git_log "--pretty=oneline --abbrev-commit #{commits}" if commits
end
commits() click to toggle source
# File lib/dpl/providers/testfairy.rb, line 65
def commits
  ENV['TRAVIS_COMMIT_RANGE']
end
file(path) click to toggle source
# File lib/dpl/providers/testfairy.rb, line 81
def file(path)
  UploadIO.new(path, '', File.basename(path)) if path
end
http() click to toggle source
# File lib/dpl/providers/testfairy.rb, line 73
def http
  Net::HTTP.start(uri.host, uri.port, use_ssl: true)
end
params() click to toggle source
# File lib/dpl/providers/testfairy.rb, line 48
def params
  @params ||= compact(
    'api_key': api_key,
    'apk_file': file(app_file),
    'symbols_file': file(symbols_file),
    'testers-groups': testers_groups,
    'notify': bool(notify),
    'auto-update': bool(auto_update),
    'advanced-options': advanced_options,
    'changelog': changelog
  )
end
pretty_print(params) click to toggle source
# File lib/dpl/providers/testfairy.rb, line 91
def pretty_print(params)
  params = params.map do |key, value|
    value = obfuscate(value) if key == :api_key
    value = value.path if value.respond_to?(:path)
    [key, value]
  end
  JSON.pretty_generate(params.to_h)
end
request() click to toggle source
# File lib/dpl/providers/testfairy.rb, line 69
def request
  Net::HTTP::Post::Multipart.new(uri.path, params, 'User-Agent' => UA)
end
uri() click to toggle source
# File lib/dpl/providers/testfairy.rb, line 77
def uri
  @uri ||= URI.parse(URL)
end