Sha256: f9542d7ae003a76443f25214a39960f9ef4487214510e692763551c90821cfe5

Contents?: true

Size: 800 Bytes

Versions: 5

Compression:

Stored size: 800 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)
      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

5 entries across 5 versions & 1 rubygems

Version Path
popito-0.0.11.alpha lib/popito/deployer/client/client_base.rb
popito-0.0.10.alpha lib/popito/deployer/client/client_base.rb
popito-0.0.9.alpha lib/popito/deployer/client/client_base.rb
popito-0.0.8.alpha lib/popito/deployer/client/client_base.rb
popito-0.0.7.alpha lib/popito/deployer/client/client_base.rb