Class: Prtg::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/prtg/query.rb

Overview

Proxy class to caspule request

Constant Summary collapse

VALUES =

This single values for the query. They are pretty much like sql.

content is like a table count is like LIMIT start is like OFFSET

[:count, :start, :output, :objid]
MULTIPLE_VALUES =
[:columns]

Instance Method Summary collapse

Constructor Details

#initialize(client, content) ⇒ Query

Returns a new instance of Query.



9
10
11
12
13
14
# File 'lib/prtg/query.rb', line 9

def initialize(client, content)
  @prtg_client = client
  @query_hash = {}
  @query_hash[:output]  = :xml
  @query_hash[:content] = content
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object (private)



51
52
53
54
55
56
57
# File 'lib/prtg/query.rb', line 51

def method_missing(*args, &block)
  if args.first.to_s.start_with? "filter"
    add_filter(*args)
  else
    execute.send(*args, &block)
  end
end

Instance Method Details

#executeObject



40
41
42
# File 'lib/prtg/query.rb', line 40

def execute
  @prtg_client.api_request(@query_hash)
end