Class: Build47
- Inherits:
-
Object
- Object
- Build47
- Defined in:
- lib/build_47.rb
Overview
Do the work of uploading to to the App47 server using API V1
Class Method Summary collapse
-
.api_v1_upload(options) ⇒ Object
Perform the upload to the server.
-
.load_file(options) ⇒ Object
Load file for processing, making sure it exists.
Class Method Details
.api_v1_upload(options) ⇒ Object
Perform the upload to the server
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/build_47.rb', line 11 def self.api_v1_upload() app_id = .delete(:app_id) token = .delete(:token) load_file() RestClient::Request.execute(method: :post, url: "https://cirrus.app47.com/api/apps/#{app_id}/builds", payload: { multipart: true, build: }, headers: { accept: 'application/json', 'X-Token': token }, raw_response: true) do |response| puts "response code: #{response.code}" end end |
.load_file(options) ⇒ Object
Load file for processing, making sure it exists
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/build_47.rb', line 31 def self.load_file() file_path = .delete(:path) raise "File not found: #{file_path}" unless File.exist?(file_path) [:build_upload] = File.new(file_path, 'rb') extension = file_path.split('.').last [:platform] = case extension when 'ipa' 'iOS' when 'apk' 'Android' else 'Windows' end end |