Class: Aubergine::Device

Inherits:
Struct
  • Object
show all
Defined in:
lib/aubergine/device.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#enableObject

Returns the value of attribute enable

Returns:

  • (Object)

    the current value of enable



2
3
4
# File 'lib/aubergine/device.rb', line 2

def enable
  @enable
end

#ipObject

Returns the value of attribute ip

Returns:

  • (Object)

    the current value of ip



2
3
4
# File 'lib/aubergine/device.rb', line 2

def ip
  @ip
end

#loginObject

Returns the value of attribute login

Returns:

  • (Object)

    the current value of login



2
3
4
# File 'lib/aubergine/device.rb', line 2

def 
  @login
end

#passwordObject

Returns the value of attribute password

Returns:

  • (Object)

    the current value of password



2
3
4
# File 'lib/aubergine/device.rb', line 2

def password
  @password
end

#vendorObject

Returns the value of attribute vendor

Returns:

  • (Object)

    the current value of vendor



2
3
4
# File 'lib/aubergine/device.rb', line 2

def vendor
  @vendor
end

Class Method Details

.build(hash) ⇒ Object



3
4
5
# File 'lib/aubergine/device.rb', line 3

def self.build(hash)
  new(hash[:ip], hash[:vendor], hash[:login], hash[:password], hash[:enable])
end

Instance Method Details

#to_json(*a) ⇒ Object



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

def to_json(*a)
  to_map.to_json(*a)
end

#to_mapObject



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

def to_map
  map = Hash.new
  self.members.each { |m| map[m] = self[m] if self[m] }
  map
end