Sha256: 596d3d05bf437ebe76ac8a97aed8ab4edc9138e842baaa8f54c96f7edd162b21

Contents?: true

Size: 676 Bytes

Versions: 5

Compression:

Stored size: 676 Bytes

Contents

require 'rest-client'
require 'json'
require 'minitar'
module Popito
  class ClientBase
    API_HOST = 'http://localhost:3000'.freeze
    attr_accessor :config_payload

    def initialize(config_payload:)
      self.config_payload = config_payload
    end

    private

    def parse_error(err)
      JSON.parse(err.response.body)["message"]
    rescue StandardError
      "An error has been occurred."
    end

    def extract_tgz(body)
      Minitar.unpack(Zlib::GzipReader.new(StringIO.new(body)), config_payload.project_path)
    end

    def default_headers
      { 'X-Client-Version': Popito::VERSION, 'X-Project-Token': config_payload.project_token }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
popito-0.0.5.alpha lib/popito/deployer/client/client_base.rb
popito-0.0.4.alpha lib/popito/deployer/client/client_base.rb
popito-0.0.3.alpha lib/popito/deployer/client/client_base.rb
popito-0.0.2.alpha lib/popito/deployer/client/client_base.rb
popito-0.0.1.alpha lib/popito/deployer/client/client_base.rb