Sha256: f1d8545b92db6fc37afa199851d0b5af0c8200acab737dc5904ddcb528fbc13b

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

require 'rest-client'
require 'json'
require 'minitar'
require 'byebug'
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)
      info=JSON.parse(err.response.body)
      puts "Message: " + info["message"]
      puts ("Debug:\n" + info["debug_data"]) if info["debug_data"]
      info["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

1 entries across 1 versions & 1 rubygems

Version Path
popito-0.0.6.alpha lib/popito/deployer/client/client_base.rb