To create a database, simply define a new instance of PocketDatabase. It will automatically create a new database.
require "pocketdb"
pdb = PocketDatabase.new
token = pdb.token
puts "Token: #{token}"To prevent losing your data, please keep the database token, which can be obtained with the token method.
Alternatively, if you want to use an existing database, simply pass the token on the initialization.
require "pocketdb"
pdb = PocketDatabase.new(token: "Your token here...")If that database does not exist, an error will be raised.
To list all the created records, use the records() method. This method will return a list of string, which is all the record keys.
Please take note that this method will also include the deleted records.
require "pocketdb"
pdb = PocketDatabase.new(token: "Your token here...")
puts pdb.records.inspect