Module: NRRC::Routes::Helpers

Instance Method Summary collapse

Instance Method Details

#create_action(with, params = {}) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# 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 = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# 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 = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# 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 = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# 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) ⇒ Object



11
12
13
# File 'lib/new_relic_rest_client/route_helpers.rb', line 11

def url id
	"#{@url_base}/%s" % [id]
end