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.3.1 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.3.0 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.9 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.8 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.7 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.6 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.5 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.4 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.3 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.2 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.1 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.2.0 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.1.9 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.1.8 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.1.7 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.1.6 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.1.5 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.1.4 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.1.3 lib/cocoapods-fy-bin/helpers/remote_helper.rb
cocoapods-fy-bin-0.1.2 lib/cocoapods-fy-bin/helpers/remote_helper.rb