Class: Resourceful::Agent::RestClient
- Inherits:
-
Base
- Object
- Base
- Resourceful::Agent::RestClient
show all
- Defined in:
- lib/resourceful/agent/rest_client.rb
Constant Summary
Constants inherited
from Base
Base::ATTRS
Instance Attribute Summary
Attributes inherited from Base
#cache, #expiration, #log_prefix, #logger
Instance Method Summary
collapse
-
#delete(path, opts = {}, body = nil, &block) ⇒ Object
-
#get(path, opts = {}, &block) ⇒ Object
-
#initialize(args = {}) ⇒ RestClient
constructor
A new instance of RestClient.
-
#post(path, opts = {}, body = nil, &block) ⇒ Object
-
#put(path, opts = {}, body = nil, &block) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ RestClient
Returns a new instance of RestClient.
9
10
11
12
13
|
# File 'lib/resourceful/agent/rest_client.rb', line 9
def initialize(args={})
super(args)
self.log = ::RestClient.log = yield if block_given?
@rest_client = ::RestClient::Resource.new(@host, :user => @user, :password => @password)
end
|
Instance Method Details
#delete(path, opts = {}, body = nil, &block) ⇒ Object
27
28
29
|
# File 'lib/resourceful/agent/rest_client.rb', line 27
def delete(path, opts={}, body=nil, &block)
push_resource(:delete, path, opts, body, block)
end
|
#get(path, opts = {}, &block) ⇒ Object
15
16
17
|
# File 'lib/resourceful/agent/rest_client.rb', line 15
def get(path, opts={}, &block)
call_resource(:get, path, opts, block)
end
|
#post(path, opts = {}, body = nil, &block) ⇒ Object
19
20
21
|
# File 'lib/resourceful/agent/rest_client.rb', line 19
def post(path, opts={}, body=nil, &block)
push_resource(:post, path, opts, body, block)
end
|
#put(path, opts = {}, body = nil, &block) ⇒ Object
23
24
25
|
# File 'lib/resourceful/agent/rest_client.rb', line 23
def put(path, opts={}, body=nil, &block)
push_resource(:put, path, opts, body, block)
end
|