Module: Wemote::XML

Defined in:
lib/wemote/xml.rb

Constant Summary collapse

TEMPLATES =
{
  get_binary_state: File.read(File.join(xml_path,'get_binary_state.xml')),
  set_binary_state: File.read(File.join(xml_path,'set_binary_state.xml')),
  get_insight_params: File.read(File.join(xml_path,'get_insight_params.xml'))
}

Class Method Summary collapse

Class Method Details

.get_binary_stateString

Returns The required XML body for a Wemo binary state request.

Returns:

  • (String)

    The required XML body for a Wemo binary state request



12
13
14
# File 'lib/wemote/xml.rb', line 12

def get_binary_state
  TEMPLATES[:get_binary_state]
end

.get_insight_paramsObject



22
23
24
# File 'lib/wemote/xml.rb', line 22

def get_insight_params
  TEMPLATES[:get_insight_params]
end

.set_binary_state(state) ⇒ String

Returns The required XML body for a Wemo binary state set request.

Parameters:

  • state (Integer)

    Either 1 or 0, for off and on respectively

Returns:

  • (String)

    The required XML body for a Wemo binary state set request



18
19
20
# File 'lib/wemote/xml.rb', line 18

def set_binary_state(state)
  TEMPLATES[:set_binary_state].gsub("{{1}}",state.to_s)
end