Module: Mattermost::Request

Included in:
Client
Defined in:
lib/mattermost/request.rb

Instance Method Summary collapse

Instance Method Details

#delete(path, options = {}, &block) ⇒ Object



28
29
30
31
32
33
# File 'lib/mattermost/request.rb', line 28

def delete(path, options = {}, &block)
	connection.send(:delete) do |request|
		request.path = api(path)
		request.body = options[:body] if options.key? :body
	end
end

#get(path, options = {}, &block) ⇒ Object



7
8
9
10
11
12
# File 'lib/mattermost/request.rb', line 7

def get(path, options = {}, &block)
	puts "get #{path}, #{options}"
	connection.send(:get) do |request|
		request.url api(path), options
	end
end

#post(path, options = {}, &block) ⇒ Object



14
15
16
17
18
19
# File 'lib/mattermost/request.rb', line 14

def post(path, options = {}, &block)
	connection.send(:post) do |request|
		request.path = api(path)
		request.body = options[:body] if options.key? :body
	end
end

#put(path, options = {}, &block) ⇒ Object



21
22
23
24
25
26
# File 'lib/mattermost/request.rb', line 21

def put(path, options = {}, &block)
	connection.send(:put) do |request|
		request.path = api(path)
		request.body = options[:body] if options.key? :body
	end
end