Class: PushbulletRuby::Device

Inherits:
Entity
  • Object
show all
Defined in:
lib/pushbullet_ruby/device.rb

Instance Attribute Summary

Attributes inherited from Entity

#body

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#created, #initialize, #modified

Constructor Details

This class inherits a constructor from PushbulletRuby::Entity

Class Method Details

.from_responce(response) ⇒ Object



6
7
8
9
10
11
# File 'lib/pushbullet_ruby/device.rb', line 6

def self.from_responce(response)
  response.body['devices'].each_with_object([]) do |attributes, memo|
    next unless attributes['active']
    memo << new(attributes)
  end
end

Instance Method Details

#app_versionObject



25
26
27
# File 'lib/pushbullet_ruby/device.rb', line 25

def app_version
  body['app_version']
end

#idObject



17
18
19
# File 'lib/pushbullet_ruby/device.rb', line 17

def id
  body['iden']
end

#nameObject



21
22
23
# File 'lib/pushbullet_ruby/device.rb', line 21

def name
  body['nickname']
end

#update(client: nil, params: {}) ⇒ Object



13
14
15
# File 'lib/pushbullet_ruby/device.rb', line 13

def update(client: nil, params: {})
  client.update_device(device_id: self.id, params: params)
end