module Syncthing::Helper::API

Attributes

firestore[RW]

Public Class Methods

api_key_from_xml(xml_file) click to toggle source
# File lib/syncthing/helper/api.rb, line 30
def api_key_from_xml xml_file
  Xml::Config.from_xml(rio(xml_file).expand_path.read).gui.apikey
end
init_firestore(project_id: nil, credentials: nil) click to toggle source
# File lib/syncthing/helper/api.rb, line 21
def init_firestore project_id: nil, credentials: nil
  @firestore ||= Google::Cloud::Firestore.new project_id: project_id, credentials: credentials
  const_set :Firestore, @firestore
  const_set :DB_FIELDS, {'devices' => [:device_id, :label],
                         'folders' => [:id, :path, :label]}
  const_set :DB_FIELDS_CONFIG_OBJ, {'devices' => 'deviceID',
                            'folders' => 'id'}
end