Module: Washbullet::API::Pushes

Included in:
Washbullet::API
Defined in:
lib/washbullet/api/pushes.rb

Instance Method Summary collapse

Instance Method Details

#delete_push(push_iden) ⇒ Object



41
42
43
# File 'lib/washbullet/api/pushes.rb', line 41

def delete_push(push_iden)
  delete "/v2/pushes/#{push_iden}"
end

#push_address(device_iden, name, address) ⇒ Object



12
13
14
# File 'lib/washbullet/api/pushes.rb', line 12

def push_address(device_iden, name, address)
  push :address, device_iden, name: name, address: address
end

#push_file(device_iden, file_name, file_path, body) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/washbullet/api/pushes.rb', line 20

def push_file(device_iden, file_name, file_path, body)
  upload_file(file_name, file_path) do |data|
    payload = {
      file_name: data['file_name'],
      file_type: data['file_type'],
      file_url:  data['file_url'],
      body:      body
    }

    push :file, device_iden, payload
  end
end


8
9
10
# File 'lib/washbullet/api/pushes.rb', line 8

def push_link(device_iden, title, url, body)
  push :link, device_iden, title: title, url: url, body: body
end

#push_list(device_iden, title, items) ⇒ Object



16
17
18
# File 'lib/washbullet/api/pushes.rb', line 16

def push_list(device_iden, title, items)
  push :list, device_iden, title: title, items: items
end

#push_note(device_iden, title, body) ⇒ Object



4
5
6
# File 'lib/washbullet/api/pushes.rb', line 4

def push_note(device_iden, title, body)
  push :note, device_iden, title: title, body: body
end

#pushes(modified_after = nil, cursor = nil) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/washbullet/api/pushes.rb', line 33

def pushes(modified_after = nil, cursor = nil)
  params = {modified_after: modified_after, cursor: cursor}

  params = params.values.all?(&:nil?) ? {} : params

  get 'v2/pushes', params
end