class Syncthing::Helper::API::Config

Public Instance Methods

connect(syncthing_uri: nil, syncthing_api_key: nil) click to toggle source
# 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
retrieve() click to toggle source
# File lib/syncthing/helper/api/config.rb, line 19
def retrieve
  get(@opts) { |r| auth(r) }
end
update() click to toggle source
# File lib/syncthing/helper/api/config.rb, line 23
def update
  post(@opts) { |r| auth(r) }
end

Private Instance Methods

auth(r) click to toggle source
# File lib/syncthing/helper/api/config.rb, line 28
def auth r
  r.add_field('X-API-Key', @syncthing_api_key)
end