Sha256: 676487f80d5ce98453a85b2a339193a32d39fe03724efe50e7523ea4f65fdd7f
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
require 'rest-client' class Remote def initialize if ENV['FLUTTER_BINARY_SERVER_BASEURL'].nil? raise StandardError, "Need 'FLUTTER_BINARY_SERVER_BASEURL' in env" end @base_url = ENV['FLUTTER_BINARY_SERVER_BASEURL'] end def exist?(name, version, tag) uri = URI.join @base_url, "/frameworks/exit/#{name}/#{version}/#{tag}" resp = RestClient.get(uri.to_s) json = JSON.parse(resp.body) json["data"] end def delete(name, version, tag) uri = URI.join @base_url, "/frameworks/#{name}/#{version}/#{tag}" resp = RestClient.delete uri.to_s json = JSON.parse(resp.body) json["status"]['code'] == 0 end def upload(name, version, tag, file) uri = URI.join @base_url, "/frameworks" resp = RestClient.post(uri.to_s, { file: File.new(file, 'rb'), name: name, version: version, tag: tag }) json = JSON.parse(resp.body) @base_url + json["data"]['download_url'] end def download_url(name, version, tag) uri = URI.join @base_url, "/frameworks/#{name}/#{version}/#{tag}" resp = RestClient.get uri.to_s json = JSON.parse(resp.body) @base_url + json["data"]['download_url'] end end
Version data entries
15 entries across 15 versions & 1 rubygems