Module: PushbulletRuby::Request

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

Instance Method Summary collapse

Instance Method Details

#delete(path) ⇒ Object



11
12
13
# File 'lib/pushbullet_ruby/request.rb', line 11

def delete(path)
  request(:delete, path)
end

#get(path, parms = {}) ⇒ Object



3
4
5
# File 'lib/pushbullet_ruby/request.rb', line 3

def get(path, parms = {})
  request(:get, path, parms)
end

#post(path, payload) ⇒ Object



7
8
9
# File 'lib/pushbullet_ruby/request.rb', line 7

def post(path, payload)
  request(:post, path, payload)
end

#request(method, path, params = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/pushbullet_ruby/request.rb', line 15

def request(method, path, params = {})
  connection.send(method) do |request|
    request.url path
    request.params = params if method == :get
    request.body = params if method == :post
  end
end