Module: Gifnoc::RecordAPIMethods

Included in:
API
Defined in:
lib/gifnoc/apis/record_api_methods.rb

Instance Method Summary collapse

Instance Method Details

#create_record(namespace_uuid, record_hash) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/gifnoc/apis/record_api_methods.rb', line 18

def create_record(namespace_uuid, record_hash)
	options = {body: record_hash.to_json}
	options = options.merge(@options)
	return with_response_handling do
		self.class.post("/namespaces/#{namespace_uuid}/records", options)
	end
end

#delete_record(namespace_uuid, record_key) ⇒ Object



34
35
36
37
38
# File 'lib/gifnoc/apis/record_api_methods.rb', line 34

def delete_record(namespace_uuid, record_key)
	return with_response_handling do
		self.class.delete("/namespaces/#{namespace_uuid}/records/#{URI.escape(record_key)}", @options)
	end
end

#get_record(namespace_uuid, record_key) ⇒ Object



12
13
14
15
16
# File 'lib/gifnoc/apis/record_api_methods.rb', line 12

def get_record(namespace_uuid, record_key)
	return with_response_handling do
		self.class.get("/namespaces/#{namespace_uuid}/records/#{URI.escape(record_key)}", @options)
	end
end

#list_records(namespace_uuid) ⇒ Object



6
7
8
9
10
# File 'lib/gifnoc/apis/record_api_methods.rb', line 6

def list_records(namespace_uuid)
	return with_response_handling do
		self.class.get("/namespaces/#{namespace_uuid}/records", @options)
	end
end

#update_record(namespace_uuid, record_key, record_hash) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/gifnoc/apis/record_api_methods.rb', line 26

def update_record(namespace_uuid, record_key, record_hash)
	options = {body: record_hash.to_json}
	options = options.merge(@options)
	return with_response_handling do
		self.class.put("/namespaces/#{namespace_uuid}/records/#{URI.escape(record_key)}", options)
	end
end