Class: Fritzbox::Smarthome::Resource
- Inherits:
-
Object
- Object
- Fritzbox::Smarthome::Resource
- Defined in:
- lib/fritzbox/smarthome/resource.rb
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.get(command:, ain: nil, param: nil, **params) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fritzbox/smarthome/resource.rb', line 6 def get(command:, ain: nil, param: nil, **params) url = "#{config.endpoint}/webservices/homeautoswitch.lua?switchcmd=#{command}&sid=#{authenticate}" url = "#{url}&ain=#{ain}" if ain.present? url = "#{url}¶m=#{param}" if param.present? params.each_with_object(url) do |(key, value)| url = "#{url}&#{key}=#{value}" end config.logger.debug(url) HTTParty.get(url, **) end |
.parse(response) ⇒ Object
20 21 22 |
# File 'lib/fritzbox/smarthome/resource.rb', line 20 def parse(response) nori.parse(response.body) end |