Class: Syncthing::Helper::API::Config

Inherits:
OpenStruct
  • Object
show all
Includes:
Roar::Client, Roar::JSON
Defined in:
lib/syncthing/helper/api/config.rb

Instance Method Summary collapse

Instance Method Details

#connect(syncthing_uri: nil, syncthing_api_key: nil) ⇒ Object



14
15
16
17
# File 'lib/syncthing/helper/api/config.rb', line 14

def connect syncthing_uri: nil, syncthing_api_key: nil
  @opts = {uri: URI(syncthing_uri) + 'rest/system/config', as: 'application/json'}
  @syncthing_api_key = syncthing_api_key
end

#retrieveObject



19
20
21
# File 'lib/syncthing/helper/api/config.rb', line 19

def retrieve
  get(@opts) { |r| auth(r) }
end

#updateObject



23
24
25
# File 'lib/syncthing/helper/api/config.rb', line 23

def update
  post(@opts) { |r| auth(r) }
end