Class: Munson::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/munson/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
16
# File 'lib/munson/client.rb', line 11

def initialize(opts={})
  opts.each do |k,v|
    setter = "#{k}="
    send(setter,v) if respond_to?(setter)
  end
end

Instance Attribute Details

#pathObject



26
27
28
# File 'lib/munson/client.rb', line 26

def path
  @path || "/#{type}"
end

#query_builder=(value) ⇒ Object (writeonly)

Sets the attribute query_builder

Parameters:

  • value

    the value to set the attribute query_builder to.



8
9
10
# File 'lib/munson/client.rb', line 8

def query_builder=(value)
  @query_builder = value
end

#typeObject

Returns the value of attribute type.



9
10
11
# File 'lib/munson/client.rb', line 9

def type
  @type
end

Instance Method Details

#agentObject



22
23
24
# File 'lib/munson/client.rb', line 22

def agent
  Agent.new(path, connection: connection)
end

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



30
31
32
33
# File 'lib/munson/client.rb', line 30

def configure(&block)
  yield(self)
  self
end

#connectionObject



35
36
37
# File 'lib/munson/client.rb', line 35

def connection
  @connection ||= Munson.default_connection.clone
end

#connection=(connection) ⇒ Object



39
40
41
# File 'lib/munson/client.rb', line 39

def connection=(connection)
  @connection = connection
end

#queryObject



18
19
20
# File 'lib/munson/client.rb', line 18

def query
  (@query_builder || Query).new(self)
end