10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/fritzbox/smarthome/resource.rb', line 10
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
response = measure(url) { HTTParty.get(url, **httparty_options) }
raise AuthenticationError if response.code == 403
response
rescue AuthenticationError
raise if session.nil?
self.session = nil
retry
end
|