Class: Nuker::RestResource
- Inherits:
-
Object
- Object
- Nuker::RestResource
- Extended by:
- Forwardable
- Defined in:
- lib/nuker/rest_resource.rb
Instance Method Summary collapse
- #delete(path) ⇒ Object
-
#initialize(url, options) ⇒ RestResource
constructor
A new instance of RestResource.
- #post(path, *args) ⇒ Object
- #post_tar_gz(path, tar_gz_data) ⇒ Object
Constructor Details
#initialize(url, options) ⇒ RestResource
Returns a new instance of RestResource.
9 10 11 |
# File 'lib/nuker/rest_resource.rb', line 9 def initialize(url, ) @resource = RestClient::Resource.new(url, ) end |
Instance Method Details
#delete(path) ⇒ Object
25 26 27 |
# File 'lib/nuker/rest_resource.rb', line 25 def delete(path) with_rescue { resource[path].delete } end |
#post(path, *args) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/nuker/rest_resource.rb', line 17 def post(path, *args) if args.empty? with_rescue { resource[path].post({}) } else with_rescue { resource[path].post(*args) } end end |
#post_tar_gz(path, tar_gz_data) ⇒ Object
13 14 15 |
# File 'lib/nuker/rest_resource.rb', line 13 def post_tar_gz(path, tar_gz_data) post(path, tar_gz_data, :content_type => 'application/x-gzip') end |