module Pushbullet::API

Public Instance Methods

devices() click to toggle source
# File lib/pushbullet/api.rb, line 3
def devices
  get('/api/devices')
end
push_address(device_id, title, address) click to toggle source
# File lib/pushbullet/api.rb, line 15
def push_address(device_id, title, address)
  push :address, device_id, title: title, address: address
end
push_file(device_id, file_path) click to toggle source
# File lib/pushbullet/api.rb, line 23
def push_file(device_id, file_path)
  mime_type = MIME::Types.type_for(file_path).first.to_s
  io        = Faraday::UploadIO.new(file_path, mime_type)

  push :file, device_id, file: io
end
push_list(device_id, title, items) click to toggle source
# File lib/pushbullet/api.rb, line 19
def push_list(device_id, title, items)
  push :list, device_id, title: title, items: items
end
push_note(device_id, title, body) click to toggle source
# File lib/pushbullet/api.rb, line 7
def push_note(device_id, title, body)
  push :note, device_id, title: title, body: body
end

Private Instance Methods

push(type, device_id, payload) click to toggle source
# File lib/pushbullet/api.rb, line 32
def push(type, device_id, payload)
  post '/api/pushes', payload.merge(device_id: device_id, type: type)
end