Class: PogoPlug::Device

Inherits:
Object
  • Object
show all
Includes:
HashInitializer
Defined in:
lib/pogoplug/device.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from HashInitializer

#initialize

Instance Attribute Details

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/pogoplug/device.rb', line 5

def id
  @id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/pogoplug/device.rb', line 5

def name
  @name
end

#servicesObject

Returns the value of attribute services.



5
6
7
# File 'lib/pogoplug/device.rb', line 5

def services
  @services
end

Class Method Details

.from_json(json) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/pogoplug/device.rb', line 11

def self.from_json(json)
  device = Device.new(name: json['name'], id: json['deviceid'])
  json['services'].each do |s|
    device.services << Service.from_json(s)
  end
  device
end