Sha256: e823fb37516fbcb4d56fe9da0d9cf765c837d73e1d3df094cfeed4e299513ef1

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

module Xploy
  class Api
    class Endpoints
      def list options={}
        Request.new 'get', '/applications'
      end

      def create options={}
        Request.new 'post', '/applications', options
      end

      def find options={}
        Request.new 'get', "/applications/#{extract(options, :name)}"
      end

      def update options={}
        Request.new 'put', "/applications/#{extract(options, :name)}"
      end

      def delete options={}
        Request.new 'delete', "/applications/#{extract(options, :name)}"
      end

      def log options={}
        Request.new 'get', "/applications/#{extract(options, :name)}/log"
      end

      def start options={}
        Request.new 'post', "/applications/#{extract(options, :name)}/start"
      end

      def stop options={}
        Request.new 'post', "/applications/#{extract(options, :name)}/stop"
      end

      def restart options={}
        Request.new 'post', "/applications/#{extract(options, :name)}/restart"
      end

      def redeploy options={}
        Request.new 'post', "/applications/#{extract(options, :name)}/redeploy"
      end

    private

      def extract options, key
        if !options.is_a?(Hash) || options[key] == nil || options[key] == ''
          raise MissingParameter, "Missing app parameter '#{key}'"
        else
          options[key]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xploy-0.1.1.beta lib/xploy/api/endpoints.rb