Sha256: 9cb3cfb6c784fdbdc75ab20b9d82afdbaefdd8e93f6d59deb86ee246509d536c

Contents?: true

Size: 974 Bytes

Versions: 1

Compression:

Stored size: 974 Bytes

Contents

class ZabbixApi
  class Applications

    def initialize(options = {})
      @client = Client.new(options)
      @options = options
    end

    def create(data)
      result = @client.api_request(:method => "application.create", :params => [data])
      result.empty? ? nil : result['applicationids'][0].to_i
    end

    def add(data)
      create(data)
    end

    def delete(data)
      result = @client.api_request(:method => "application.delete", :params => [data])
      result.empty? ? nil : result['applicationids'][0].to_i
    end

    def destroy(data)
      delete(data)
    end

    def get_full_data(data)
      @client.api_request(:method => "application.get", :params => {:filter => data, :output => "extend"})
    end

    def get_id(data)
      result = get_full_data(data)
      applicationid = nil
      result.each do |app|
        applicationid = app['applicationid'].to_i if app['name'] == data[:name]
      end
      applicationid
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zabbixapi-0.4.2 lib/zabbixapi/applications.rb