Class: Shenzhen::Plugins::TestFairy::Client
- Inherits:
-
Object
- Object
- Shenzhen::Plugins::TestFairy::Client
- Defined in:
- lib/shenzhen/plugins/testfairy.rb
Constant Summary collapse
- HOSTNAME =
'app.testfairy.com'
Instance Method Summary collapse
-
#initialize(api_key) ⇒ Client
constructor
A new instance of Client.
- #upload_build(ipa, options) ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/shenzhen/plugins/testfairy.rb', line 11 def initialize(api_key) @api_key = api_key @connection = Faraday.new(:url => "https://#{HOSTNAME}") do |builder| builder.request :multipart builder.request :url_encoded builder.response :json, :content_type => /\bjson$/ builder.use FaradayMiddleware::FollowRedirects builder.adapter :net_http end end |
Instance Method Details
#upload_build(ipa, options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/shenzhen/plugins/testfairy.rb', line 22 def upload_build(ipa, ) [:file] = Faraday::UploadIO.new(ipa, 'application/octet-stream') if ipa and File.exist?(ipa) if symbols_file = .delete(:symbols_file) [:symbols_file] = Faraday::UploadIO.new(symbols_file, 'application/octet-stream') end @connection.post do |req| req.url("/api/upload/") req.body = end.on_complete do |env| yield env[:status], env[:body] if block_given? end end |