Class: Belphanior::Servant::HomeNetwork::Insteon_2412n_Marshaller

Inherits:
Object
  • Object
show all
Defined in:
lib/belphanior/servant/homenetwork/insteon_2412n_marshaller.rb

Defined Under Namespace

Classes: ConnectionFailure

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, network_class = nil) ⇒ Insteon_2412n_Marshaller

Returns a new instance of Insteon_2412n_Marshaller.



11
12
13
14
15
16
17
18
# File 'lib/belphanior/servant/homenetwork/insteon_2412n_marshaller.rb', line 11

def initialize(host, network_class=nil)
  @host = host
  if network_class
    @network_class = network_class
  else
    @network_class = Net::HTTP
  end
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



8
9
10
# File 'lib/belphanior/servant/homenetwork/insteon_2412n_marshaller.rb', line 8

def host
  @host
end

Instance Method Details

#send(command) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/belphanior/servant/homenetwork/insteon_2412n_marshaller.rb', line 19

def send(command)
  @network_class.start(@host, 80) {|http|
    # I don't know what the prefix and suffix here mean;
    # they were determined empirically by examining the output
    # from the 2412N's built-in web GUI
    http.post("/3?"+command+"=I=3", "")
  }
end