Sha256: 76e0c681015e7571f13842e10f5f311bc8a39dfbd40acb837b4c3a985011ff08

Contents?: true

Size: 1.2 KB

Versions: 27

Compression:

Stored size: 1.2 KB

Contents

require 'rest-client'

module CBin
  class Remote
    class Helper
      def initialize
        @base_url = CBin.config.binary_upload_url
      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
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
cocoapods-fy-bin-0.1.1 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.1.0 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.0.9 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.0.8 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.0.7 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.0.6 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.0.5 lib/cocoapods-fy-bin/helpers/remote_helper.rb