module NRRC::Routes::Helpers
Public Instance Methods
create_action(with,params={})
click to toggle source
# File lib/new_relic_rest_client/route_helpers.rb, line 49 def create_action with,params={} action = deep_copy({ method: :post, headers: { :"X-Api-Key" => Routes.api_key, content_type: :json, } }).update(with) action[:headers].update(params: params) make_request(action) end
delete_action(with,params={})
click to toggle source
# File lib/new_relic_rest_client/route_helpers.rb, line 38 def delete_action with,params={} action = deep_copy({ method: :delete, headers: { :"X-Api-Key" => Routes.api_key } }).update(with) action[:headers].update(params: params) make_request(action) end
get_action(with,params={})
click to toggle source
# File lib/new_relic_rest_client/route_helpers.rb, line 15 def get_action with,params={} action = deep_copy({ method: :get, headers: { :"X-Api-Key" => Routes.api_key } }).update(with) action[:headers].update(params: params) make_request(action) end
put_action(with,params={})
click to toggle source
# File lib/new_relic_rest_client/route_helpers.rb, line 26 def put_action with,params={} action = deep_copy({ method: :put, headers: { :"X-Api-Key" => Routes.api_key, content_type: :json, } }).update(with) action[:headers].update(params: params) make_request(action) end
url(id)
click to toggle source
# File lib/new_relic_rest_client/route_helpers.rb, line 11 def url id "#{@url_base}/%s" % [id] end
Private Instance Methods
deep_copy(object)
click to toggle source
# File lib/new_relic_rest_client/route_helpers.rb, line 66 def deep_copy(object) Marshal.load(Marshal.dump(object)) end
make_request(request_hash)
click to toggle source
# File lib/new_relic_rest_client/route_helpers.rb, line 62 def make_request request_hash ::RestClient::Request.execute request_hash end