From 6dcecdfbf511f93b84edec2cd788241a867f7436 Mon Sep 17 00:00:00 2001 From: jackharrhy Date: Wed, 9 Sep 2020 02:51:48 +0000 Subject: [PATCH] Deploy to GitHub pages --- CrystalLogHandler.html | 677 ++++++++++ StackCoin.html | 571 ++++++++ StackCoin/Api.html | 671 +++++++++ StackCoin/Api/Auth.html | 748 ++++++++++ StackCoin/Api/Auth/AuthPostBody.html | 723 ++++++++++ StackCoin/Api/Context.html | 699 ++++++++++ StackCoin/Api/Ledger.html | 748 ++++++++++ StackCoin/Api/Ledger/LedgerPostBody.html | 723 ++++++++++ StackCoin/Api/Root.html | 748 ++++++++++ StackCoin/Api/Route.html | 1014 ++++++++++++++ StackCoin/Api/User.html | 748 ++++++++++ StackCoin/Auth.html | 678 ++++++++++ StackCoin/Auth/Result.html | 560 ++++++++ StackCoin/Auth/Result/AccountCreated.html | 765 +++++++++++ StackCoin/Auth/Result/Authenticated.html | 765 +++++++++++ StackCoin/Auth/Result/InvalidAccessToken.html | 680 ++++++++++ StackCoin/Auth/Result/InvalidToken.html | 680 ++++++++++ StackCoin/Auth/Result/NoSuchAccount.html | 680 ++++++++++ StackCoin/Auth/Result/ValidAccessToken.html | 744 ++++++++++ StackCoin/Bank.html | 776 +++++++++++ StackCoin/Bank/Result.html | 560 ++++++++ StackCoin/Bank/Result/BannedUser.html | 680 ++++++++++ StackCoin/Bank/Result/InsufficientFunds.html | 680 ++++++++++ StackCoin/Bank/Result/InvalidAmount.html | 680 ++++++++++ StackCoin/Bank/Result/NoSuchAccount.html | 680 ++++++++++ StackCoin/Bank/Result/PreexistingAccount.html | 680 ++++++++++ StackCoin/Bank/Result/PrematureDole.html | 680 ++++++++++ StackCoin/Bank/Result/TransferSelf.html | 680 ++++++++++ StackCoin/Bank/Result/TransferSuccess.html | 807 +++++++++++ StackCoin/Banned.html | 678 ++++++++++ StackCoin/Bot.html | 798 +++++++++++ StackCoin/Bot/Auth.html | 778 +++++++++++ StackCoin/Bot/Bal.html | 778 +++++++++++ StackCoin/Bot/Ban.html | 778 +++++++++++ StackCoin/Bot/Circulation.html | 778 +++++++++++ StackCoin/Bot/Command.html | 1200 +++++++++++++++++ StackCoin/Bot/Context.html | 783 +++++++++++ StackCoin/Bot/Dole.html | 799 +++++++++++ StackCoin/Bot/Graph.html | 778 +++++++++++ StackCoin/Bot/Help.html | 862 ++++++++++++ StackCoin/Bot/Leaderboard.html | 778 +++++++++++ StackCoin/Bot/Ledger.html | 778 +++++++++++ StackCoin/Bot/Mark.html | 778 +++++++++++ StackCoin/Bot/Open.html | 778 +++++++++++ StackCoin/Bot/Result.html | 550 ++++++++ StackCoin/Bot/Result/Base.html | 607 +++++++++ StackCoin/Bot/Result/Error.html | 569 ++++++++ StackCoin/Bot/Send.html | 778 +++++++++++ StackCoin/Bot/Unban.html | 778 +++++++++++ StackCoin/Config.html | 909 +++++++++++++ StackCoin/Database.html | 719 ++++++++++ StackCoin/DesignatedChannel.html | 678 ++++++++++ StackCoin/Result.html | 566 ++++++++ StackCoin/Result/Base.html | 823 +++++++++++ StackCoin/Result/Error.html | 735 ++++++++++ StackCoin/Result/Success.html | 723 ++++++++++ StackCoin/Statistics.html | 794 +++++++++++ StackCoin/Statistics/Result.html | 550 ++++++++ StackCoin/Statistics/Result/Base.html | 607 +++++++++ StackCoin/Statistics/Result/Error.html | 569 ++++++++ StackCoin/Statistics/Result/Graph.html | 550 ++++++++ StackCoin/Statistics/Result/Graph/Error.html | 636 +++++++++ .../Statistics/Result/Graph/Success.html | 636 +++++++++ StackCoin/Statistics/Result/Report.html | 699 ++++++++++ .../Statistics/Result/Report/Transaction.html | 741 ++++++++++ css/style.css | 726 ++++++++++ index.html | 506 +++++++ index.json | 1 + js/doc.js | 1086 +++++++++++++++ search-index.js | 1 + 70 files changed, 49184 insertions(+) create mode 100644 CrystalLogHandler.html create mode 100644 StackCoin.html create mode 100644 StackCoin/Api.html create mode 100644 StackCoin/Api/Auth.html create mode 100644 StackCoin/Api/Auth/AuthPostBody.html create mode 100644 StackCoin/Api/Context.html create mode 100644 StackCoin/Api/Ledger.html create mode 100644 StackCoin/Api/Ledger/LedgerPostBody.html create mode 100644 StackCoin/Api/Root.html create mode 100644 StackCoin/Api/Route.html create mode 100644 StackCoin/Api/User.html create mode 100644 StackCoin/Auth.html create mode 100644 StackCoin/Auth/Result.html create mode 100644 StackCoin/Auth/Result/AccountCreated.html create mode 100644 StackCoin/Auth/Result/Authenticated.html create mode 100644 StackCoin/Auth/Result/InvalidAccessToken.html create mode 100644 StackCoin/Auth/Result/InvalidToken.html create mode 100644 StackCoin/Auth/Result/NoSuchAccount.html create mode 100644 StackCoin/Auth/Result/ValidAccessToken.html create mode 100644 StackCoin/Bank.html create mode 100644 StackCoin/Bank/Result.html create mode 100644 StackCoin/Bank/Result/BannedUser.html create mode 100644 StackCoin/Bank/Result/InsufficientFunds.html create mode 100644 StackCoin/Bank/Result/InvalidAmount.html create mode 100644 StackCoin/Bank/Result/NoSuchAccount.html create mode 100644 StackCoin/Bank/Result/PreexistingAccount.html create mode 100644 StackCoin/Bank/Result/PrematureDole.html create mode 100644 StackCoin/Bank/Result/TransferSelf.html create mode 100644 StackCoin/Bank/Result/TransferSuccess.html create mode 100644 StackCoin/Banned.html create mode 100644 StackCoin/Bot.html create mode 100644 StackCoin/Bot/Auth.html create mode 100644 StackCoin/Bot/Bal.html create mode 100644 StackCoin/Bot/Ban.html create mode 100644 StackCoin/Bot/Circulation.html create mode 100644 StackCoin/Bot/Command.html create mode 100644 StackCoin/Bot/Context.html create mode 100644 StackCoin/Bot/Dole.html create mode 100644 StackCoin/Bot/Graph.html create mode 100644 StackCoin/Bot/Help.html create mode 100644 StackCoin/Bot/Leaderboard.html create mode 100644 StackCoin/Bot/Ledger.html create mode 100644 StackCoin/Bot/Mark.html create mode 100644 StackCoin/Bot/Open.html create mode 100644 StackCoin/Bot/Result.html create mode 100644 StackCoin/Bot/Result/Base.html create mode 100644 StackCoin/Bot/Result/Error.html create mode 100644 StackCoin/Bot/Send.html create mode 100644 StackCoin/Bot/Unban.html create mode 100644 StackCoin/Config.html create mode 100644 StackCoin/Database.html create mode 100644 StackCoin/DesignatedChannel.html create mode 100644 StackCoin/Result.html create mode 100644 StackCoin/Result/Base.html create mode 100644 StackCoin/Result/Error.html create mode 100644 StackCoin/Result/Success.html create mode 100644 StackCoin/Statistics.html create mode 100644 StackCoin/Statistics/Result.html create mode 100644 StackCoin/Statistics/Result/Base.html create mode 100644 StackCoin/Statistics/Result/Error.html create mode 100644 StackCoin/Statistics/Result/Graph.html create mode 100644 StackCoin/Statistics/Result/Graph/Error.html create mode 100644 StackCoin/Statistics/Result/Graph/Success.html create mode 100644 StackCoin/Statistics/Result/Report.html create mode 100644 StackCoin/Statistics/Result/Report/Transaction.html create mode 100644 css/style.css create mode 100644 index.html create mode 100644 index.json create mode 100644 js/doc.js create mode 100644 search-index.js diff --git a/CrystalLogHandler.html b/CrystalLogHandler.html new file mode 100644 index 0000000..2d94183 --- /dev/null +++ b/CrystalLogHandler.html @@ -0,0 +1,677 @@ + + + + + + + + + + + + + + + + + CrystalLogHandler - stackcoin HEAD + + + + + + + +
+

+ + class CrystalLogHandler + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/log.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(log = ::Log.for("kemal")) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def call(context : HTTP::Server::Context) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def write(message : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin.html b/StackCoin.html new file mode 100644 index 0000000..8643d11 --- /dev/null +++ b/StackCoin.html @@ -0,0 +1,571 @@ + + + + + + + + + + + + + + + + + StackCoin - stackcoin HEAD + + + + + + + +
+

+ + module StackCoin + +

+ + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/const.cr + + +
+ + + + stackcoin/log.cr + + +
+ + + + stackcoin/result.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DEBUG = ENV["DEBUG"]? +
+ + +
+ EPOCH = Time.unix(1574467200) +
+ + +
+ Log = ::Log.for("stackcoin") +
+ + +
+ + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Api.html b/StackCoin/Api.html new file mode 100644 index 0000000..d4b0506 --- /dev/null +++ b/StackCoin/Api.html @@ -0,0 +1,671 @@ + + + + + + + + + + + + + + + + + StackCoin::Api - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Api + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/api.cr + + +
+ + + + stackcoin/routes/auth.cr + + +
+ + + + stackcoin/routes/base.cr + + +
+ + + + stackcoin/routes/ledger.cr + + +
+ + + + stackcoin/routes/root.cr + + +
+ + + + stackcoin/routes/user.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(config : Config, bank : Bank, stats : Statistics, auth : StackCoin::Auth) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def run! + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Api/Auth.html b/StackCoin/Api/Auth.html new file mode 100644 index 0000000..c7b650c --- /dev/null +++ b/StackCoin/Api/Auth.html @@ -0,0 +1,748 @@ + + + + + + + + + + + + + + + + + StackCoin::Api::Auth - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Api::Auth + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/routes/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def setup + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Api/Auth/AuthPostBody.html b/StackCoin/Api/Auth/AuthPostBody.html new file mode 100644 index 0000000..b7a81d0 --- /dev/null +++ b/StackCoin/Api/Auth/AuthPostBody.html @@ -0,0 +1,723 @@ + + + + + + + + + + + + + + + + + StackCoin::Api::Auth::AuthPostBody - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Api::Auth::AuthPostBody + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/routes/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def token : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def token=(token : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def user_id : UInt64 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def user_id=(user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Api/Context.html b/StackCoin/Api/Context.html new file mode 100644 index 0000000..adccf4b --- /dev/null +++ b/StackCoin/Api/Context.html @@ -0,0 +1,699 @@ + + + + + + + + + + + + + + + + + StackCoin::Api::Context - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Api::Context + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/api.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(bank, stats, auth, config) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def auth : StackCoin::Auth + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def bank : Bank + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def config : Config + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def stats : Statistics + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Api/Ledger.html b/StackCoin/Api/Ledger.html new file mode 100644 index 0000000..bef6a2f --- /dev/null +++ b/StackCoin/Api/Ledger.html @@ -0,0 +1,748 @@ + + + + + + + + + + + + + + + + + StackCoin::Api::Ledger - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Api::Ledger + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/routes/ledger.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def setup + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Api/Ledger/LedgerPostBody.html b/StackCoin/Api/Ledger/LedgerPostBody.html new file mode 100644 index 0000000..6fd2d6e --- /dev/null +++ b/StackCoin/Api/Ledger/LedgerPostBody.html @@ -0,0 +1,723 @@ + + + + + + + + + + + + + + + + + StackCoin::Api::Ledger::LedgerPostBody - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Api::Ledger::LedgerPostBody + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/routes/ledger.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def amount : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def amount=(amount : Int32) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_id : UInt64 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_id=(to_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Api/Root.html b/StackCoin/Api/Root.html new file mode 100644 index 0000000..24907f8 --- /dev/null +++ b/StackCoin/Api/Root.html @@ -0,0 +1,748 @@ + + + + + + + + + + + + + + + + + StackCoin::Api::Root - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Api::Root + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/routes/root.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def setup + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Api/Route.html b/StackCoin/Api/Route.html new file mode 100644 index 0000000..d347f32 --- /dev/null +++ b/StackCoin/Api/Route.html @@ -0,0 +1,1014 @@ + + + + + + + + + + + + + + + + + StackCoin::Api::Route - stackcoin HEAD + + + + + + + +
+

+ + abstract class StackCoin::Api::Route + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/routes/base.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.list : Array(Route) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def auth : StackCoin::Auth + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def auth=(auth : StackCoin::Auth) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def bank : Bank + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def bank=(bank : Bank) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def config : Config + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def config=(config : Config) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def info + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def json_error(message) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def requires_auth : Array(String)? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def requires_auth=(requires_auth : Array(String)?) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def routes : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def routes=(routes : Array(String)) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def setup + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def should_return_html(env) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def stats : Statistics + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def stats=(stats : Statistics) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Api/User.html b/StackCoin/Api/User.html new file mode 100644 index 0000000..386ad58 --- /dev/null +++ b/StackCoin/Api/User.html @@ -0,0 +1,748 @@ + + + + + + + + + + + + + + + + + StackCoin::Api::User - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Api::User + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/routes/user.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def setup + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Auth.html b/StackCoin/Auth.html new file mode 100644 index 0000000..3619653 --- /dev/null +++ b/StackCoin/Auth.html @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + StackCoin::Auth - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Auth + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(db : DB::Database, bank : Bank, jwt_secret_key : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def authenticate(user_id : UInt64, token : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def create_account_with_token(user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def validate_access_token(access_token : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Auth/Result.html b/StackCoin/Auth/Result.html new file mode 100644 index 0000000..2a69e60 --- /dev/null +++ b/StackCoin/Auth/Result.html @@ -0,0 +1,560 @@ + + + + + + + + + + + + + + + + + StackCoin::Auth::Result - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Auth::Result + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/auth.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Auth/Result/AccountCreated.html b/StackCoin/Auth/Result/AccountCreated.html new file mode 100644 index 0000000..141bb01 --- /dev/null +++ b/StackCoin/Auth/Result/AccountCreated.html @@ -0,0 +1,765 @@ + + + + + + + + + + + + + + + + + StackCoin::Auth::Result::AccountCreated - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Auth::Result::AccountCreated + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Success

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(message, token) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def token : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def token=(token : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Auth/Result/Authenticated.html b/StackCoin/Auth/Result/Authenticated.html new file mode 100644 index 0000000..ed7a922 --- /dev/null +++ b/StackCoin/Auth/Result/Authenticated.html @@ -0,0 +1,765 @@ + + + + + + + + + + + + + + + + + StackCoin::Auth::Result::Authenticated - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Auth::Result::Authenticated + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Success

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(message, access_token) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def access_token : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def access_token=(access_token : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Auth/Result/InvalidAccessToken.html b/StackCoin/Auth/Result/InvalidAccessToken.html new file mode 100644 index 0000000..62af5cb --- /dev/null +++ b/StackCoin/Auth/Result/InvalidAccessToken.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Auth::Result::InvalidAccessToken - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Auth::Result::InvalidAccessToken + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Auth/Result/InvalidToken.html b/StackCoin/Auth/Result/InvalidToken.html new file mode 100644 index 0000000..18ba4f4 --- /dev/null +++ b/StackCoin/Auth/Result/InvalidToken.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Auth::Result::InvalidToken - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Auth::Result::InvalidToken + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Auth/Result/NoSuchAccount.html b/StackCoin/Auth/Result/NoSuchAccount.html new file mode 100644 index 0000000..a1ce8c8 --- /dev/null +++ b/StackCoin/Auth/Result/NoSuchAccount.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Auth::Result::NoSuchAccount - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Auth::Result::NoSuchAccount + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Auth/Result/ValidAccessToken.html b/StackCoin/Auth/Result/ValidAccessToken.html new file mode 100644 index 0000000..3f9eeb2 --- /dev/null +++ b/StackCoin/Auth/Result/ValidAccessToken.html @@ -0,0 +1,744 @@ + + + + + + + + + + + + + + + + + StackCoin::Auth::Result::ValidAccessToken - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Auth::Result::ValidAccessToken + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Success

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(message, user_id) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def user_id : UInt64 + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bank.html b/StackCoin/Bank.html new file mode 100644 index 0000000..2bdef4b --- /dev/null +++ b/StackCoin/Bank.html @@ -0,0 +1,776 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(db : DB::Database, banned : Banned) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def balance(cnn : DB::Connection, user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def balance(user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def db : DB::Database + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def deposit_dole(user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def has_account(user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def open_account(user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def transfer(from_id : UInt64, to_id : UInt64, amount : Int32) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bank/Result.html b/StackCoin/Bank/Result.html new file mode 100644 index 0000000..3735e0d --- /dev/null +++ b/StackCoin/Bank/Result.html @@ -0,0 +1,560 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank::Result - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank::Result + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bank/Result/BannedUser.html b/StackCoin/Bank/Result/BannedUser.html new file mode 100644 index 0000000..ba796eb --- /dev/null +++ b/StackCoin/Bank/Result/BannedUser.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank::Result::BannedUser - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank::Result::BannedUser + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bank/Result/InsufficientFunds.html b/StackCoin/Bank/Result/InsufficientFunds.html new file mode 100644 index 0000000..49e7cde --- /dev/null +++ b/StackCoin/Bank/Result/InsufficientFunds.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank::Result::InsufficientFunds - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank::Result::InsufficientFunds + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bank/Result/InvalidAmount.html b/StackCoin/Bank/Result/InvalidAmount.html new file mode 100644 index 0000000..e3ace3c --- /dev/null +++ b/StackCoin/Bank/Result/InvalidAmount.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank::Result::InvalidAmount - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank::Result::InvalidAmount + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bank/Result/NoSuchAccount.html b/StackCoin/Bank/Result/NoSuchAccount.html new file mode 100644 index 0000000..bf6d983 --- /dev/null +++ b/StackCoin/Bank/Result/NoSuchAccount.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank::Result::NoSuchAccount - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank::Result::NoSuchAccount + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bank/Result/PreexistingAccount.html b/StackCoin/Bank/Result/PreexistingAccount.html new file mode 100644 index 0000000..f6e77b2 --- /dev/null +++ b/StackCoin/Bank/Result/PreexistingAccount.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank::Result::PreexistingAccount - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank::Result::PreexistingAccount + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bank/Result/PrematureDole.html b/StackCoin/Bank/Result/PrematureDole.html new file mode 100644 index 0000000..ce54506 --- /dev/null +++ b/StackCoin/Bank/Result/PrematureDole.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank::Result::PrematureDole - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank::Result::PrematureDole + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bank/Result/TransferSelf.html b/StackCoin/Bank/Result/TransferSelf.html new file mode 100644 index 0000000..bf8464d --- /dev/null +++ b/StackCoin/Bank/Result/TransferSelf.html @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank::Result::TransferSelf - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank::Result::TransferSelf + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Error

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bank/Result/TransferSuccess.html b/StackCoin/Bank/Result/TransferSuccess.html new file mode 100644 index 0000000..fc63b86 --- /dev/null +++ b/StackCoin/Bank/Result/TransferSuccess.html @@ -0,0 +1,807 @@ + + + + + + + + + + + + + + + + + StackCoin::Bank::Result::TransferSuccess - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bank::Result::TransferSuccess + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bank.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Result::Success

+ + + + new(db : DB::Transaction, message)
new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(message, from_bal, to_bal) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def from_bal : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def from_bal=(from_bal : Int32) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_bal : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_bal=(to_bal : Int32) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Banned.html b/StackCoin/Banned.html new file mode 100644 index 0000000..e277db9 --- /dev/null +++ b/StackCoin/Banned.html @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + StackCoin::Banned - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Banned + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/banned.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(db : DB::Database) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def ban(user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def is_banned(user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def unban(user_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot.html b/StackCoin/Bot.html new file mode 100644 index 0000000..460e4c9 --- /dev/null +++ b/StackCoin/Bot.html @@ -0,0 +1,798 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bot.cr + + +
+ + + + stackcoin/commands/auth.cr + + +
+ + + + stackcoin/commands/bal.cr + + +
+ + + + stackcoin/commands/ban.cr + + +
+ + + + stackcoin/commands/base.cr + + +
+ + + + stackcoin/commands/circulation.cr + + +
+ + + + stackcoin/commands/dole.cr + + +
+ + + + stackcoin/commands/graph.cr + + +
+ + + + stackcoin/commands/help.cr + + +
+ + + + stackcoin/commands/leaderboard.cr + + +
+ + + + stackcoin/commands/ledger.cr + + +
+ + + + stackcoin/commands/mark.cr + + +
+ + + + stackcoin/commands/open.cr + + +
+ + + + stackcoin/commands/send.cr + + +
+ + + + stackcoin/commands/unban.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(config : Config, bank : Bank, stats : Statistics, auth : StackCoin::Auth, banned : Banned, designated_channel : StackCoin::DesignatedChannel) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.cleaned_message_content(prefix, message_content) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.simplified_message_content_for_parsing(message_content) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def run! + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Auth.html b/StackCoin/Bot/Auth.html new file mode 100644 index 0000000..46994e7 --- /dev/null +++ b/StackCoin/Bot/Auth.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Auth - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Auth + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/auth.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Bal.html b/StackCoin/Bot/Bal.html new file mode 100644 index 0000000..b121efc --- /dev/null +++ b/StackCoin/Bot/Bal.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Bal - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Bal + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/bal.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Ban.html b/StackCoin/Bot/Ban.html new file mode 100644 index 0000000..d82b5f6 --- /dev/null +++ b/StackCoin/Bot/Ban.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Ban - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Ban + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/ban.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Circulation.html b/StackCoin/Bot/Circulation.html new file mode 100644 index 0000000..1c9bf3b --- /dev/null +++ b/StackCoin/Bot/Circulation.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Circulation - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Circulation + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/circulation.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Command.html b/StackCoin/Bot/Command.html new file mode 100644 index 0000000..60bf437 --- /dev/null +++ b/StackCoin/Bot/Command.html @@ -0,0 +1,1200 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Command - stackcoin HEAD + + + + + + + +
+

+ + abstract class StackCoin::Bot::Command + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/base.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.lookup : Hash(String, Command) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def auth : StackCoin::Auth + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def auth=(auth : StackCoin::Auth) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def bank : Bank + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def bank=(bank : Bank) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def banned : Banned + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def banned=(banned : Banned) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def cache : Discord::Cache + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def cache=(cache : Discord::Cache) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def client : Discord::Client + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def client=(client : Discord::Client) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def config : Config + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def config=(config : Config) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def desc : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def designated_channel : DesignatedChannel + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def designated_channel=(designated_channel : DesignatedChannel) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def send_emb(message, content, emb : Discord::Embed) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def send_emb(message, emb : Discord::Embed) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def send_msg(message, channel_id, content) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def send_msg(message, content) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def stats : Statistics + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def stats=(stats : Statistics) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def trigger : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def usage : String? + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Context.html b/StackCoin/Bot/Context.html new file mode 100644 index 0000000..bea6629 --- /dev/null +++ b/StackCoin/Bot/Context.html @@ -0,0 +1,783 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Context - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Context + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bot.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(client, cache, bank, stats, auth, banned, designated_channel, config) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def auth : StackCoin::Auth + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def bank : Bank + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def banned : StackCoin::Banned + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def cache : Discord::Cache + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def client : Discord::Client + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def config : Config + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def designated_channel : StackCoin::DesignatedChannel + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def stats : Statistics + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Dole.html b/StackCoin/Bot/Dole.html new file mode 100644 index 0000000..601d983 --- /dev/null +++ b/StackCoin/Bot/Dole.html @@ -0,0 +1,799 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Dole - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Dole + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/dole.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def memes(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Graph.html b/StackCoin/Bot/Graph.html new file mode 100644 index 0000000..24310b5 --- /dev/null +++ b/StackCoin/Bot/Graph.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Graph - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Graph + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/graph.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Help.html b/StackCoin/Bot/Help.html new file mode 100644 index 0000000..f81c702 --- /dev/null +++ b/StackCoin/Bot/Help.html @@ -0,0 +1,862 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Help - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Help + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/help.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def root_help : Discord::Embed + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def root_help=(root_help) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub_help : Hash(String, Discord::Embed) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def sub_help=(sub_help) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Leaderboard.html b/StackCoin/Bot/Leaderboard.html new file mode 100644 index 0000000..1865b69 --- /dev/null +++ b/StackCoin/Bot/Leaderboard.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Leaderboard - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Leaderboard + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/leaderboard.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Ledger.html b/StackCoin/Bot/Ledger.html new file mode 100644 index 0000000..bd5282f --- /dev/null +++ b/StackCoin/Bot/Ledger.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Ledger - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Ledger + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/ledger.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Mark.html b/StackCoin/Bot/Mark.html new file mode 100644 index 0000000..992d324 --- /dev/null +++ b/StackCoin/Bot/Mark.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Mark - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Mark + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/mark.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Open.html b/StackCoin/Bot/Open.html new file mode 100644 index 0000000..8ff971b --- /dev/null +++ b/StackCoin/Bot/Open.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Open - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Open + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/open.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Result.html b/StackCoin/Bot/Result.html new file mode 100644 index 0000000..b953177 --- /dev/null +++ b/StackCoin/Bot/Result.html @@ -0,0 +1,550 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Result - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Result + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bot.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bot/Result/Base.html b/StackCoin/Bot/Result/Base.html new file mode 100644 index 0000000..bcc3c0d --- /dev/null +++ b/StackCoin/Bot/Result/Base.html @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Result::Base - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Result::Base + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bot.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(client, message, content) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bot/Result/Error.html b/StackCoin/Bot/Result/Error.html new file mode 100644 index 0000000..b0c6248 --- /dev/null +++ b/StackCoin/Bot/Result/Error.html @@ -0,0 +1,569 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Result::Error - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Result::Error + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/bot.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Bot::Result::Base

+ + + + new(client, message, content) + new + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Bot/Send.html b/StackCoin/Bot/Send.html new file mode 100644 index 0000000..0bb5d5a --- /dev/null +++ b/StackCoin/Bot/Send.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Send - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Send + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/send.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Bot/Unban.html b/StackCoin/Bot/Unban.html new file mode 100644 index 0000000..6cbc14c --- /dev/null +++ b/StackCoin/Bot/Unban.html @@ -0,0 +1,778 @@ + + + + + + + + + + + + + + + + + StackCoin::Bot::Unban - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Bot::Unban + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/commands/unban.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + + + + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(context : Context) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def invoke(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Config.html b/StackCoin/Config.html new file mode 100644 index 0000000..8308950 --- /dev/null +++ b/StackCoin/Config.html @@ -0,0 +1,909 @@ + + + + + + + + + + + + + + + + + StackCoin::Config - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Config + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/config.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.from_env + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def client_id : UInt64 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def client_id=(client_id : UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def database_url : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def database_url=(database_url : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jwt_secret_key : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def jwt_secret_key=(jwt_secret_key : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def owner_id : Discord::Snowflake + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def owner_id=(owner_id : Discord::Snowflake) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def prefix : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def prefix=(prefix : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def test_guild_snowflake : Discord::Snowflake + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def test_guild_snowflake=(test_guild_snowflake : Discord::Snowflake) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def token : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def token=(token : String) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Database.html b/StackCoin/Database.html new file mode 100644 index 0000000..376a152 --- /dev/null +++ b/StackCoin/Database.html @@ -0,0 +1,719 @@ + + + + + + + + + + + + + + + + + StackCoin::Database - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Database + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/db.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DB_INIT_SQL = "CREATE TABLE IF NOT EXISTS balance (\n user_id TEXT PRIMARY KEY,\n bal INTERGER\n);\n\nCREATE TABLE IF NOT EXISTS banned (\n user_id TEXT PRIMARY KEY\n);\n\n\nCREATE TABLE IF NOT EXISTS designated_channel (\n guild_id TEXT PRIMARY KEY,\n channel_id TEXT NOT NULL\n);\n\nCREATE TABLE IF NOT EXISTS token (\n user_id TEXT PRIMARY KEY,\n token TEXT\n);\n\nCREATE TABLE IF NOT EXISTS ledger (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n from_id TEXT,\n from_bal INTERGER,\n to_id TEXT,\n to_bal INTERGER,\n amount INTERGER,\n time INTERGER\n);\n\nCREATE TABLE IF NOT EXISTS benefit (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n user_id TEXT,\n user_bal INTERGER,\n amount INTERGER,\n time INTERGER\n);\n\nCREATE TABLE IF NOT EXISTS last_given_dole (\n user_id TEXT PRIMARY KEY,\n time INTERGER\n)" +
+ + +
+ + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(config : Config, db : DB::Database) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.parse_time(time) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def backup + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def populate_tables(db) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/DesignatedChannel.html b/StackCoin/DesignatedChannel.html new file mode 100644 index 0000000..5c2e60b --- /dev/null +++ b/StackCoin/DesignatedChannel.html @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + StackCoin::DesignatedChannel - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::DesignatedChannel + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/designated_channel.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(db : DB::Database) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def for_guild(guild_id : Discord::Snowflake) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def is_permitted_to_reply_in(guild_id : Discord::Snowflake, channel_id : Discord::Snowflake) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def mark(guild_id : Discord::Snowflake, channel_id : Discord::Snowflake) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Result.html b/StackCoin/Result.html new file mode 100644 index 0000000..f22b3a7 --- /dev/null +++ b/StackCoin/Result.html @@ -0,0 +1,566 @@ + + + + + + + + + + + + + + + + + StackCoin::Result - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Result + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/result.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Result/Base.html b/StackCoin/Result/Base.html new file mode 100644 index 0000000..d14f458 --- /dev/null +++ b/StackCoin/Result/Base.html @@ -0,0 +1,823 @@ + + + + + + + + + + + + + + + + + StackCoin::Result::Base - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Result::Base + +

+ + + + + + + + + + + +

+ + + + Included Modules +

+ + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/result.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def error : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def error=(error : String?) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def message : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def message=(message : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def name + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def success : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def success=(success : String?) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Result/Error.html b/StackCoin/Result/Error.html new file mode 100644 index 0000000..e0bf40e --- /dev/null +++ b/StackCoin/Result/Error.html @@ -0,0 +1,735 @@ + + + + + + + + + + + + + + + + + StackCoin::Result::Error - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Result::Error + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/result.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(db : DB::Transaction, message) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Result/Success.html b/StackCoin/Result/Success.html new file mode 100644 index 0000000..b245f41 --- /dev/null +++ b/StackCoin/Result/Success.html @@ -0,0 +1,723 @@ + + + + + + + + + + + + + + + + + StackCoin::Result::Success - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Result::Success + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/result.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + +

Instance methods inherited from class StackCoin::Result::Base

+ + + + error : String? + error, + + + + error=(error : String?) + error=, + + + + message : String + message, + + + + message=(message : String) + message=, + + + + name + name, + + + + success : String? + success, + + + + success=(success : String?) + success= + + + + + + +

Constructor methods inherited from class StackCoin::Result::Base

+ + + + new(pull : JSON::PullParser)
new(message)
+ new
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(db : DB::Transaction, message) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(pull : JSON::PullParser) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Statistics.html b/StackCoin/Statistics.html new file mode 100644 index 0000000..a1db8c2 --- /dev/null +++ b/StackCoin/Statistics.html @@ -0,0 +1,794 @@ + + + + + + + + + + + + + + + + + StackCoin::Statistics - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Statistics + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/statistics.cr + + +
+ + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +

+ + + + Macro Summary +

+ + + + + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def all_balances + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def circulation + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def graph(id) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def leaderboard(limit = 5) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def ledger(dates, from_ids, to_ids, limit = 5) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def richest + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Macro Detail +

+ +
+
+ + macro optional_conditions(objs, type, condition, final = "AND") + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/StackCoin/Statistics/Result.html b/StackCoin/Statistics/Result.html new file mode 100644 index 0000000..5f97d94 --- /dev/null +++ b/StackCoin/Statistics/Result.html @@ -0,0 +1,550 @@ + + + + + + + + + + + + + + + + + StackCoin::Statistics::Result - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Statistics::Result + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/statistics.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Statistics/Result/Base.html b/StackCoin/Statistics/Result/Base.html new file mode 100644 index 0000000..6079ebc --- /dev/null +++ b/StackCoin/Statistics/Result/Base.html @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + + StackCoin::Statistics::Result::Base - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Statistics::Result::Base + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/statistics.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(client, message, content) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Statistics/Result/Error.html b/StackCoin/Statistics/Result/Error.html new file mode 100644 index 0000000..8793ea4 --- /dev/null +++ b/StackCoin/Statistics/Result/Error.html @@ -0,0 +1,569 @@ + + + + + + + + + + + + + + + + + StackCoin::Statistics::Result::Error - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Statistics::Result::Error + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/statistics.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + +

Constructor methods inherited from class StackCoin::Statistics::Result::Base

+ + + + new(client, message, content) + new + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Statistics/Result/Graph.html b/StackCoin/Statistics/Result/Graph.html new file mode 100644 index 0000000..6045b29 --- /dev/null +++ b/StackCoin/Statistics/Result/Graph.html @@ -0,0 +1,550 @@ + + + + + + + + + + + + + + + + + StackCoin::Statistics::Result::Graph - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Statistics::Result::Graph + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/statistics.cr + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + diff --git a/StackCoin/Statistics/Result/Graph/Error.html b/StackCoin/Statistics/Result/Graph/Error.html new file mode 100644 index 0000000..91ae9a6 --- /dev/null +++ b/StackCoin/Statistics/Result/Graph/Error.html @@ -0,0 +1,636 @@ + + + + + + + + + + + + + + + + + StackCoin::Statistics::Result::Graph::Error - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Statistics::Result::Graph::Error + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/statistics.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(message) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def message : String + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Statistics/Result/Graph/Success.html b/StackCoin/Statistics/Result/Graph/Success.html new file mode 100644 index 0000000..4c90df8 --- /dev/null +++ b/StackCoin/Statistics/Result/Graph/Success.html @@ -0,0 +1,636 @@ + + + + + + + + + + + + + + + + + StackCoin::Statistics::Result::Graph::Success - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Statistics::Result::Graph::Success + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/statistics.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(file) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def file : File + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Statistics/Result/Report.html b/StackCoin/Statistics/Result/Report.html new file mode 100644 index 0000000..df647f4 --- /dev/null +++ b/StackCoin/Statistics/Result/Report.html @@ -0,0 +1,699 @@ + + + + + + + + + + + + + + + + + StackCoin::Statistics::Result::Report - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Statistics::Result::Report + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/statistics.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(date, from_id, to_id, results) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def date : Array(String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def from_id : Array(UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def results : Array(Transaction) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_id : Array(UInt64) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/StackCoin/Statistics/Result/Report/Transaction.html b/StackCoin/Statistics/Result/Report/Transaction.html new file mode 100644 index 0000000..e188843 --- /dev/null +++ b/StackCoin/Statistics/Result/Report/Transaction.html @@ -0,0 +1,741 @@ + + + + + + + + + + + + + + + + + StackCoin::Statistics::Result::Report::Transaction - stackcoin HEAD + + + + + + + +
+

+ + class StackCoin::Statistics::Result::Report::Transaction + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + stackcoin/statistics.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(from_id, from_bal, to_id, to_bal, amount, time) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def amount : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def from_bal : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def from_id : UInt64 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def time : Time + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_bal : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_id : UInt64 + + # +
+ +
+
+ + [View source] + +
+
+ + + + + +
+ + + diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..20bb084 --- /dev/null +++ b/css/style.css @@ -0,0 +1,726 @@ +html, body { + background: #FFFFFF; + position: relative; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow: hidden; +} + +body { + font-family: "Avenir", "Tahoma", "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + color: #333; + line-height: 1.5; +} + +a { + color: #263F6C; +} + +a:visited { + color: #112750; +} + +h1, h2, h3, h4, h5, h6 { + margin: 35px 0 25px; + color: #444444; +} + +h1.type-name { + color: #47266E; + margin: 20px 0 30px; + background-color: #F8F8F8; + padding: 10px 12px; + border: 1px solid #EBEBEB; + border-radius: 2px; +} + +h2 { + border-bottom: 1px solid #E6E6E6; + padding-bottom: 5px; +} + +body { + display: flex; +} + +.sidebar, .main-content { + overflow: auto; +} + +.sidebar { + width: 30em; + color: #F8F4FD; + background-color: #2E1052; + padding: 0 0 30px; + box-shadow: inset -3px 0 4px rgba(0,0,0,.35); + line-height: 1.2; + z-index: 0; +} + +.sidebar .search-box { + padding: 13px 9px; +} + +.sidebar input { + display: block; + box-sizing: border-box; + margin: 0; + padding: 5px; + font: inherit; + font-family: inherit; + line-height: 1.2; + width: 100%; + border: 0; + outline: 0; + border-radius: 2px; + box-shadow: 0px 3px 5px rgba(0,0,0,.25); + transition: box-shadow .12s; +} + +.sidebar input:focus { + box-shadow: 0px 5px 6px rgba(0,0,0,.5); +} + +.sidebar input::-webkit-input-placeholder { /* Chrome/Opera/Safari */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input::-moz-placeholder { /* Firefox 19+ */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-ms-input-placeholder { /* IE 10+ */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-moz-placeholder { /* Firefox 18- */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.project-summary { + padding: 9px 15px 30px 30px; +} + +.project-name { + font-size: 1.4rem; + margin: 0; + color: #f4f4f4; + font-weight: 600; +} + +.project-version { + margin-top: 5px; + display: inline-block; + position: relative; +} + +.project-version > form::after { + position: absolute; + right: 0; + top: 0; + content: "\25BC"; + font-size: .6em; + line-height: 1.2rem; + z-index: -1; +} + +.project-versions-nav { + cursor: pointer; + margin: 0; + padding: 0 .9em 0 0; + border: none; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: transparent; + color: inherit; + font-family: inherit; + font-size: inherit; + line-height: inherit; +} +.project-versions-nav:focus { + outline: none; +} + +.project-versions-nav > option { + color: initial; +} + +.sidebar ul { + margin: 0; + padding: 0; + list-style: none outside; +} + +.sidebar li { + display: block; + position: relative; +} + +.types-list li.hide { + display: none; +} + +.sidebar a { + text-decoration: none; + color: inherit; + transition: color .14s; +} +.types-list a { + display: block; + padding: 5px 15px 5px 30px; +} + +.types-list { + display: block; +} + +.sidebar a:focus { + outline: 1px solid #D1B7F1; +} + +.types-list a { + padding: 5px 15px 5px 30px; +} + +.sidebar .current > a, +.sidebar a:hover { + color: #866BA6; +} + +.types-list li ul { + overflow: hidden; + height: 0; + max-height: 0; + transition: 1s ease-in-out; +} + +.types-list li.parent { + padding-left: 30px; +} + +.types-list li.parent::before { + box-sizing: border-box; + content: "▼"; + display: block; + width: 30px; + height: 30px; + position: absolute; + top: 0; + left: 0; + text-align: center; + color: white; + font-size: 8px; + line-height: 30px; + transform: rotateZ(-90deg); + cursor: pointer; + transition: .2s linear; +} + + +.types-list li.parent > a { + padding-left: 0; +} + +.types-list li.parent.open::before { + transform: rotateZ(0); +} + +.types-list li.open > ul { + height: auto; + max-height: 1000em; +} + +.main-content { + padding: 0 30px 30px 30px; + width: 100%; +} + +.kind { + font-size: 60%; + color: #866BA6; +} + +.superclass-hierarchy { + margin: -15px 0 30px 0; + padding: 0; + list-style: none outside; + font-size: 80%; +} + +.superclass-hierarchy .superclass { + display: inline-block; + margin: 0 7px 0 0; + padding: 0; +} + +.superclass-hierarchy .superclass + .superclass::before { + content: "<"; + margin-right: 7px; +} + +.other-types-list li { + display: inline-block; +} + +.other-types-list, +.list-summary { + margin: 0 0 30px 0; + padding: 0; + list-style: none outside; +} + +.entry-const { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +.entry-const code { + white-space: pre-wrap; +} + +.entry-summary { + padding-bottom: 4px; +} + +.superclass-hierarchy .superclass a, +.other-type a, +.entry-summary .signature { + padding: 4px 8px; + margin-bottom: 4px; + display: inline-block; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + text-decoration: none; + border-radius: 3px; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: background .15s, border-color .15s; +} + +.superclass-hierarchy .superclass a:hover, +.other-type a:hover, +.entry-summary .signature:hover { + background: #D5CAE3; + border-color: #624288; +} + +.entry-summary .summary { + padding-left: 32px; +} + +.entry-summary .summary p { + margin: 12px 0 16px; +} + +.entry-summary a { + text-decoration: none; +} + +.entry-detail { + padding: 30px 0; +} + +.entry-detail .signature { + position: relative; + padding: 5px 15px; + margin-bottom: 10px; + display: block; + border-radius: 5px; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: .2s ease-in-out; +} + +.entry-detail:target .signature { + background-color: #D5CAE3; + border: 1px solid #624288; +} + +.entry-detail .signature .method-permalink { + position: absolute; + top: 0; + left: -35px; + padding: 5px 15px; + text-decoration: none; + font-weight: bold; + color: #624288; + opacity: .4; + transition: opacity .2s; +} + +.entry-detail .signature .method-permalink:hover { + opacity: 1; +} + +.entry-detail:target .signature .method-permalink { + opacity: 1; +} + +.methods-inherited { + padding-right: 10%; + line-height: 1.5em; +} + +.methods-inherited h3 { + margin-bottom: 4px; +} + +.methods-inherited a { + display: inline-block; + text-decoration: none; + color: #47266E; +} + +.methods-inherited a:hover { + text-decoration: underline; + color: #6C518B; +} + +.methods-inherited .tooltip>span { + background: #D5CAE3; + padding: 4px 8px; + border-radius: 3px; + margin: -4px -8px; +} + +.methods-inherited .tooltip * { + color: #47266E; +} + +pre { + padding: 10px 20px; + margin-top: 4px; + border-radius: 3px; + line-height: 1.45; + overflow: auto; + color: #333; + background: #fdfdfd; + font-size: 14px; + border: 1px solid #eee; +} + +code { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +:not(pre) > code { + background-color: rgba(40,35,30,0.05); + padding: 0.2em 0.4em; + font-size: 85%; + border-radius: 3px; +} + +span.flag { + padding: 2px 4px 1px; + border-radius: 3px; + margin-right: 3px; + font-size: 11px; + border: 1px solid transparent; +} + +span.flag.orange { + background-color: #EE8737; + color: #FCEBDD; + border-color: #EB7317; +} + +span.flag.yellow { + background-color: #E4B91C; + color: #FCF8E8; + border-color: #B69115; +} + +span.flag.green { + background-color: #469C14; + color: #E2F9D3; + border-color: #34700E; +} + +span.flag.red { + background-color: #BF1919; + color: #F9ECEC; + border-color: #822C2C; +} + +span.flag.purple { + background-color: #2E1052; + color: #ECE1F9; + border-color: #1F0B37; +} + +span.flag.lime { + background-color: #a3ff00; + color: #222222; + border-color: #00ff1e; +} + +.tooltip>span { + position: absolute; + opacity: 0; + display: none; + pointer-events: none; +} + +.tooltip:hover>span { + display: inline-block; + opacity: 1; +} + +.c { + color: #969896; +} + +.n { + color: #0086b3; +} + +.t { + color: #0086b3; +} + +.s { + color: #183691; +} + +.i { + color: #7f5030; +} + +.k { + color: #a71d5d; +} + +.o { + color: #a71d5d; +} + +.m { + color: #795da3; +} + +.hidden { + display: none; +} +.search-results { + font-size: 90%; + line-height: 1.3; +} + +.search-results mark { + color: inherit; + background: transparent; + font-weight: bold; +} +.search-result { + padding: 5px 8px 5px 5px; + cursor: pointer; + border-left: 5px solid transparent; + transform: translateX(-3px); + transition: all .2s, background-color 0s, border .02s; + min-height: 3.2em; +} +.search-result.current { + border-left-color: #ddd; + background-color: rgba(200,200,200,0.4); + transform: translateX(0); + transition: all .2s, background-color .5s, border 0s; +} +.search-result.current:hover, +.search-result.current:focus { + border-left-color: #866BA6; +} +.search-result:not(.current):nth-child(2n) { + background-color: rgba(255,255,255,.06); +} +.search-result__title { + font-size: 105%; + word-break: break-all; + line-height: 1.1; + padding: 3px 0; +} +.search-result__title strong { + font-weight: normal; +} +.search-results .search-result__title > a { + padding: 0; + display: block; +} +.search-result__title > a > .args { + color: #dddddd; + font-weight: 300; + transition: inherit; + font-size: 88%; + line-height: 1.2; + letter-spacing: -.02em; +} +.search-result__title > a > .args * { + color: inherit; +} + +.search-result a, +.search-result a:hover { + color: inherit; +} +.search-result:not(.current):hover .search-result__title > a, +.search-result:not(.current):focus .search-result__title > a, +.search-result__title > a:focus { + color: #866BA6; +} +.search-result:not(.current):hover .args, +.search-result:not(.current):focus .args { + color: #6a5a7d; +} + +.search-result__type { + color: #e8e8e8; + font-weight: 300; +} +.search-result__doc { + color: #bbbbbb; + font-size: 90%; +} +.search-result__doc p { + margin: 0; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + line-height: 1.2em; + max-height: 2.4em; +} + +.js-modal-visible .modal-background { + display: flex; +} +.main-content { + position: relative; +} +.modal-background { + position: absolute; + display: none; + height: 100%; + width: 100%; + background: rgba(120,120,120,.4); + z-index: 100; + align-items: center; + justify-content: center; +} +.usage-modal { + max-width: 90%; + background: #fff; + border: 2px solid #ccc; + border-radius: 9px; + padding: 5px 15px 20px; + min-width: 50%; + color: #555; + position: relative; + transform: scale(.5); + transition: transform 200ms; +} +.js-modal-visible .usage-modal { + transform: scale(1); +} +.usage-modal > .close-button { + position: absolute; + right: 15px; + top: 8px; + color: #aaa; + font-size: 27px; + cursor: pointer; +} +.usage-modal > .close-button:hover { + text-shadow: 2px 2px 2px #ccc; + color: #999; +} +.modal-title { + margin: 0; + text-align: center; + font-weight: normal; + color: #666; + border-bottom: 2px solid #ddd; + padding: 10px; +} +.usage-list { + padding: 0; + margin: 13px; +} +.usage-list > li { + padding: 5px 2px; + overflow: auto; + padding-left: 100px; + min-width: 12em; +} +.usage-modal kbd { + background: #eee; + border: 1px solid #ccc; + border-bottom-width: 2px; + border-radius: 3px; + padding: 3px 8px; + font-family: monospace; + margin-right: 2px; + display: inline-block; +} +.usage-key { + float: left; + clear: left; + margin-left: -100px; + margin-right: 12px; +} +.doc-inherited { + font-weight: bold; +} + +.anchor { + float: left; + padding-right: 4px; + margin-left: -20px; +} + +.main-content .anchor .octicon-link { + width: 16px; + height: 16px; +} + +.main-content .anchor:focus { + outline: none +} + +.main-content h1:hover .anchor, +.main-content h2:hover .anchor, +.main-content h3:hover .anchor, +.main-content h4:hover .anchor, +.main-content h5:hover .anchor, +.main-content h6:hover .anchor { + text-decoration: none +} + +.main-content h1 .octicon-link, +.main-content h2 .octicon-link, +.main-content h3 .octicon-link, +.main-content h4 .octicon-link, +.main-content h5 .octicon-link, +.main-content h6 .octicon-link { + visibility: hidden +} + +.main-content h1:hover .anchor .octicon-link, +.main-content h2:hover .anchor .octicon-link, +.main-content h3:hover .anchor .octicon-link, +.main-content h4:hover .anchor .octicon-link, +.main-content h5:hover .anchor .octicon-link, +.main-content h6:hover .anchor .octicon-link { + visibility: visible +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..201d19b --- /dev/null +++ b/index.html @@ -0,0 +1,506 @@ + + + + + + + + + + + + + + + + + stackcoin HEAD + + + + + + + +
+

Documentation badge Deploy to Dockerhub badge

+ +

+ +StackCoin

+ +

StackCoin coin of Stack on coin

+ +

a discord pseudo currency, written using discordcr

+ +

Creator of StackCoin running commands in a private guild, showing the different usages of the bot, such as collecting a daily dole, sending StackCoin to other users, checking a graph of data showing their balance over time, and the leaderboard of the current highest balances of the top 5 accounts

+ +

+ +Requirements:

+ + + +

+ +Running:

+ +
cp .env.dist .env # then populate .env
+
+shards # install deps
+
+crystal run src/stackcoin.cr # run bot!
+ +

+ +Contributors:

+ + + +
[11:09] stack: i hate it
+
+ + diff --git a/index.json b/index.json new file mode 100644 index 0000000..99b4723 --- /dev/null +++ b/index.json @@ -0,0 +1 @@ +{"repository_name":"stackcoin","body":"[![Documentation badge](https://img.shields.io/badge/docs-latest-green.svg?style=flat-square)](https://jackharrhy.github.io/StackCoin/) ![Deploy to Dockerhub badge](https://github.com/jackharrhy/StackCoin/workflows/Deploy%20to%20Dockerhub/badge.svg)\n\n# StackCoin\n\n![StackCoin coin of Stack on coin](https://i.imgur.com/ou12BG6.png)\n\n_a discord pseudo currency, written using [discordcr](https://github.com/discordcr/discordcr)_\n\n![Creator of StackCoin running commands in a private guild, showing the different usages of the bot, such as collecting a daily dole, sending StackCoin to other users, checking a graph of data showing their balance over time, and the leaderboard of the current highest balances of the top 5 accounts](https://i.imgur.com/alF7EcU.png)\n\n---\n\n## Requirements:\n\n- crystal 0.35+\n- sqlite3, development variant\n\n## Running:\n\n```sh\ncp .env.dist .env # then populate .env\n\nshards # install deps\n\ncrystal run src/stackcoin.cr # run bot!\n```\n\n---\n\n## Contributors:\n\n- [jackharrhy](https://github.com/jackharrhy) - creator, maker of most\n- [z64](https://github.com/z64) - made small typo fix, and fixed the specs running, but also maintainer of discordcr, and wrote code that has influenced this bot heavily\n- [Mudkip](https://github.com/Mudkip) - wrote the `s!unban` command, since he was banned for a short period of time while the feature did not exist :)\n- [SteveParson](https://github.com/SteveParson) - wrote the first iteration of the `s!leaderboard` command\n- [jonyick](https://github.com/jonyick) - increased the max value that can be sent in a single transaction from `10k` -> `100k`\n- [ranguli](https://github.com/ranguli) - removed the header in the readme as a meme\n- [rfh473](https://github.com/rfh473) - gave some much needed feedback on the impl. of how stackcoin parses `$` as `s`\n\n---\n\n```txt\n[11:09] stack: i hate it\n```\n","program":{"html_id":"stackcoin/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"stackcoin","program":true,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/CrystalLogHandler","path":"CrystalLogHandler.html","kind":"class","full_name":"CrystalLogHandler","name":"CrystalLogHandler","abstract":false,"superclass":{"html_id":"stackcoin/Kemal/BaseLogHandler","kind":"class","full_name":"Kemal::BaseLogHandler","name":"BaseLogHandler"},"ancestors":[{"html_id":"stackcoin/Kemal/BaseLogHandler","kind":"class","full_name":"Kemal::BaseLogHandler","name":"BaseLogHandler"},{"html_id":"stackcoin/HTTP/Handler","kind":"module","full_name":"HTTP::Handler","name":"Handler"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/log.cr","line_number":20,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L20"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(log=::Log.for("kemal"))-class-method","html_id":"new(log=::Log.for("kemal"))-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"log","doc":null,"default_value":"::Log.for(\"kemal\")","external_name":"log","restriction":""}],"args_string":"(log = ::Log.for("kemal"))","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L21","def":{"name":"new","args":[{"name":"log","doc":null,"default_value":"::Log.for(\"kemal\")","external_name":"log","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(log)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"call(context:HTTP::Server::Context)-instance-method","html_id":"call(context:HTTP::Server::Context)-instance-method","name":"call","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"HTTP::Server::Context"}],"args_string":"(context : HTTP::Server::Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L24","def":{"name":"call","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"HTTP::Server::Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"elapsed_time = Time.measure do\n call_next(context)\nend\nelapsed_text = elapsed_text(elapsed_time)\n@log.info do\n \"#{Time.utc} #{context.response.status_code} #{context.request.method} #{context.request.resource} #{elapsed_text}\"\nend\ncontext\n"}},{"id":"write(message:String)-instance-method","html_id":"write(message:String)-instance-method","name":"write","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"}],"args_string":"(message : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L31","def":{"name":"write","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@log.info do\n message\nend"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin","path":"StackCoin.html","kind":"module","full_name":"StackCoin","name":"StackCoin","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"src/stackcoin/const.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/const.cr#L1"},{"filename":"src/stackcoin/log.cr","line_number":5,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L5"},{"filename":"src/stackcoin/result.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"DEBUG","name":"DEBUG","value":"ENV[\"DEBUG\"]?","doc":null,"summary":null},{"id":"EPOCH","name":"EPOCH","value":"Time.unix(1574467200)","doc":null,"summary":null},{"id":"Log","name":"Log","value":"::Log.for(\"stackcoin\")","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Api","path":"StackCoin/Api.html","kind":"class","full_name":"StackCoin::Api","name":"Api","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/api.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L6"},{"filename":"src/stackcoin/routes/auth.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L1"},{"filename":"src/stackcoin/routes/base.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L1"},{"filename":"src/stackcoin/routes/ledger.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L1"},{"filename":"src/stackcoin/routes/root.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/root.cr#L1"},{"filename":"src/stackcoin/routes/user.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/user.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(config:Config,bank:Bank,stats:Statistics,auth:StackCoin::Auth)-class-method","html_id":"new(config:Config,bank:Bank,stats:Statistics,auth:StackCoin::Auth)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"args_string":"(config : Config, bank : Bank, stats : Statistics, auth : StackCoin::Auth)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L17","def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(config, bank, stats, auth)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"run!-instance-method","html_id":"run!-instance-method","name":"run!","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L32","def":{"name":"run!","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Starting Kemal\"\nend\nKemal.run\n"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Api/Auth","path":"StackCoin/Api/Auth.html","kind":"class","full_name":"StackCoin::Api::Auth","name":"Auth","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},"ancestors":[{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/auth.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L14","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"post(\"/auth\") do |env|\n if env.request.body\n else\n next\n end\n begin\n auth_post_body = AuthPostBody.from_json(env.request.body.not_nil!)\n rescue e : JSON::ParseException\n halt(env, status_code: 403, response: json_error(\"Invalid JSON: #{e}\"))\n end\n auth_result = @auth.authenticate(auth_post_body.user_id, auth_post_body.token)\n if !auth_result.is_a?(StackCoin::Auth::Result::Authenticated)\n env.response.status_code = 401\n end\n auth_result.to_json\nend"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Api/Auth/AuthPostBody","path":"StackCoin/Api/Auth/AuthPostBody.html","kind":"class","full_name":"StackCoin::Api::Auth::AuthPostBody","name":"AuthPostBody","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/auth.cr","line_number":8,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L8"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api/Auth","kind":"class","full_name":"StackCoin::Api::Auth","name":"Auth"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L9","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"token:String-instance-method","html_id":"token:String-instance-method","name":"token","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L11","def":{"name":"token","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@token"}},{"id":"token=(token:String)-instance-method","html_id":"token=(token:String)-instance-method","name":"token=","doc":null,"summary":null,"abstract":false,"args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"args_string":"(token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L11","def":{"name":"token=","args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@token = token"}},{"id":"user_id:UInt64-instance-method","html_id":"user_id:UInt64-instance-method","name":"user_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L10","def":{"name":"user_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@user_id"}},{"id":"user_id=(user_id:UInt64)-instance-method","html_id":"user_id=(user_id:UInt64)-instance-method","name":"user_id=","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L10","def":{"name":"user_id=","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@user_id = user_id"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Api/Context","path":"StackCoin/Api/Context.html","kind":"class","full_name":"StackCoin::Api::Context","name":"Context","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/api.cr","line_number":7,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L7"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(bank,stats,auth,config)-class-method","html_id":"new(bank,stats,auth,config)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":""},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":""},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":""},{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":""}],"args_string":"(bank, stats, auth, config)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L13","def":{"name":"new","args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":""},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":""},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":""},{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(bank, stats, auth, config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"auth:StackCoin::Auth-instance-method","html_id":"auth:StackCoin::Auth-instance-method","name":"auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Auth","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L10","def":{"name":"auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Auth","visibility":"Public","body":"@auth"}},{"id":"bank:Bank-instance-method","html_id":"bank:Bank-instance-method","name":"bank","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bank","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L8","def":{"name":"bank","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bank","visibility":"Public","body":"@bank"}},{"id":"config:Config-instance-method","html_id":"config:Config-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Config","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L11","def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Config","visibility":"Public","body":"@config"}},{"id":"stats:Statistics-instance-method","html_id":"stats:Statistics-instance-method","name":"stats","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Statistics","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L9","def":{"name":"stats","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Statistics","visibility":"Public","body":"@stats"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Api/Ledger","path":"StackCoin/Api/Ledger.html","kind":"class","full_name":"StackCoin::Api::Ledger","name":"Ledger","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},"ancestors":[{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/ledger.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L15","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"post(\"/ledger\") do |env|\n if env.request.body\n else\n next\n end\n begin\n ledger_post_body = LedgerPostBody.from_json(env.request.body.not_nil!)\n rescue e : JSON::ParseException\n halt(env, status_code: 403, response: json_error(\"Invalid JSON: #{e}\"))\n end\n access_token_valid = @auth.validate_access_token(env.request.headers[\"X-Access-Token\"])\n if !access_token_valid.is_a?(StackCoin::Auth::Result::ValidAccessToken)\n halt(env, status_code: 401, response: access_token_valid.to_json)\n end\n from_id = access_token_valid.user_id\n result = @bank.transfer(from_id, ledger_post_body.to_id, ledger_post_body.amount)\n if !result.is_a?(Bank::Result::TransferSuccess)\n env.response.status_code = 403\n end\n result.to_json\nend"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Api/Ledger/LedgerPostBody","path":"StackCoin/Api/Ledger/LedgerPostBody.html","kind":"class","full_name":"StackCoin::Api::Ledger::LedgerPostBody","name":"LedgerPostBody","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/ledger.cr","line_number":9,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L9"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api/Ledger","kind":"class","full_name":"StackCoin::Api::Ledger","name":"Ledger"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L10","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"amount:Int32-instance-method","html_id":"amount:Int32-instance-method","name":"amount","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L12","def":{"name":"amount","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@amount"}},{"id":"amount=(amount:Int32)-instance-method","html_id":"amount=(amount:Int32)-instance-method","name":"amount=","doc":null,"summary":null,"abstract":false,"args":[{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":"Int32"}],"args_string":"(amount : Int32)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L12","def":{"name":"amount=","args":[{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@amount = amount"}},{"id":"to_id:UInt64-instance-method","html_id":"to_id:UInt64-instance-method","name":"to_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L11","def":{"name":"to_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@to_id"}},{"id":"to_id=(to_id:UInt64)-instance-method","html_id":"to_id=(to_id:UInt64)-instance-method","name":"to_id=","doc":null,"summary":null,"abstract":false,"args":[{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":"UInt64"}],"args_string":"(to_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L11","def":{"name":"to_id=","args":[{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@to_id = to_id"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Api/Root","path":"StackCoin/Api/Root.html","kind":"class","full_name":"StackCoin::Api::Root","name":"Root","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},"ancestors":[{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/root.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/root.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/root.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/root.cr#L8","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"get(\"/\") do |env|\n if self.should_return_html(env)\n next render(\"src/views/home.ecr\")\n end\n infos = Hash(String, Hash(String, Array(String) | Nil)).new\n Route.list.each do |route|\n infos[route.class.name] = route.info\n end\n infos.to_json\nend"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Api/Route","path":"StackCoin/Api/Route.html","kind":"class","full_name":"StackCoin::Api::Route","name":"Route","abstract":true,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/base.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Api/Auth","kind":"class","full_name":"StackCoin::Api::Auth","name":"Auth"},{"html_id":"stackcoin/StackCoin/Api/Ledger","kind":"class","full_name":"StackCoin::Api::Ledger","name":"Ledger"},{"html_id":"stackcoin/StackCoin/Api/Root","kind":"class","full_name":"StackCoin::Api::Root","name":"Root"},{"html_id":"stackcoin/StackCoin/Api/User","kind":"class","full_name":"StackCoin::Api::User","name":"User"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[{"id":"list:Array(Route)-class-method","html_id":"list:Array(Route)-class-method","name":"list","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Route)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L5","def":{"name":"list","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Route)","visibility":"Public","body":"@@list"}}],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L24","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"auth:StackCoin::Auth-instance-method","html_id":"auth:StackCoin::Auth-instance-method","name":"auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Auth","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L21","def":{"name":"auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Auth","visibility":"Public","body":"@auth"}},{"id":"auth=(auth:StackCoin::Auth)-instance-method","html_id":"auth=(auth:StackCoin::Auth)-instance-method","name":"auth=","doc":null,"summary":null,"abstract":false,"args":[{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"args_string":"(auth : StackCoin::Auth)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L21","def":{"name":"auth=","args":[{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@auth = auth"}},{"id":"bank:Bank-instance-method","html_id":"bank:Bank-instance-method","name":"bank","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bank","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L19","def":{"name":"bank","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bank","visibility":"Public","body":"@bank"}},{"id":"bank=(bank:Bank)-instance-method","html_id":"bank=(bank:Bank)-instance-method","name":"bank=","doc":null,"summary":null,"abstract":false,"args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"}],"args_string":"(bank : Bank)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L19","def":{"name":"bank=","args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@bank = bank"}},{"id":"config:Config-instance-method","html_id":"config:Config-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Config","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L22","def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Config","visibility":"Public","body":"@config"}},{"id":"config=(config:Config)-instance-method","html_id":"config=(config:Config)-instance-method","name":"config=","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L22","def":{"name":"config=","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config = config"}},{"id":"info-instance-method","html_id":"info-instance-method","name":"info","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L36","def":{"name":"info","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"{\"routes\" => @routes, \"requires_auth\" => @requires_auth}"}},{"id":"json_error(message)-instance-method","html_id":"json_error(message)-instance-method","name":"json_error","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L15","def":{"name":"json_error","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"\"{\\\"message\\\": \\\"#{message}\\\"}\""}},{"id":"requires_auth:Array(String)?-instance-method","html_id":"requires_auth:Array(String)?-instance-method","name":"requires_auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L34","def":{"name":"requires_auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | Nil","visibility":"Public","body":"@requires_auth"}},{"id":"requires_auth=(requires_auth:Array(String)?)-instance-method","html_id":"requires_auth=(requires_auth:Array(String)?)-instance-method","name":"requires_auth=","doc":null,"summary":null,"abstract":false,"args":[{"name":"requires_auth","doc":null,"default_value":"","external_name":"requires_auth","restriction":"Array(String) | Nil"}],"args_string":"(requires_auth : Array(String)?)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L34","def":{"name":"requires_auth=","args":[{"name":"requires_auth","doc":null,"default_value":"","external_name":"requires_auth","restriction":"Array(String) | Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@requires_auth = requires_auth"}},{"id":"routes:Array(String)-instance-method","html_id":"routes:Array(String)-instance-method","name":"routes","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L33","def":{"name":"routes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@routes"}},{"id":"routes=(routes:Array(String))-instance-method","html_id":"routes=(routes:Array(String))-instance-method","name":"routes=","doc":null,"summary":null,"abstract":false,"args":[{"name":"routes","doc":null,"default_value":"","external_name":"routes","restriction":"Array(String)"}],"args_string":"(routes : Array(String))","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L33","def":{"name":"routes=","args":[{"name":"routes","doc":null,"default_value":"","external_name":"routes","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@routes = routes"}},{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":true,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L43","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"should_return_html(env)-instance-method","html_id":"should_return_html(env)-instance-method","name":"should_return_html","doc":null,"summary":null,"abstract":false,"args":[{"name":"env","doc":null,"default_value":"","external_name":"env","restriction":""}],"args_string":"(env)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L7","def":{"name":"should_return_html","args":[{"name":"env","doc":null,"default_value":"","external_name":"env","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"headers = env.request.headers\nif headers.has_key?(\"Accept\")\n return (headers[\"Accept\"].split(',')).includes?(\"text/html\")\nend\nfalse\n"}},{"id":"stats:Statistics-instance-method","html_id":"stats:Statistics-instance-method","name":"stats","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Statistics","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L20","def":{"name":"stats","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Statistics","visibility":"Public","body":"@stats"}},{"id":"stats=(stats:Statistics)-instance-method","html_id":"stats=(stats:Statistics)-instance-method","name":"stats=","doc":null,"summary":null,"abstract":false,"args":[{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"}],"args_string":"(stats : Statistics)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L20","def":{"name":"stats=","args":[{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@stats = stats"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Api/User","path":"StackCoin/Api/User.html","kind":"class","full_name":"StackCoin::Api::User","name":"User","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},"ancestors":[{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/user.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/user.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/user.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/user.cr#L8","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"get(\"/user/:id\") do |env|\n id = env.params.url[\"id\"].to_u64?\n if id.is_a?(Nil)\n halt(env, status_code: 403)\n end\n bal = @bank.balance(id)\n if bal.is_a?(Nil)\n halt(env, status_code: 404)\n end\n user = Hash(String, String | Int32).new\n user[\"id\"] = id.to_s\n user[\"bal\"] = bal.to_s\n if should_return_html(env)\n next render(\"src/views/user.ecr\")\n end\n user.to_json\nend\nget(\"/user/\") do |env|\n users = Hash(String, Hash(String, UInt64 | Int32)).new\n @stats.all_balances.each do |id, balance|\n users[id.to_s] = Hash(String, UInt64 | Int32).new\n users[id.to_s][\"id\"] = id\n users[id.to_s][\"bal\"] = balance\n end\n if should_return_html(env)\n next render(\"src/views/users.ecr\")\n end\n users.to_json\nend\n"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Auth","path":"StackCoin/Auth.html","kind":"class","full_name":"StackCoin::Auth","name":"Auth","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Database,bank:Bank,jwt_secret_key:String)-class-method","html_id":"new(db:DB::Database,bank:Bank,jwt_secret_key:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"jwt_secret_key","doc":null,"default_value":"","external_name":"jwt_secret_key","restriction":"String"}],"args_string":"(db : DB::Database, bank : Bank, jwt_secret_key : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L37","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"jwt_secret_key","doc":null,"default_value":"","external_name":"jwt_secret_key","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, bank, jwt_secret_key)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"authenticate(user_id:UInt64,token:String)-instance-method","html_id":"authenticate(user_id:UInt64,token:String)-instance-method","name":"authenticate","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"args_string":"(user_id : UInt64, token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L52","def":{"name":"authenticate","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@db.transaction do |tx|\n cnn = tx.connection\n token_exists = (cnn.query_one(\"SELECT EXISTS(SELECT 1 FROM token WHERE user_id = ?)\", user_id.to_s, as: Int)) == 1\n if token_exists\n else\n return Result::NoSuchAccount.new(tx, \"No such account\")\n end\n db_token = cnn.query_one(\"SELECT token FROM token WHERE user_id = ?\", user_id.to_s, as: String)\n if db_token == token\n else\n return Result::InvalidToken.new(tx, \"Invalid Token\")\n end\nend\ninvalid_at = (Time.utc + 1.seconds).to_s(\"%Y-%m-%d %H:%M:%S %:z\")\npayload = {\"user_id\" => user_id, \"invalid_at\" => invalid_at}\naccess_token = JWT.encode(payload, @jwt_secret_key, JWT::Algorithm::HS256)\nResult::Authenticated.new(\"Authenticated\", access_token)\n"}},{"id":"create_account_with_token(user_id:UInt64)-instance-method","html_id":"create_account_with_token(user_id:UInt64)-instance-method","name":"create_account_with_token","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L40","def":{"name":"create_account_with_token","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"result = @bank.open_account(user_id)\nif !result.is_a?(Bank::Result::Success)\n return result\nend\ntoken = Random::Secure.hex(32)\n@db.exec(\"INSERT INTO token VALUES (?, ?)\", user_id.to_s, token)\nResult::AccountCreated.new(\"Account created\", token)\n"}},{"id":"validate_access_token(access_token:String)-instance-method","html_id":"validate_access_token(access_token:String)-instance-method","name":"validate_access_token","doc":null,"summary":null,"abstract":false,"args":[{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":"String"}],"args_string":"(access_token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L77","def":{"name":"validate_access_token","args":[{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"payload, header = JWT.decode(access_token, @jwt_secret_key, JWT::Algorithm::HS256)\ninvalid_at = Time.parse_utc(payload[\"invalid_at\"].as_s, \"%Y-%m-%d %H:%M:%S %z\")\nis_valid_access_token = invalid_at > Time.utc\nif !is_valid_access_token\n return Result::InvalidAccessToken.new(\"Invalid access token\")\nend\nResult::ValidAccessToken.new(\"Valid access token\", payload[\"user_id\"].as_i64.to_u64)\n"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Auth/Result","path":"StackCoin/Auth/Result.html","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":5,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L5"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth","kind":"class","full_name":"StackCoin::Auth","name":"Auth"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Auth/Result/AccountCreated","path":"StackCoin/Auth/Result/AccountCreated.html","kind":"class","full_name":"StackCoin::Auth::Result::AccountCreated","name":"AccountCreated","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L6"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message,token)-class-method","html_id":"new(message,token)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":""}],"args_string":"(message, token)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L9","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message, token)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L6","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"token:String-instance-method","html_id":"token:String-instance-method","name":"token","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L7","def":{"name":"token","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@token"}},{"id":"token=(token:String)-instance-method","html_id":"token=(token:String)-instance-method","name":"token=","doc":null,"summary":null,"abstract":false,"args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"args_string":"(token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L7","def":{"name":"token=","args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@token = token"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/Authenticated","path":"StackCoin/Auth/Result/Authenticated.html","kind":"class","full_name":"StackCoin::Auth::Result::Authenticated","name":"Authenticated","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":13,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L13"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message,access_token)-class-method","html_id":"new(message,access_token)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":""}],"args_string":"(message, access_token)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L16","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message, access_token)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L13","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"access_token:String-instance-method","html_id":"access_token:String-instance-method","name":"access_token","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L14","def":{"name":"access_token","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@access_token"}},{"id":"access_token=(access_token:String)-instance-method","html_id":"access_token=(access_token:String)-instance-method","name":"access_token=","doc":null,"summary":null,"abstract":false,"args":[{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":"String"}],"args_string":"(access_token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L14","def":{"name":"access_token=","args":[{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@access_token = access_token"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/InvalidAccessToken","path":"StackCoin/Auth/Result/InvalidAccessToken.html","kind":"class","full_name":"StackCoin::Auth::Result::InvalidAccessToken","name":"InvalidAccessToken","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":27,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L27"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L27","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/InvalidToken","path":"StackCoin/Auth/Result/InvalidToken.html","kind":"class","full_name":"StackCoin::Auth::Result::InvalidToken","name":"InvalidToken","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":33,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L33"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L33","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/NoSuchAccount","path":"StackCoin/Auth/Result/NoSuchAccount.html","kind":"class","full_name":"StackCoin::Auth::Result::NoSuchAccount","name":"NoSuchAccount","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":30,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L30"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L30","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/ValidAccessToken","path":"StackCoin/Auth/Result/ValidAccessToken.html","kind":"class","full_name":"StackCoin::Auth::Result::ValidAccessToken","name":"ValidAccessToken","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":20,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L20"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message,user_id)-class-method","html_id":"new(message,user_id)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":""}],"args_string":"(message, user_id)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L23","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message, user_id)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L20","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"user_id:UInt64-instance-method","html_id":"user_id:UInt64-instance-method","name":"user_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L21","def":{"name":"user_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@user_id"}}],"macros":[],"types":[]}]}]},{"html_id":"stackcoin/StackCoin/Bank","path":"StackCoin/Bank.html","kind":"class","full_name":"StackCoin::Bank","name":"Bank","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Statistics","kind":"class","full_name":"StackCoin::Statistics","name":"Statistics"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Database,banned:Banned)-class-method","html_id":"new(db:DB::Database,banned:Banned)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"}],"args_string":"(db : DB::Database, banned : Banned)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L38","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, banned)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"balance(cnn:DB::Connection,user_id:UInt64)-instance-method","html_id":"balance(cnn:DB::Connection,user_id:UInt64)-instance-method","name":"balance","doc":null,"summary":null,"abstract":false,"args":[{"name":"cnn","doc":null,"default_value":"","external_name":"cnn","restriction":"DB::Connection"},{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(cnn : DB::Connection, user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L57","def":{"name":"balance","args":[{"name":"cnn","doc":null,"default_value":"","external_name":"cnn","restriction":"DB::Connection"},{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"cnn.query_one?(\"SELECT bal FROM balance WHERE user_id = ?\", user_id.to_s, as: Int32)"}},{"id":"balance(user_id:UInt64)-instance-method","html_id":"balance(user_id:UInt64)-instance-method","name":"balance","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L63","def":{"name":"balance","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@db.transaction do |tx|\n bal = self.balance(tx.connection, user_id)\n tx.commit\n return bal\nend"}},{"id":"db:DB::Database-instance-method","html_id":"db:DB::Database-instance-method","name":"db","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : DB::Database","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L41","def":{"name":"db","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@db"}},{"id":"deposit_dole(user_id:UInt64)-instance-method","html_id":"deposit_dole(user_id:UInt64)-instance-method","name":"deposit_dole","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L71","def":{"name":"deposit_dole","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"bal = 0\nnow = Time.utc\n@db.transaction do |tx|\n cnn = tx.connection\n expect_one = cnn.query_one(\"SELECT EXISTS(SELECT 1 FROM last_given_dole WHERE user_id = ?)\", user_id.to_s, as: Int)\n if expect_one == 0\n return Result::NoSuchAccount.new(tx, \"No account to deposit dole to\")\n end\n last_given = Database.parse_time(cnn.query_one(\"SELECT time FROM last_given_dole WHERE user_id = ?\", user_id.to_s, as: String))\n if last_given.day == now.day\n time_till_rollver = HumanizeTime.distance_of_time_in_words(Time.utc.at_end_of_day - Time.utc, Time.utc)\n return Result::PrematureDole.new(tx, \"Dole already received today, rollover in #{time_till_rollver}\")\n end\n self.deposit(cnn, user_id, @@dole_amount)\n cnn.exec(\"UPDATE last_given_dole SET time = ? WHERE user_id = ?\", now, user_id.to_s)\n bal = self.balance(cnn, user_id)\n args = [] of DB::Any\n args << user_id.to_s\n args << bal\n args << @@dole_amount\n args << now\n cnn.exec(\"INSERT INTO benefit(user_id, user_bal, amount, time) VALUES (?, ?, ?, ?)\", args: args)\nend\nResult::Success.new(\"#{@@dole_amount} StackCoin given, your balance is now #{bal}\")\n"}},{"id":"has_account(user_id:UInt64)-instance-method","html_id":"has_account(user_id:UInt64)-instance-method","name":"has_account","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L117","def":{"name":"has_account","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"0 < (@db.query_one(\"SELECT EXISTS(SELECT 1 FROM balance WHERE user_id = ?)\", user_id.to_s, as: Int))"}},{"id":"open_account(user_id:UInt64)-instance-method","html_id":"open_account(user_id:UInt64)-instance-method","name":"open_account","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L123","def":{"name":"open_account","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"initial_bal = 0\n@db.transaction do |tx|\n cnn = tx.connection\n expect_zero = cnn.query_one(\"SELECT EXISTS(SELECT 1 FROM balance WHERE user_id = ?)\", user_id.to_s, as: Int)\n if expect_zero > 0\n return Result::PreexistingAccount.new(tx, \"Account already open\")\n end\n cnn.exec(\"INSERT INTO balance VALUES (?, ?)\", user_id.to_s, initial_bal)\n cnn.exec(\"INSERT INTO last_given_dole VALUES (?, ?)\", user_id.to_s, EPOCH)\nend\nResult::Success.new(\"Account created, initial balance is #{initial_bal}\")\n"}},{"id":"transfer(from_id:UInt64,to_id:UInt64,amount:Int32)-instance-method","html_id":"transfer(from_id:UInt64,to_id:UInt64,amount:Int32)-instance-method","name":"transfer","doc":null,"summary":null,"abstract":false,"args":[{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":"UInt64"},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":"UInt64"},{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":"Int32"}],"args_string":"(from_id : UInt64, to_id : UInt64, amount : Int32)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L149","def":{"name":"transfer","args":[{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":"UInt64"},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":"UInt64"},{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if from_id == to_id\n return Result::TransferSelf.new(\"Can't transfer money to self\")\nend\nif amount > 0\nelse\n return Result::InvalidAmount.new(\"Amount must be greater than zero\")\nend\nif amount > 100000\n return Result::InvalidAmount.new(\"Amount can't be greater than 100000\")\nend\nif (@banned.is_banned(from_id)) || (@banned.is_banned(to_id))\n return Result::BannedUser.new(\"Banned user mentioned in transaction\")\nend\nfrom_balance, to_balance = 0, 0\n@db.transaction do |tx|\n cnn = tx.connection\n from_balance = self.balance(cnn, from_id)\n if !from_balance.is_a?(Int32)\n return Result::NoSuchAccount.new(tx, \"You don't have an account yet\")\n end\n to_balance = self.balance(cnn, to_id)\n if !to_balance.is_a?(Int32)\n return Result::NoSuchAccount.new(tx, \"User doesn't have an account yet\")\n end\n if (from_balance - amount) < 0\n return Result::InsufficientFunds.new(tx, \"Insufficient funds\")\n end\n from_balance = from_balance - amount\n self.withdraw(cnn, from_id, amount)\n to_balance = to_balance + amount\n self.deposit(cnn, to_id, amount)\n args = [] of DB::Any\n args << from_id.to_s\n args << from_balance\n args << to_id.to_s\n args << to_balance\n args << amount\n args << Time.utc\n cnn.exec(\"INSERT INTO ledger(\\n from_id, from_bal, to_id, to_bal, amount, time\\n) VALUES (\\n ?, ?, ?, ?, ?, ?\\n)\", args: args)\nend\nResult::TransferSuccess.new(\"Transfer sucessful\", from_balance, to_balance)\n"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Bank/Result","path":"StackCoin/Bank/Result.html","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":5,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L5"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank","kind":"class","full_name":"StackCoin::Bank","name":"Bank"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Bank/Result/BannedUser","path":"StackCoin/Bank/Result/BannedUser.html","kind":"class","full_name":"StackCoin::Bank::Result::BannedUser","name":"BannedUser","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":32,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L32"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L32","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/InsufficientFunds","path":"StackCoin/Bank/Result/InsufficientFunds.html","kind":"class","full_name":"StackCoin::Bank::Result::InsufficientFunds","name":"InsufficientFunds","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":29,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L29"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L29","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/InvalidAmount","path":"StackCoin/Bank/Result/InvalidAmount.html","kind":"class","full_name":"StackCoin::Bank::Result::InvalidAmount","name":"InvalidAmount","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":26,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L26"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L26","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/NoSuchAccount","path":"StackCoin/Bank/Result/NoSuchAccount.html","kind":"class","full_name":"StackCoin::Bank::Result::NoSuchAccount","name":"NoSuchAccount","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":17,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L17"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L17","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/PreexistingAccount","path":"StackCoin/Bank/Result/PreexistingAccount.html","kind":"class","full_name":"StackCoin::Bank::Result::PreexistingAccount","name":"PreexistingAccount","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":14,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L14"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L14","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/PrematureDole","path":"StackCoin/Bank/Result/PrematureDole.html","kind":"class","full_name":"StackCoin::Bank::Result::PrematureDole","name":"PrematureDole","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":20,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L20"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L20","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/TransferSelf","path":"StackCoin/Bank/Result/TransferSelf.html","kind":"class","full_name":"StackCoin::Bank::Result::TransferSelf","name":"TransferSelf","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":23,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L23"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L23","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/TransferSuccess","path":"StackCoin/Bank/Result/TransferSuccess.html","kind":"class","full_name":"StackCoin::Bank::Result::TransferSuccess","name":"TransferSuccess","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L6"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message,from_bal,to_bal)-class-method","html_id":"new(message,from_bal,to_bal)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":""},{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":""}],"args_string":"(message, from_bal, to_bal)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L10","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":""},{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message, from_bal, to_bal)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L6","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"from_bal:Int32-instance-method","html_id":"from_bal:Int32-instance-method","name":"from_bal","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L7","def":{"name":"from_bal","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@from_bal"}},{"id":"from_bal=(from_bal:Int32)-instance-method","html_id":"from_bal=(from_bal:Int32)-instance-method","name":"from_bal=","doc":null,"summary":null,"abstract":false,"args":[{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":"Int32"}],"args_string":"(from_bal : Int32)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L7","def":{"name":"from_bal=","args":[{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@from_bal = from_bal"}},{"id":"to_bal:Int32-instance-method","html_id":"to_bal:Int32-instance-method","name":"to_bal","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L8","def":{"name":"to_bal","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@to_bal"}},{"id":"to_bal=(to_bal:Int32)-instance-method","html_id":"to_bal=(to_bal:Int32)-instance-method","name":"to_bal=","doc":null,"summary":null,"abstract":false,"args":[{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":"Int32"}],"args_string":"(to_bal : Int32)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L8","def":{"name":"to_bal=","args":[{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@to_bal = to_bal"}}],"macros":[],"types":[]}]}]},{"html_id":"stackcoin/StackCoin/Banned","path":"StackCoin/Banned.html","kind":"class","full_name":"StackCoin::Banned","name":"Banned","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/banned.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Database)-class-method","html_id":"new(db:DB::Database)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"args_string":"(db : DB::Database)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L2","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"ban(user_id:UInt64)-instance-method","html_id":"ban(user_id:UInt64)-instance-method","name":"ban","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L22","def":{"name":"ban","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Banning '#{user_id}'\"\nend\n@banned_users << user_id\n@db.exec(\"INSERT INTO banned VALUES (?)\", args: [user_id.to_s])\n"}},{"id":"is_banned(user_id:UInt64)-instance-method","html_id":"is_banned(user_id:UInt64)-instance-method","name":"is_banned","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L18","def":{"name":"is_banned","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@banned_users.includes?(user_id)"}},{"id":"unban(user_id:UInt64)-instance-method","html_id":"unban(user_id:UInt64)-instance-method","name":"unban","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L31","def":{"name":"unban","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Unbanning '#{user_id}'\"\nend\n@banned_users.delete(user_id)\n@db.exec(\"DELETE FROM banned WHERE user_id = ?\", args: [user_id.to_s])\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot","path":"StackCoin/Bot.html","kind":"class","full_name":"StackCoin::Bot","name":"Bot","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L6"},{"filename":"src/stackcoin/commands/auth.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/auth.cr#L1"},{"filename":"src/stackcoin/commands/bal.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/bal.cr#L1"},{"filename":"src/stackcoin/commands/ban.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ban.cr#L1"},{"filename":"src/stackcoin/commands/base.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L1"},{"filename":"src/stackcoin/commands/circulation.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/circulation.cr#L1"},{"filename":"src/stackcoin/commands/dole.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L1"},{"filename":"src/stackcoin/commands/graph.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/graph.cr#L1"},{"filename":"src/stackcoin/commands/help.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L1"},{"filename":"src/stackcoin/commands/leaderboard.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/leaderboard.cr#L1"},{"filename":"src/stackcoin/commands/ledger.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ledger.cr#L1"},{"filename":"src/stackcoin/commands/mark.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/mark.cr#L1"},{"filename":"src/stackcoin/commands/open.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/open.cr#L1"},{"filename":"src/stackcoin/commands/send.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/send.cr#L1"},{"filename":"src/stackcoin/commands/unban.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/unban.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[{"id":"cleaned_message_content(prefix,message_content)-class-method","html_id":"cleaned_message_content(prefix,message_content)-class-method","name":"cleaned_message_content","doc":null,"summary":null,"abstract":false,"args":[{"name":"prefix","doc":null,"default_value":"","external_name":"prefix","restriction":""},{"name":"message_content","doc":null,"default_value":"","external_name":"message_content","restriction":""}],"args_string":"(prefix, message_content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L36","def":{"name":"cleaned_message_content","args":[{"name":"prefix","doc":null,"default_value":"","external_name":"prefix","restriction":""},{"name":"message_content","doc":null,"default_value":"","external_name":"message_content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"cleaned = (message_content.strip.split(' ')).select do |i|\n i != \"\"\nend\ncleaned[0] = (Bot.simplified_message_content_for_parsing(cleaned[0])).lchop(prefix)\nif (cleaned[0] == \"\") && cleaned.size >= 2\n cleaned.shift\n cleaned[0] = cleaned[0].downcase.lchop(prefix)\nend\ncleaned\n"}},{"id":"simplified_message_content_for_parsing(message_content)-class-method","html_id":"simplified_message_content_for_parsing(message_content)-class-method","name":"simplified_message_content_for_parsing","doc":null,"summary":null,"abstract":false,"args":[{"name":"message_content","doc":null,"default_value":"","external_name":"message_content","restriction":""}],"args_string":"(message_content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L32","def":{"name":"simplified_message_content_for_parsing","args":[{"name":"message_content","doc":null,"default_value":"","external_name":"message_content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"message_content.downcase.gsub(\"$\", \"s\")"}}],"constructors":[{"id":"new(config:Config,bank:Bank,stats:Statistics,auth:StackCoin::Auth,banned:Banned,designated_channel:StackCoin::DesignatedChannel)-class-method","html_id":"new(config:Config,bank:Bank,stats:Statistics,auth:StackCoin::Auth,banned:Banned,designated_channel:StackCoin::DesignatedChannel)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"},{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":"StackCoin::DesignatedChannel"}],"args_string":"(config : Config, bank : Bank, stats : Statistics, auth : StackCoin::Auth, banned : Banned, designated_channel : StackCoin::DesignatedChannel)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L49","def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"},{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":"StackCoin::DesignatedChannel"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(config, bank, stats, auth, banned, designated_channel)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"run!-instance-method","html_id":"run!-instance-method","name":"run!","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L130","def":{"name":"run!","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Running Discord client\"\nend\n@client.run\n"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Bot/Auth","path":"StackCoin/Bot/Auth.html","kind":"class","full_name":"StackCoin::Bot::Auth","name":"Auth","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/auth.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/auth.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/auth.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/auth.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if message.author.id != @config.owner_id\n return Result::Error.new(@client, message, \"Command only for use by bots owner!\")\nend\nmentions = Discord::Mention.parse(message.content)\nif mentions.size != 2\n return Result::Error.new(@client, message, \"Too many/little mentions in your message; two is expected\")\nend\nbot_user_mention = mentions[0]\nif !bot_user_mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message\")\nend\nif bot_user_mention.id.to_u64 == @config.client_id\n return Result::Error.new(@client, message, \"StackCoin itself can't have an account with itself!\")\nend\nbot_user = @cache.resolve_user(bot_user_mention.id)\nif !bot_user.bot\n return Result::Error.new(@client, message, \"Mentioned a non-bot user as the bot user in your message\")\nend\nbot_users_owner_mention = mentions[1]\nif !bot_users_owner_mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message\")\nend\nbot_users_owner = @cache.resolve_user(bot_users_owner_mention.id)\nif bot_users_owner.bot\n return Result::Error.new(@client, message, \"Mentioned a bot user as the bot users owner in your message\")\nend\nresult = @auth.create_account_with_token(bot_user.id.to_u64)\nif !result.is_a?(StackCoin::Auth::Result::AccountCreated)\n return Result::Error.new(@client, message, result.message)\nend\nbegin\n private_channel = @client.create_dm(bot_users_owner.id)\n response = \"Check your direct messages for a token from StackCoin :)\"\n token_message = \"Here's your token to access the StackCoin API from #{bot_user.username}: ```#{result.token}```\"\n send_msg(@client, private_channel.id, token_message)\nrescue Discord::CodeException\n owner = @cache.resolve_user(@config.owner_id)\n response = \"Direct message containing token failed to send (maybe you have DMs locked down?), ask #{owner.username} for your token instead :)\"\n token_message = \"#{bot_users_owner.username}##{bot_users_owner.discriminator}'s (#{bot_users_owner.id}) token to access the StackCoin API: ```#{result.token}```\"\n owners_private_channel = @client.create_dm(@config.owner_id)\n send_msg(@client, owners_private_channel.id, token_message)\nend\nsend_emb(message, Discord::Embed.new(title: \"_Token-authenticated bot user initialized_:\", fields: [Discord::EmbedField.new(name: \"#{message.author.username}\", value: response)]))\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Bal","path":"StackCoin/Bot/Bal.html","kind":"class","full_name":"StackCoin::Bot::Bal","name":"Bal","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/bal.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/bal.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/bal.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/bal.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"mentions = Discord::Mention.parse(message.content)\nif mentions.size > 1\n return Result::Error.new(@client, message, \"Too many mentions in your message; max is one\")\nend\nprefix = \"You don't\"\nuser = message.author\nbal = nil\nif mentions.size > 0\n mention = mentions[0]\n if !mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned entity isn't a user!\")\n end\n user = @cache.resolve_user(mention.id)\n bal = @bank.balance(mention.id.to_u64)\n if mention.id != message.author.id\n prefix = \"User doesn't\"\n end\nelse\n bal = @bank.balance(message.author.id.to_u64)\nend\nif bal.is_a?(Nil)\n return Result::Error.new(@client, message, \"#{prefix} have an account, run #{@config.prefix}open to create an account\")\nend\nsend_emb(message, Discord::Embed.new(title: \"_Balance:_\", fields: [Discord::EmbedField.new(name: \"#{user.username}\", value: \"#{bal}\")]))\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Ban","path":"StackCoin/Bot/Ban.html","kind":"class","full_name":"StackCoin::Bot::Ban","name":"Ban","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/ban.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ban.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ban.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ban.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if message.author.id != @config.owner_id\n return Result::Error.new(@client, message, \"Command only for use by bots owner!\")\nend\nmentions = Discord::Mention.parse(message.content)\nif mentions.size != 1\n return Result::Error.new(@client, message, \"Too many/little mentions in your message; one is expected\")\nend\nuser_mention = mentions[0]\nif !user_mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message: #{user_mention}\")\nend\nuser_id = user_mention.id.to_u64\nis_banned = @banned.is_banned(user_id)\nif is_banned\n return Result::Error.new(@client, message, \"User <@#{user_mention.id}> is already banned\")\nend\n@banned.ban(user_id)\nsend_msg(message, \"❌ User <@#{user_mention.id}> banned ❌\")\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Circulation","path":"StackCoin/Bot/Circulation.html","kind":"class","full_name":"StackCoin::Bot::Circulation","name":"Circulation","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/circulation.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/circulation.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/circulation.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/circulation.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"send_emb(message, Discord::Embed.new(title: \"_Total StackCoin in Circulation:_\", fields: [Discord::EmbedField.new(name: \"#{@stats.circulation} STK\", value: \"Since #{EPOCH}\")]))"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Command","path":"StackCoin/Bot/Command.html","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command","abstract":true,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/base.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Bot/Auth","kind":"class","full_name":"StackCoin::Bot::Auth","name":"Auth"},{"html_id":"stackcoin/StackCoin/Bot/Bal","kind":"class","full_name":"StackCoin::Bot::Bal","name":"Bal"},{"html_id":"stackcoin/StackCoin/Bot/Ban","kind":"class","full_name":"StackCoin::Bot::Ban","name":"Ban"},{"html_id":"stackcoin/StackCoin/Bot/Circulation","kind":"class","full_name":"StackCoin::Bot::Circulation","name":"Circulation"},{"html_id":"stackcoin/StackCoin/Bot/Dole","kind":"class","full_name":"StackCoin::Bot::Dole","name":"Dole"},{"html_id":"stackcoin/StackCoin/Bot/Graph","kind":"class","full_name":"StackCoin::Bot::Graph","name":"Graph"},{"html_id":"stackcoin/StackCoin/Bot/Help","kind":"class","full_name":"StackCoin::Bot::Help","name":"Help"},{"html_id":"stackcoin/StackCoin/Bot/Leaderboard","kind":"class","full_name":"StackCoin::Bot::Leaderboard","name":"Leaderboard"},{"html_id":"stackcoin/StackCoin/Bot/Ledger","kind":"class","full_name":"StackCoin::Bot::Ledger","name":"Ledger"},{"html_id":"stackcoin/StackCoin/Bot/Mark","kind":"class","full_name":"StackCoin::Bot::Mark","name":"Mark"},{"html_id":"stackcoin/StackCoin/Bot/Open","kind":"class","full_name":"StackCoin::Bot::Open","name":"Open"},{"html_id":"stackcoin/StackCoin/Bot/Send","kind":"class","full_name":"StackCoin::Bot::Send","name":"Send"},{"html_id":"stackcoin/StackCoin/Bot/Unban","kind":"class","full_name":"StackCoin::Bot::Unban","name":"Unban"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[{"id":"lookup:Hash(String,Command)-class-method","html_id":"lookup:Hash(String,Command)-class-method","name":"lookup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Hash(String, Command)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L5","def":{"name":"lookup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Hash(String, Command)","visibility":"Public","body":"@@lookup"}}],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L19","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"auth:StackCoin::Auth-instance-method","html_id":"auth:StackCoin::Auth-instance-method","name":"auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Auth","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L14","def":{"name":"auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Auth","visibility":"Public","body":"@auth"}},{"id":"auth=(auth:StackCoin::Auth)-instance-method","html_id":"auth=(auth:StackCoin::Auth)-instance-method","name":"auth=","doc":null,"summary":null,"abstract":false,"args":[{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"args_string":"(auth : StackCoin::Auth)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L14","def":{"name":"auth=","args":[{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@auth = auth"}},{"id":"bank:Bank-instance-method","html_id":"bank:Bank-instance-method","name":"bank","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bank","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L12","def":{"name":"bank","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bank","visibility":"Public","body":"@bank"}},{"id":"bank=(bank:Bank)-instance-method","html_id":"bank=(bank:Bank)-instance-method","name":"bank=","doc":null,"summary":null,"abstract":false,"args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"}],"args_string":"(bank : Bank)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L12","def":{"name":"bank=","args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@bank = bank"}},{"id":"banned:Banned-instance-method","html_id":"banned:Banned-instance-method","name":"banned","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Banned","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L15","def":{"name":"banned","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Banned","visibility":"Public","body":"@banned"}},{"id":"banned=(banned:Banned)-instance-method","html_id":"banned=(banned:Banned)-instance-method","name":"banned=","doc":null,"summary":null,"abstract":false,"args":[{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"}],"args_string":"(banned : Banned)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L15","def":{"name":"banned=","args":[{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@banned = banned"}},{"id":"cache:Discord::Cache-instance-method","html_id":"cache:Discord::Cache-instance-method","name":"cache","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Cache","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L11","def":{"name":"cache","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Cache","visibility":"Public","body":"@cache"}},{"id":"cache=(cache:Discord::Cache)-instance-method","html_id":"cache=(cache:Discord::Cache)-instance-method","name":"cache=","doc":null,"summary":null,"abstract":false,"args":[{"name":"cache","doc":null,"default_value":"","external_name":"cache","restriction":"Discord::Cache"}],"args_string":"(cache : Discord::Cache)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L11","def":{"name":"cache=","args":[{"name":"cache","doc":null,"default_value":"","external_name":"cache","restriction":"Discord::Cache"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@cache = cache"}},{"id":"client:Discord::Client-instance-method","html_id":"client:Discord::Client-instance-method","name":"client","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Client","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L10","def":{"name":"client","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Client","visibility":"Public","body":"@client"}},{"id":"client=(client:Discord::Client)-instance-method","html_id":"client=(client:Discord::Client)-instance-method","name":"client=","doc":null,"summary":null,"abstract":false,"args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":"Discord::Client"}],"args_string":"(client : Discord::Client)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L10","def":{"name":"client=","args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":"Discord::Client"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@client = client"}},{"id":"config:Config-instance-method","html_id":"config:Config-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Config","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L17","def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Config","visibility":"Public","body":"@config"}},{"id":"config=(config:Config)-instance-method","html_id":"config=(config:Config)-instance-method","name":"config=","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L17","def":{"name":"config=","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config = config"}},{"id":"desc:String-instance-method","html_id":"desc:String-instance-method","name":"desc","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L9","def":{"name":"desc","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@desc"}},{"id":"designated_channel:DesignatedChannel-instance-method","html_id":"designated_channel:DesignatedChannel-instance-method","name":"designated_channel","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : DesignatedChannel","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L16","def":{"name":"designated_channel","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DesignatedChannel","visibility":"Public","body":"@designated_channel"}},{"id":"designated_channel=(designated_channel:DesignatedChannel)-instance-method","html_id":"designated_channel=(designated_channel:DesignatedChannel)-instance-method","name":"designated_channel=","doc":null,"summary":null,"abstract":false,"args":[{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":"DesignatedChannel"}],"args_string":"(designated_channel : DesignatedChannel)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L16","def":{"name":"designated_channel=","args":[{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":"DesignatedChannel"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@designated_channel = designated_channel"}},{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":true,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L54","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"send_emb(message,content,emb:Discord::Embed)-instance-method","html_id":"send_emb(message,content,emb:Discord::Embed)-instance-method","name":"send_emb","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""},{"name":"emb","doc":null,"default_value":"","external_name":"emb","restriction":"Discord::Embed"}],"args_string":"(message, content, emb : Discord::Embed)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L44","def":{"name":"send_emb","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""},{"name":"emb","doc":null,"default_value":"","external_name":"emb","restriction":"Discord::Embed"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"emb.colour = 16773120\nemb.timestamp = Time.utc\nemb.footer = Discord::EmbedFooter.new(text: \"StackCoin™\", icon_url: \"https://i.imgur.com/CsVxtvM.png\")\n@client.create_message(message.channel_id, content, emb)\n"}},{"id":"send_emb(message,emb:Discord::Embed)-instance-method","html_id":"send_emb(message,emb:Discord::Embed)-instance-method","name":"send_emb","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"emb","doc":null,"default_value":"","external_name":"emb","restriction":"Discord::Embed"}],"args_string":"(message, emb : Discord::Embed)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L40","def":{"name":"send_emb","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"emb","doc":null,"default_value":"","external_name":"emb","restriction":"Discord::Embed"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.send_emb(message, \"\", emb)"}},{"id":"send_msg(message,channel_id,content)-instance-method","html_id":"send_msg(message,channel_id,content)-instance-method","name":"send_msg","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"args_string":"(message, channel_id, content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L36","def":{"name":"send_msg","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@client.create_message(channel_id, content)"}},{"id":"send_msg(message,content)-instance-method","html_id":"send_msg(message,content)-instance-method","name":"send_msg","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"args_string":"(message, content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L32","def":{"name":"send_msg","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@client.create_message(message.channel_id, content)"}},{"id":"stats:Statistics-instance-method","html_id":"stats:Statistics-instance-method","name":"stats","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Statistics","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L13","def":{"name":"stats","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Statistics","visibility":"Public","body":"@stats"}},{"id":"stats=(stats:Statistics)-instance-method","html_id":"stats=(stats:Statistics)-instance-method","name":"stats=","doc":null,"summary":null,"abstract":false,"args":[{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"}],"args_string":"(stats : Statistics)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L13","def":{"name":"stats=","args":[{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@stats = stats"}},{"id":"trigger:String-instance-method","html_id":"trigger:String-instance-method","name":"trigger","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L7","def":{"name":"trigger","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@trigger"}},{"id":"usage:String?-instance-method","html_id":"usage:String?-instance-method","name":"usage","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String?","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L8","def":{"name":"usage","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | Nil","visibility":"Public","body":"@usage"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Context","path":"StackCoin/Bot/Context.html","kind":"class","full_name":"StackCoin::Bot::Context","name":"Context","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":18,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L18"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(client,cache,bank,stats,auth,banned,designated_channel,config)-class-method","html_id":"new(client,cache,bank,stats,auth,banned,designated_channel,config)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"cache","doc":null,"default_value":"","external_name":"cache","restriction":""},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":""},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":""},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":""},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":""},{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":""},{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":""}],"args_string":"(client, cache, bank, stats, auth, banned, designated_channel, config)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L28","def":{"name":"new","args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"cache","doc":null,"default_value":"","external_name":"cache","restriction":""},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":""},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":""},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":""},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":""},{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":""},{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(client, cache, bank, stats, auth, banned, designated_channel, config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"auth:StackCoin::Auth-instance-method","html_id":"auth:StackCoin::Auth-instance-method","name":"auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Auth","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L23","def":{"name":"auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Auth","visibility":"Public","body":"@auth"}},{"id":"bank:Bank-instance-method","html_id":"bank:Bank-instance-method","name":"bank","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bank","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L21","def":{"name":"bank","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bank","visibility":"Public","body":"@bank"}},{"id":"banned:StackCoin::Banned-instance-method","html_id":"banned:StackCoin::Banned-instance-method","name":"banned","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Banned","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L24","def":{"name":"banned","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Banned","visibility":"Public","body":"@banned"}},{"id":"cache:Discord::Cache-instance-method","html_id":"cache:Discord::Cache-instance-method","name":"cache","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Cache","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L20","def":{"name":"cache","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Cache","visibility":"Public","body":"@cache"}},{"id":"client:Discord::Client-instance-method","html_id":"client:Discord::Client-instance-method","name":"client","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Client","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L19","def":{"name":"client","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Client","visibility":"Public","body":"@client"}},{"id":"config:Config-instance-method","html_id":"config:Config-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Config","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L26","def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Config","visibility":"Public","body":"@config"}},{"id":"designated_channel:StackCoin::DesignatedChannel-instance-method","html_id":"designated_channel:StackCoin::DesignatedChannel-instance-method","name":"designated_channel","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::DesignatedChannel","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L25","def":{"name":"designated_channel","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::DesignatedChannel","visibility":"Public","body":"@designated_channel"}},{"id":"stats:Statistics-instance-method","html_id":"stats:Statistics-instance-method","name":"stats","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Statistics","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L22","def":{"name":"stats","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Statistics","visibility":"Public","body":"@stats"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Dole","path":"StackCoin/Bot/Dole.html","kind":"class","full_name":"StackCoin::Bot::Dole","name":"Dole","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/dole.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L22","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"send_msg(message, (@bank.deposit_dole(message.author.id.to_u64)).message)"}},{"id":"memes(message)-instance-method","html_id":"memes(message)-instance-method","name":"memes","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L9","def":{"name":"memes","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case message.author.id.to_u64\nwhen 134337759446958081_u64\nwhen 120571255635181568_u64\nwhen 140981598987354112_u64\nwhen 72073771468468224_u64\nwhen 72069821960822784_u64\nwhen 163415804761735170_u64\nwhen 636346308403134484_u64\nelse\nend"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Graph","path":"StackCoin/Bot/Graph.html","kind":"class","full_name":"StackCoin::Bot::Graph","name":"Graph","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/graph.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/graph.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/graph.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/graph.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"mentions = Discord::Mention.parse(message.content)\nif mentions.size > 1\n return Result::Error.new(@client, message, \"Too many mentions in your message; max is one\")\nend\nprefix = \"You don't\"\nid = message.author.id\nuser = message.author\nif mentions.size > 0\n mention = mentions[0]\n if !mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned entity isn't a user!\")\n end\n id = mention.id\n user = @cache.resolve_user(mention.id)\n if mention.id != message.author.id\n prefix = \"User doesn't\"\n end\nend\nid = id.to_u64\nif !(@bank.has_account(id))\n return Result::Error.new(@client, message, \"#{prefix} have an account to see a graph of!\")\nend\nresult = @stats.graph(id)\nif result.is_a?(Statistics::Result::Graph::Success)\n @client.upload_file(channel_id: message.channel_id, content: \"#{user.username}'s STK balance over time\", file: result.file)\n result.file.delete\nelse\n client.create_message(message.channel_id, result.message)\nend\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Help","path":"StackCoin/Bot/Help.html","kind":"class","full_name":"StackCoin::Bot::Help","name":"Help","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/help.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L6","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L35","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"msg_parts = Bot.cleaned_message_content(@config.prefix, message.content)\nif msg_parts.size > 2\n return Result::Error.new(@client, message, \"Too many arguments in message, found #{msg_parts.size}\")\nend\nif msg_parts.size == 1\n send_emb(message, @root_help)\nelse\n command = msg_parts.last\n if @sub_help.has_key?(command)\n send_emb(message, @sub_help[command])\n else\n postfix = \"\"\n potential = Levenshtein.find(command, @sub_help.keys)\n if potential\n postfix = \", did you mean #{potential}?\"\n end\n Result::Error.new(@client, message, \"Unknown help section: #{command}#{postfix}\")\n end\nend\n"}},{"id":"root_help:Discord::Embed-instance-method","html_id":"root_help:Discord::Embed-instance-method","name":"root_help","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Embed","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L3","def":{"name":"root_help","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@root_help"}},{"id":"root_help=(root_help)-instance-method","html_id":"root_help=(root_help)-instance-method","name":"root_help=","doc":null,"summary":null,"abstract":false,"args":[{"name":"root_help","doc":null,"default_value":"","external_name":"root_help","restriction":""}],"args_string":"(root_help)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L3","def":{"name":"root_help=","args":[{"name":"root_help","doc":null,"default_value":"","external_name":"root_help","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@root_help = root_help"}},{"id":"sub_help:Hash(String,Discord::Embed)-instance-method","html_id":"sub_help:Hash(String,Discord::Embed)-instance-method","name":"sub_help","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Hash(String, Discord::Embed)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L4","def":{"name":"sub_help","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sub_help"}},{"id":"sub_help=(sub_help)-instance-method","html_id":"sub_help=(sub_help)-instance-method","name":"sub_help=","doc":null,"summary":null,"abstract":false,"args":[{"name":"sub_help","doc":null,"default_value":"","external_name":"sub_help","restriction":""}],"args_string":"(sub_help)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L4","def":{"name":"sub_help=","args":[{"name":"sub_help","doc":null,"default_value":"","external_name":"sub_help","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sub_help = sub_help"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Leaderboard","path":"StackCoin/Bot/Leaderboard.html","kind":"class","full_name":"StackCoin::Bot::Leaderboard","name":"Leaderboard","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/leaderboard.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/leaderboard.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/leaderboard.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/leaderboard.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"fields = [] of Discord::EmbedField\n@stats.leaderboard.each_with_index do |res, i|\n user = @cache.resolve_user(res[0])\n fields << Discord::EmbedField.new(name: \"##{i + 1}: #{user.username}\", value: \"Balance: #{res[1]}\")\nend\nsend_emb(message, Discord::Embed.new(title: \"_Leaderboard:_\", fields: fields))\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Ledger","path":"StackCoin/Bot/Ledger.html","kind":"class","full_name":"StackCoin::Bot::Ledger","name":"Ledger","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/ledger.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ledger.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ledger.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ledger.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"dates = [] of String\nfrom_ids = [] of UInt64\nto_ids = [] of UInt64\nfields = [] of Discord::EmbedField\ncondition_context = [] of String\nyyy_mm_dd_regex = /([12]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01]))/\nmatches = message.content.scan(yyy_mm_dd_regex)\nif matches.size > 1\n return Result::Error.new(@client, message, \"Too many yyyy-mm-dd string in your message; max is one\")\nend\nif matches.size > 0\n date = matches[0][1]\n dates << date\n condition_context << \"Occured on #{date}\"\nend\nmentions = Discord::Mention.parse(message.content)\nif mentions.size > 2\n return Result::Error.new(@client, message, \"Too many mentions in your message; max is two\")\nend\nmentions.each do |mentioned|\n if !mentioned.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message\")\n else\n from_ids << mentioned.id\n to_ids << mentioned.id\n condition_context << \"Mentions #{(@cache.resolve_user(mentioned.id)).username}\"\n end\nend\nreport = @stats.ledger(dates, from_ids, to_ids)\nreport.results.each_with_index do |result, i|\n begin\n from = (@cache.resolve_user(result.from_id)).username\n rescue Discord::CodeException\n from = \"(?)\"\n end\n begin\n to = (@cache.resolve_user(result.to_id)).username\n rescue Discord::CodeException\n to = \"(?)\"\n end\n fields << Discord::EmbedField.new(name: \"#{i + 1} - #{result.time}\", value: \"#{from} (#{result.from_bal}) ⟶ #{to} (#{result.to_bal}) - #{result.amount} STK\")\nend\nif condition_context.size == 0\n condition_context << \"Most recent\"\nend\nif fields.size == 0\n fields << Discord::EmbedField.new(name: \"*crickets*\", value: \"Seems like no transactions were found in the ledger :(\")\nend\ntitle = \"_Searching ledger by_:\"\ncondition_context.each do |cond|\n title = title + \"\\n- #{cond}\"\nend\nsend_emb(message, Discord::Embed.new(title: title, fields: fields))\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Mark","path":"StackCoin/Bot/Mark.html","kind":"class","full_name":"StackCoin::Bot::Mark","name":"Mark","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/mark.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/mark.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/mark.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/mark.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if message.author.id != @config.owner_id\n return Result::Error.new(@client, message, \"Command only for use by bots owner!\")\nend\nguild_id = message.guild_id.not_nil!\nchannel_id = message.channel_id\n@designated_channel.mark(guild_id, channel_id)\nsend_msg(message, \"Channel <##{channel_id}> marked as the designated channel in this guild\")\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Open","path":"StackCoin/Bot/Open.html","kind":"class","full_name":"StackCoin::Bot::Open","name":"Open","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/open.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/open.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/open.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/open.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"send_msg(message, (@bank.open_account(message.author.id.to_u64)).message)"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Result","path":"StackCoin/Bot/Result.html","kind":"class","full_name":"StackCoin::Bot::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":7,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L7"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Bot/Result/Base","path":"StackCoin/Bot/Result/Base.html","kind":"class","full_name":"StackCoin::Bot::Result::Base","name":"Base","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":8,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L8"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Bot/Result/Error","kind":"class","full_name":"StackCoin::Bot::Result::Error","name":"Error"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot/Result","kind":"class","full_name":"StackCoin::Bot::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(client,message,content)-class-method","html_id":"new(client,message,content)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"args_string":"(client, message, content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L9","def":{"name":"new","args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(client, message, content)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Result/Error","path":"StackCoin/Bot/Result/Error.html","kind":"class","full_name":"StackCoin::Bot::Result::Error","name":"Error","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Result/Base","kind":"class","full_name":"StackCoin::Bot::Result::Base","name":"Base"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Result/Base","kind":"class","full_name":"StackCoin::Bot::Result::Base","name":"Base"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":14,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L14"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot/Result","kind":"class","full_name":"StackCoin::Bot::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Bot/Send","path":"StackCoin/Bot/Send.html","kind":"class","full_name":"StackCoin::Bot::Send","name":"Send","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/send.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/send.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/send.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/send.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"mentions = Discord::Mention.parse(message.content)\nif mentions.size != 1\n return Result::Error.new(@client, message, \"Too many/little mentions in your message; max is one\")\nend\nmention = mentions[0]\nif !mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message\")\nend\nmsg_parts = Bot.cleaned_message_content(@config.prefix, message.content)\nif msg_parts.size > 3\n return Result::Error.new(@client, message, \"Too many arguments in message, found #{msg_parts.size}\")\nend\namount = msg_parts.last.to_i?\nif amount.is_a?(Nil)\n return Result::Error.new(@client, message, \"Invalid amount: #{msg_parts.last}\")\nend\nresult = @bank.transfer(message.author.id.to_u64, mention.id, amount)\nif result.is_a?(Bank::Result::TransferSuccess)\n to = @cache.resolve_user(mention.id)\n send_emb(message, Discord::Embed.new(title: \"_Transaction complete_:\", fields: [Discord::EmbedField.new(name: \"#{message.author.username}\", value: \"New bal: #{result.from_bal}\"), Discord::EmbedField.new(name: \"#{to.username}\", value: \"New bal: #{result.to_bal}\")]))\nelse\n Result::Error.new(@client, message, result.message)\nend\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Unban","path":"StackCoin/Bot/Unban.html","kind":"class","full_name":"StackCoin::Bot::Unban","name":"Unban","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/unban.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/unban.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/unban.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/unban.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if message.author.id != @config.owner_id\n return Result::Error.new(@client, message, \"Command only for use by bots owner!\")\nend\nmentions = Discord::Mention.parse(message.content)\nif mentions.size != 1\n return Result::Error.new(@client, message, \"Too many/little mentions in your message; one is expected\")\nend\nuser_mention = mentions[0]\nif !user_mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message: #{user_mention}\")\nend\nuser_id = user_mention.id.to_u64\nis_banned = @banned.is_banned(user_id)\nif !is_banned\n return Result::Error.new(@client, message, \"User <@#{user_mention.id}> is not banned\")\nend\n@banned.unban(user_id)\nsend_msg(message, \"👌 User <@#{user_mention.id}> unbanned 👌\")\n"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Config","path":"StackCoin/Config.html","kind":"class","full_name":"StackCoin::Config","name":"Config","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/config.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[{"id":"from_env-class-method","html_id":"from_env-class-method","name":"from_env","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L10","def":{"name":"from_env","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Configuring bot from environment variables\"\nend\nconfig = Config.new\nconfig.token = \"Bot #{ENV[\"STACKCOIN_DISCORD_TOKEN\"]}\"\nconfig.client_id = ENV[\"STACKCOIN_DISCORD_CLIENT_ID\"].to_u64\nconfig.prefix = ENV[\"STACKCOIN_PREFIX\"]\nconfig.test_guild_snowflake = Discord::Snowflake.new(ENV[\"STACKCOIN_TEST_GUILD_SNOWFLAKE\"])\nconfig.database_url = ENV[\"STACKCOIN_DATABASE_URL\"]\nconfig.jwt_secret_key = ENV[\"STACKCOIN_JWT_SECRET_KEY\"]\nconfig.owner_id = Discord::Snowflake.new(ENV[\"STACKCOIN_OWNER_ID\"])\nconfig\n"}}],"constructors":[],"instance_methods":[{"id":"client_id:UInt64-instance-method","html_id":"client_id:UInt64-instance-method","name":"client_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L3","def":{"name":"client_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@client_id"}},{"id":"client_id=(client_id:UInt64)-instance-method","html_id":"client_id=(client_id:UInt64)-instance-method","name":"client_id=","doc":null,"summary":null,"abstract":false,"args":[{"name":"client_id","doc":null,"default_value":"","external_name":"client_id","restriction":"UInt64"}],"args_string":"(client_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L3","def":{"name":"client_id=","args":[{"name":"client_id","doc":null,"default_value":"","external_name":"client_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@client_id = client_id"}},{"id":"database_url:String-instance-method","html_id":"database_url:String-instance-method","name":"database_url","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L6","def":{"name":"database_url","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@database_url"}},{"id":"database_url=(database_url:String)-instance-method","html_id":"database_url=(database_url:String)-instance-method","name":"database_url=","doc":null,"summary":null,"abstract":false,"args":[{"name":"database_url","doc":null,"default_value":"","external_name":"database_url","restriction":"String"}],"args_string":"(database_url : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L6","def":{"name":"database_url=","args":[{"name":"database_url","doc":null,"default_value":"","external_name":"database_url","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@database_url = database_url"}},{"id":"jwt_secret_key:String-instance-method","html_id":"jwt_secret_key:String-instance-method","name":"jwt_secret_key","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L7","def":{"name":"jwt_secret_key","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@jwt_secret_key"}},{"id":"jwt_secret_key=(jwt_secret_key:String)-instance-method","html_id":"jwt_secret_key=(jwt_secret_key:String)-instance-method","name":"jwt_secret_key=","doc":null,"summary":null,"abstract":false,"args":[{"name":"jwt_secret_key","doc":null,"default_value":"","external_name":"jwt_secret_key","restriction":"String"}],"args_string":"(jwt_secret_key : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L7","def":{"name":"jwt_secret_key=","args":[{"name":"jwt_secret_key","doc":null,"default_value":"","external_name":"jwt_secret_key","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@jwt_secret_key = jwt_secret_key"}},{"id":"owner_id:Discord::Snowflake-instance-method","html_id":"owner_id:Discord::Snowflake-instance-method","name":"owner_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Snowflake","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L8","def":{"name":"owner_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Snowflake","visibility":"Public","body":"@owner_id"}},{"id":"owner_id=(owner_id:Discord::Snowflake)-instance-method","html_id":"owner_id=(owner_id:Discord::Snowflake)-instance-method","name":"owner_id=","doc":null,"summary":null,"abstract":false,"args":[{"name":"owner_id","doc":null,"default_value":"","external_name":"owner_id","restriction":"Discord::Snowflake"}],"args_string":"(owner_id : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L8","def":{"name":"owner_id=","args":[{"name":"owner_id","doc":null,"default_value":"","external_name":"owner_id","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@owner_id = owner_id"}},{"id":"prefix:String-instance-method","html_id":"prefix:String-instance-method","name":"prefix","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L4","def":{"name":"prefix","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@prefix"}},{"id":"prefix=(prefix:String)-instance-method","html_id":"prefix=(prefix:String)-instance-method","name":"prefix=","doc":null,"summary":null,"abstract":false,"args":[{"name":"prefix","doc":null,"default_value":"","external_name":"prefix","restriction":"String"}],"args_string":"(prefix : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L4","def":{"name":"prefix=","args":[{"name":"prefix","doc":null,"default_value":"","external_name":"prefix","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@prefix = prefix"}},{"id":"test_guild_snowflake:Discord::Snowflake-instance-method","html_id":"test_guild_snowflake:Discord::Snowflake-instance-method","name":"test_guild_snowflake","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Snowflake","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L5","def":{"name":"test_guild_snowflake","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Snowflake","visibility":"Public","body":"@test_guild_snowflake"}},{"id":"test_guild_snowflake=(test_guild_snowflake:Discord::Snowflake)-instance-method","html_id":"test_guild_snowflake=(test_guild_snowflake:Discord::Snowflake)-instance-method","name":"test_guild_snowflake=","doc":null,"summary":null,"abstract":false,"args":[{"name":"test_guild_snowflake","doc":null,"default_value":"","external_name":"test_guild_snowflake","restriction":"Discord::Snowflake"}],"args_string":"(test_guild_snowflake : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L5","def":{"name":"test_guild_snowflake=","args":[{"name":"test_guild_snowflake","doc":null,"default_value":"","external_name":"test_guild_snowflake","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@test_guild_snowflake = test_guild_snowflake"}},{"id":"token:String-instance-method","html_id":"token:String-instance-method","name":"token","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L2","def":{"name":"token","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@token"}},{"id":"token=(token:String)-instance-method","html_id":"token=(token:String)-instance-method","name":"token=","doc":null,"summary":null,"abstract":false,"args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"args_string":"(token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L2","def":{"name":"token=","args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@token = token"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Database","path":"StackCoin/Database.html","kind":"class","full_name":"StackCoin::Database","name":"Database","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/db.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L6"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"DB_INIT_SQL","name":"DB_INIT_SQL","value":"\"CREATE TABLE IF NOT EXISTS balance (\\n user_id TEXT PRIMARY KEY,\\n bal INTERGER\\n);\\n\\nCREATE TABLE IF NOT EXISTS banned (\\n user_id TEXT PRIMARY KEY\\n);\\n\\n\\nCREATE TABLE IF NOT EXISTS designated_channel (\\n guild_id TEXT PRIMARY KEY,\\n channel_id TEXT NOT NULL\\n);\\n\\nCREATE TABLE IF NOT EXISTS token (\\n user_id TEXT PRIMARY KEY,\\n token TEXT\\n);\\n\\nCREATE TABLE IF NOT EXISTS ledger (\\n id INTEGER PRIMARY KEY AUTOINCREMENT,\\n from_id TEXT,\\n from_bal INTERGER,\\n to_id TEXT,\\n to_bal INTERGER,\\n amount INTERGER,\\n time INTERGER\\n);\\n\\nCREATE TABLE IF NOT EXISTS benefit (\\n id INTEGER PRIMARY KEY AUTOINCREMENT,\\n user_id TEXT,\\n user_bal INTERGER,\\n amount INTERGER,\\n time INTERGER\\n);\\n\\nCREATE TABLE IF NOT EXISTS last_given_dole (\\n user_id TEXT PRIMARY KEY,\\n time INTERGER\\n)\"","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[{"id":"parse_time(time)-class-method","html_id":"parse_time(time)-class-method","name":"parse_time","doc":null,"summary":null,"abstract":false,"args":[{"name":"time","doc":null,"default_value":"","external_name":"time","restriction":""}],"args_string":"(time)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L78","def":{"name":"parse_time","args":[{"name":"time","doc":null,"default_value":"","external_name":"time","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Time.parse(time, SQLite3::DATE_FORMAT, Time::Location::UTC)"}}],"constructors":[{"id":"new(config:Config,db:DB::Database)-class-method","html_id":"new(config:Config,db:DB::Database)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"args_string":"(config : Config, db : DB::Database)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L7","def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(config, db)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"backup-instance-method","html_id":"backup-instance-method","name":"backup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L62","def":{"name":"backup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"db_file = @config.database_url.lchop(\"sqlite3://\")\nbackup_file = \"#{db_file}.backup.#{Time.utc}.gz\"\nLog.info do\n \"gzipping #{db_file} to #{backup_file}...\"\nend\nFile.open(db_file, \"r\") do |database_file|\n File.open(backup_file, \"w\") do |backup_file|\n Compress::Gzip::Writer.open(backup_file) do |gzip|\n IO.copy(database_file, gzip)\n end\n end\nend\nLog.info do\n \"backup complete!\"\nend\n"}},{"id":"populate_tables(db)-instance-method","html_id":"populate_tables(db)-instance-method","name":"populate_tables","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":""}],"args_string":"(db)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L56","def":{"name":"populate_tables","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(DB_INIT_SQL.split(\";\")).each do |table_init_sql|\n db.exec(table_init_sql)\nend"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/DesignatedChannel","path":"StackCoin/DesignatedChannel.html","kind":"class","full_name":"StackCoin::DesignatedChannel","name":"DesignatedChannel","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/designated_channel.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Database)-class-method","html_id":"new(db:DB::Database)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"args_string":"(db : DB::Database)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L2","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"for_guild(guild_id:Discord::Snowflake)-instance-method","html_id":"for_guild(guild_id:Discord::Snowflake)-instance-method","name":"for_guild","doc":null,"summary":null,"abstract":false,"args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"}],"args_string":"(guild_id : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L27","def":{"name":"for_guild","args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@designated_channels[guild_id]"}},{"id":"is_permitted_to_reply_in(guild_id:Discord::Snowflake,channel_id:Discord::Snowflake)-instance-method","html_id":"is_permitted_to_reply_in(guild_id:Discord::Snowflake,channel_id:Discord::Snowflake)-instance-method","name":"is_permitted_to_reply_in","doc":null,"summary":null,"abstract":false,"args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":"Discord::Snowflake"}],"args_string":"(guild_id : Discord::Snowflake, channel_id : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L19","def":{"name":"is_permitted_to_reply_in","args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if permitted_channel = @designated_channels[guild_id]?\n return permitted_channel == channel_id\nend\ntrue\n"}},{"id":"mark(guild_id:Discord::Snowflake,channel_id:Discord::Snowflake)-instance-method","html_id":"mark(guild_id:Discord::Snowflake,channel_id:Discord::Snowflake)-instance-method","name":"mark","doc":null,"summary":null,"abstract":false,"args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":"Discord::Snowflake"}],"args_string":"(guild_id : Discord::Snowflake, channel_id : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L31","def":{"name":"mark","args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if permitted_channel = @designated_channels[guild_id]?\n @designated_channels.delete(channel_id)\n @db.exec(\"DELETE FROM designated_channel WHERE guild_id = ?\", args: [guild_id.to_s])\nend\nLog.info do\n \"Marking '#{channel_id}' as the channel to be used for messages for '#{guild_id}'\"\nend\n@designated_channels[guild_id] = channel_id\n@db.exec(\"INSERT INTO designated_channel VALUES (?, ?)\", args: [guild_id.to_s, channel_id.to_s])\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Result","path":"StackCoin/Result.html","kind":"class","full_name":"StackCoin::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/result.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Result/Base","path":"StackCoin/Result/Base.html","kind":"class","full_name":"StackCoin::Result::Base","name":"Base","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/result.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"}],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L3","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}},{"id":"new(message)-class-method","html_id":"new(message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L9","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"error:String?-instance-method","html_id":"error:String?-instance-method","name":"error","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String?","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L6","def":{"name":"error","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | ::Nil","visibility":"Public","body":"@error"}},{"id":"error=(error:String?)-instance-method","html_id":"error=(error:String?)-instance-method","name":"error=","doc":null,"summary":null,"abstract":false,"args":[{"name":"error","doc":null,"default_value":"","external_name":"error","restriction":"String | ::Nil"}],"args_string":"(error : String?)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L6","def":{"name":"error=","args":[{"name":"error","doc":null,"default_value":"","external_name":"error","restriction":"String | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@error = error"}},{"id":"message:String-instance-method","html_id":"message:String-instance-method","name":"message","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L5","def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}},{"id":"message=(message:String)-instance-method","html_id":"message=(message:String)-instance-method","name":"message=","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"}],"args_string":"(message : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L5","def":{"name":"message=","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@message = message"}},{"id":"name-instance-method","html_id":"name-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L12","def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((self.class.name.split(\"::\")).last(1))[0]"}},{"id":"success:String?-instance-method","html_id":"success:String?-instance-method","name":"success","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String?","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L7","def":{"name":"success","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | ::Nil","visibility":"Public","body":"@success"}},{"id":"success=(success:String?)-instance-method","html_id":"success=(success:String?)-instance-method","name":"success=","doc":null,"summary":null,"abstract":false,"args":[{"name":"success","doc":null,"default_value":"","external_name":"success","restriction":"String | ::Nil"}],"args_string":"(success : String?)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L7","def":{"name":"success=","args":[{"name":"success","doc":null,"default_value":"","external_name":"success","restriction":"String | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@success = success"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Result/Error","path":"StackCoin/Result/Error.html","kind":"class","full_name":"StackCoin::Result::Error","name":"Error","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/result.cr","line_number":28,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L28"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Auth/Result/InvalidAccessToken","kind":"class","full_name":"StackCoin::Auth::Result::InvalidAccessToken","name":"InvalidAccessToken"},{"html_id":"stackcoin/StackCoin/Auth/Result/InvalidToken","kind":"class","full_name":"StackCoin::Auth::Result::InvalidToken","name":"InvalidToken"},{"html_id":"stackcoin/StackCoin/Auth/Result/NoSuchAccount","kind":"class","full_name":"StackCoin::Auth::Result::NoSuchAccount","name":"NoSuchAccount"},{"html_id":"stackcoin/StackCoin/Bank/Result/BannedUser","kind":"class","full_name":"StackCoin::Bank::Result::BannedUser","name":"BannedUser"},{"html_id":"stackcoin/StackCoin/Bank/Result/InsufficientFunds","kind":"class","full_name":"StackCoin::Bank::Result::InsufficientFunds","name":"InsufficientFunds"},{"html_id":"stackcoin/StackCoin/Bank/Result/InvalidAmount","kind":"class","full_name":"StackCoin::Bank::Result::InvalidAmount","name":"InvalidAmount"},{"html_id":"stackcoin/StackCoin/Bank/Result/NoSuchAccount","kind":"class","full_name":"StackCoin::Bank::Result::NoSuchAccount","name":"NoSuchAccount"},{"html_id":"stackcoin/StackCoin/Bank/Result/PreexistingAccount","kind":"class","full_name":"StackCoin::Bank::Result::PreexistingAccount","name":"PreexistingAccount"},{"html_id":"stackcoin/StackCoin/Bank/Result/PrematureDole","kind":"class","full_name":"StackCoin::Bank::Result::PrematureDole","name":"PrematureDole"},{"html_id":"stackcoin/StackCoin/Bank/Result/TransferSelf","kind":"class","full_name":"StackCoin::Bank::Result::TransferSelf","name":"TransferSelf"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Transaction,message)-class-method","html_id":"new(db:DB::Transaction,message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Transaction"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(db : DB::Transaction, message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L33","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Transaction"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L28","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}},{"id":"new(message)-class-method","html_id":"new(message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L29","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Result/Success","path":"StackCoin/Result/Success.html","kind":"class","full_name":"StackCoin::Result::Success","name":"Success","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/result.cr","line_number":17,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L17"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Auth/Result/AccountCreated","kind":"class","full_name":"StackCoin::Auth::Result::AccountCreated","name":"AccountCreated"},{"html_id":"stackcoin/StackCoin/Auth/Result/Authenticated","kind":"class","full_name":"StackCoin::Auth::Result::Authenticated","name":"Authenticated"},{"html_id":"stackcoin/StackCoin/Auth/Result/ValidAccessToken","kind":"class","full_name":"StackCoin::Auth::Result::ValidAccessToken","name":"ValidAccessToken"},{"html_id":"stackcoin/StackCoin/Bank/Result/TransferSuccess","kind":"class","full_name":"StackCoin::Bank::Result::TransferSuccess","name":"TransferSuccess"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Transaction,message)-class-method","html_id":"new(db:DB::Transaction,message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Transaction"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(db : DB::Transaction, message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L22","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Transaction"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L17","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}},{"id":"new(message)-class-method","html_id":"new(message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L18","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Statistics","path":"StackCoin/Statistics.html","kind":"class","full_name":"StackCoin::Statistics","name":"Statistics","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bank","kind":"class","full_name":"StackCoin::Bank","name":"Bank"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bank","kind":"class","full_name":"StackCoin::Bank","name":"Bank"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":3,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L3"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"all_balances-instance-method","html_id":"all_balances-instance-method","name":"all_balances","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L67","def":{"name":"all_balances","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.handle_balance_result_set(\"SELECT user_id, bal FROM balance\", nil)"}},{"id":"circulation-instance-method","html_id":"circulation-instance-method","name":"circulation","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L136","def":{"name":"circulation","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@db.query_one(\"SELECT SUM(bal) FROM balance\", as: Int64)"}},{"id":"graph(id)-instance-method","html_id":"graph(id)-instance-method","name":"graph","doc":null,"summary":null,"abstract":false,"args":[{"name":"id","doc":null,"default_value":"","external_name":"id","restriction":""}],"args_string":"(id)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L79","def":{"name":"graph","args":[{"name":"id","doc":null,"default_value":"","external_name":"id","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query = \"SELECT time, to_bal, amount FROM ledger\\nWHERE to_id = ?\\nUNION\\nSELECT time, user_bal, amount FROM benefit\\nWHERE user_id = ?\\nORDER BY time\"\nid = id.to_s\ndatapoints = 0\nreader, writer = IO.pipe\n@db.query(query, args: [id, id]) do |rs|\n rs.each do\n datapoints = datapoints + 1\n time = rs.read(String)\n bal = rs.read(Int32)\n amount = rs.read(Int32)\n writer.puts(\"#{time},#{bal},#{amount}\")\n end\nend\nwriter.close\nif datapoints <= 1\n return Result::Graph::Error.new(\"Not enough datapoints!\")\nend\nrandom = UUID.random\nimage_filename = \"/tmp/stackcoin/graph_#{id}_#{random}.png\"\ntitle = \"#{id} - #{Time.utc}\"\nprocess = Process.new(\"gnuplot\", [\"-e\", \"imagefilename='#{image_filename}';customtitle='#{title}'\", \"./src/gnuplot/graph.plt\"], input: reader, output: Process::Redirect::Pipe, error: Process::Redirect::Pipe)\nstdout = process.output.gets_to_end\nstderr = process.error.gets_to_end\nif stderr != \"\"\n raise(stderr)\nend\nResult::Graph::Success.new(File.open(image_filename))\n"}},{"id":"leaderboard(limit=5)-instance-method","html_id":"leaderboard(limit=5)-instance-method","name":"leaderboard","doc":null,"summary":null,"abstract":false,"args":[{"name":"limit","doc":null,"default_value":"5","external_name":"limit","restriction":""}],"args_string":"(limit = 5)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L73","def":{"name":"leaderboard","args":[{"name":"limit","doc":null,"default_value":"5","external_name":"limit","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.handle_balance_result_set(\"SELECT user_id, bal FROM balance ORDER BY bal DESC LIMIT ?\", [limit])"}},{"id":"ledger(dates,from_ids,to_ids,limit=5)-instance-method","html_id":"ledger(dates,from_ids,to_ids,limit=5)-instance-method","name":"ledger","doc":null,"summary":null,"abstract":false,"args":[{"name":"dates","doc":null,"default_value":"","external_name":"dates","restriction":""},{"name":"from_ids","doc":null,"default_value":"","external_name":"from_ids","restriction":""},{"name":"to_ids","doc":null,"default_value":"","external_name":"to_ids","restriction":""},{"name":"limit","doc":null,"default_value":"5","external_name":"limit","restriction":""}],"args_string":"(dates, from_ids, to_ids, limit = 5)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L158","def":{"name":"ledger","args":[{"name":"dates","doc":null,"default_value":"","external_name":"dates","restriction":""},{"name":"from_ids","doc":null,"default_value":"","external_name":"from_ids","restriction":""},{"name":"to_ids","doc":null,"default_value":"","external_name":"to_ids","restriction":""},{"name":"limit","doc":null,"default_value":"5","external_name":"limit","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.debug do\n \"Ledger arguments: #{dates}, #{from_ids}, #{to_ids}, #{limit}\"\nend\nargs = [] of DB::Any\nconditions = [] of String\nconditions << \"WHERE\"\noptional_conditions(dates, String, \"date(time) = date(?)\")\nif (from_ids.size != 0) || (to_ids.size != 0)\n condition = \"AND\"\n if (from_ids.size == 1) || (to_ids.size == 1)\n condition = \"OR\"\n end\n conditions << \"(\"\n optional_conditions(from_ids, UInt64, \"from_id = ?\", condition)\n optional_conditions(to_ids, UInt64, \"to_id = ?\", condition)\n conditions.pop\n conditions << \")\"\n conditions << \"AND\"\nend\nconditions.pop\nconditions_flat = \"\"\nconditions.each do |condition|\n conditions_flat = conditions_flat + \" #{condition} \"\nend\nledger_query = \"SELECT from_id, from_bal, to_id, to_bal, amount, time\\nFROM ledger #{conditions_flat} ORDER BY time DESC LIMIT ?\"\nargs << limit\nLog.debug do\n \"Ledger query: #{ledger_query} - #{args}\"\nend\nresults = [] of Result::Report::Transaction\n@db.query(ledger_query, args: args) do |rs|\n rs.each do\n results << (Result::Report::Transaction.new(*rs.read(String, Int32, String, Int32, Int32, String)))\n end\nend\nResult::Report.new(dates, from_ids, to_ids, results)\n"}},{"id":"richest-instance-method","html_id":"richest-instance-method","name":"richest","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L130","def":{"name":"richest","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"richest = self.leaderboard(1)\nif richest.size == 0\n return nil\nend\nrichest[0]\n"}}],"macros":[{"id":"optional_conditions(objs,type,condition,final="AND")-macro","html_id":"optional_conditions(objs,type,condition,final=&quot;AND&quot;)-macro","name":"optional_conditions","doc":null,"summary":null,"abstract":false,"args":[{"name":"objs","doc":null,"default_value":"","external_name":"objs","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":""},{"name":"condition","doc":null,"default_value":"","external_name":"condition","restriction":""},{"name":"final","doc":null,"default_value":"\"AND\"","external_name":"final","restriction":""}],"args_string":"(objs, type, condition, final = "AND")","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L142","def":{"name":"optional_conditions","args":[{"name":"objs","doc":null,"default_value":"","external_name":"objs","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":""},{"name":"condition","doc":null,"default_value":"","external_name":"condition","restriction":""},{"name":"final","doc":null,"default_value":"\"AND\"","external_name":"final","restriction":""}],"double_splat":null,"splat_index":null,"block_arg":null,"visibility":"Public","body":" if \n{{ objs }}\n.size != 0\n conditions << \"(\"\n \n{{ objs }}\n.each do |obj|\n if obj.is_a?(\n{{ type }}\n)\n conditions << \n{{ condition }}\n\n conditions << \"OR\"\n args << obj.to_s\n \nend\n \nend\n conditions.pop\n conditions << \")\"\n conditions << \n{{ final }}\n\n \nend\n \n"}}],"types":[{"html_id":"stackcoin/StackCoin/Statistics/Result","path":"StackCoin/Statistics/Result.html","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics","kind":"class","full_name":"StackCoin::Statistics","name":"Statistics"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Base","path":"StackCoin/Statistics/Result/Base.html","kind":"class","full_name":"StackCoin::Statistics::Result::Base","name":"Base","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":5,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L5"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Error","kind":"class","full_name":"StackCoin::Statistics::Result::Error","name":"Error"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(client,message,content)-class-method","html_id":"new(client,message,content)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"args_string":"(client, message, content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L6","def":{"name":"new","args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(client, message, content)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Statistics/Result/Error","path":"StackCoin/Statistics/Result/Error.html","kind":"class","full_name":"StackCoin::Statistics::Result::Error","name":"Error","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Statistics/Result/Base","kind":"class","full_name":"StackCoin::Statistics::Result::Base","name":"Base"},"ancestors":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Base","kind":"class","full_name":"StackCoin::Statistics::Result::Base","name":"Base"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":11,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L11"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph","path":"StackCoin/Statistics/Result/Graph.html","kind":"class","full_name":"StackCoin::Statistics::Result::Graph","name":"Graph","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":14,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L14"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph/Error","path":"StackCoin/Statistics/Result/Graph/Error.html","kind":"class","full_name":"StackCoin::Statistics::Result::Graph::Error","name":"Error","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":22,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L22"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph","kind":"class","full_name":"StackCoin::Statistics::Result::Graph","name":"Graph"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message)-class-method","html_id":"new(message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L25","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"message:String-instance-method","html_id":"message:String-instance-method","name":"message","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L23","def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph/Success","path":"StackCoin/Statistics/Result/Graph/Success.html","kind":"class","full_name":"StackCoin::Statistics::Result::Graph::Success","name":"Success","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":15,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L15"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph","kind":"class","full_name":"StackCoin::Statistics::Result::Graph","name":"Graph"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(file)-class-method","html_id":"new(file)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"file","doc":null,"default_value":"","external_name":"file","restriction":""}],"args_string":"(file)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L18","def":{"name":"new","args":[{"name":"file","doc":null,"default_value":"","external_name":"file","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(file)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"file:File-instance-method","html_id":"file:File-instance-method","name":"file","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : File","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L16","def":{"name":"file","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"File","visibility":"Public","body":"@file"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Statistics/Result/Report","path":"StackCoin/Statistics/Result/Report.html","kind":"class","full_name":"StackCoin::Statistics::Result::Report","name":"Report","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":30,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L30"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(date,from_id,to_id,results)-class-method","html_id":"new(date,from_id,to_id,results)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"date","doc":null,"default_value":"","external_name":"date","restriction":""},{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":""},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":""},{"name":"results","doc":null,"default_value":"","external_name":"results","restriction":""}],"args_string":"(date, from_id, to_id, results)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L51","def":{"name":"new","args":[{"name":"date","doc":null,"default_value":"","external_name":"date","restriction":""},{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":""},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":""},{"name":"results","doc":null,"default_value":"","external_name":"results","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(date, from_id, to_id, results)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"date:Array(String)-instance-method","html_id":"date:Array(String)-instance-method","name":"date","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L46","def":{"name":"date","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@date"}},{"id":"from_id:Array(UInt64)-instance-method","html_id":"from_id:Array(UInt64)-instance-method","name":"from_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L47","def":{"name":"from_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(UInt64)","visibility":"Public","body":"@from_id"}},{"id":"results:Array(Transaction)-instance-method","html_id":"results:Array(Transaction)-instance-method","name":"results","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Transaction)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L49","def":{"name":"results","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Transaction)","visibility":"Public","body":"@results"}},{"id":"to_id:Array(UInt64)-instance-method","html_id":"to_id:Array(UInt64)-instance-method","name":"to_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L48","def":{"name":"to_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(UInt64)","visibility":"Public","body":"@to_id"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Report/Transaction","path":"StackCoin/Statistics/Result/Report/Transaction.html","kind":"class","full_name":"StackCoin::Statistics::Result::Report::Transaction","name":"Transaction","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":31,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L31"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result/Report","kind":"class","full_name":"StackCoin::Statistics::Result::Report","name":"Report"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(from_id,from_bal,to_id,to_bal,amount,time)-class-method","html_id":"new(from_id,from_bal,to_id,to_bal,amount,time)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":""},{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":""},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":""},{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":""},{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":""},{"name":"time","doc":null,"default_value":"","external_name":"time","restriction":""}],"args_string":"(from_id, from_bal, to_id, to_bal, amount, time)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L39","def":{"name":"new","args":[{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":""},{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":""},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":""},{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":""},{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":""},{"name":"time","doc":null,"default_value":"","external_name":"time","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(from_id, from_bal, to_id, to_bal, amount, time)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"amount:Int32-instance-method","html_id":"amount:Int32-instance-method","name":"amount","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L36","def":{"name":"amount","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@amount"}},{"id":"from_bal:Int32-instance-method","html_id":"from_bal:Int32-instance-method","name":"from_bal","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L33","def":{"name":"from_bal","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@from_bal"}},{"id":"from_id:UInt64-instance-method","html_id":"from_id:UInt64-instance-method","name":"from_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L32","def":{"name":"from_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@from_id"}},{"id":"time:Time-instance-method","html_id":"time:Time-instance-method","name":"time","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Time","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L37","def":{"name":"time","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Time","visibility":"Public","body":"@time"}},{"id":"to_bal:Int32-instance-method","html_id":"to_bal:Int32-instance-method","name":"to_bal","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L35","def":{"name":"to_bal","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@to_bal"}},{"id":"to_id:UInt64-instance-method","html_id":"to_id:UInt64-instance-method","name":"to_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L34","def":{"name":"to_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@to_id"}}],"macros":[],"types":[]}]}]}]}]}]}} \ No newline at end of file diff --git a/js/doc.js b/js/doc.js new file mode 100644 index 0000000..cdf43da --- /dev/null +++ b/js/doc.js @@ -0,0 +1,1086 @@ +window.CrystalDocs = (window.CrystalDocs || {}); + +CrystalDocs.base_path = (CrystalDocs.base_path || ""); + +CrystalDocs.searchIndex = (CrystalDocs.searchIndex || false); +CrystalDocs.MAX_RESULTS_DISPLAY = 140; + +CrystalDocs.runQuery = function(query) { + function searchType(type, query, results) { + var matches = []; + var matchedFields = []; + var name = type.full_name; + var i = name.lastIndexOf("::"); + if (i > 0) { + name = name.substring(i + 2); + } + var nameMatches = query.matches(name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + var namespaceMatches = query.matchesNamespace(type.full_name); + if(namespaceMatches){ + matches = matches.concat(namespaceMatches); + matchedFields.push("name"); + } + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + results.push({ + id: type.id, + result_type: "type", + kind: type.kind, + name: name, + full_name: type.full_name, + href: type.path, + summary: type.summary, + matched_fields: matchedFields, + matched_terms: matches + }); + } + + type.instance_methods.forEach(function(method) { + searchMethod(method, type, "instance_method", query, results); + }) + type.class_methods.forEach(function(method) { + searchMethod(method, type, "class_method", query, results); + }) + type.constructors.forEach(function(constructor) { + searchMethod(constructor, type, "constructor", query, results); + }) + type.macros.forEach(function(macro) { + searchMethod(macro, type, "macro", query, results); + }) + type.constants.forEach(function(constant){ + searchConstant(constant, type, query, results); + }); + + type.types.forEach(function(subtype){ + searchType(subtype, query, results); + }); + }; + + function searchMethod(method, type, kind, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matchesMethod(method.name, kind, type); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + method.args.forEach(function(arg){ + var argMatches = query.matches(arg.external_name); + if (argMatches) { + matches = matches.concat(argMatches); + matchedFields.push("args"); + } + }); + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: method.id, + type: type.full_name, + result_type: kind, + name: method.name, + full_name: type.full_name + "#" + method.name, + args_string: method.args_string, + summary: method.summary, + href: type.path + "#" + method.id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + function searchConstant(constant, type, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matches(constant.name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + var docMatches = query.matches(constant.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: constant.id, + type: type.full_name, + result_type: "constant", + name: constant.name, + full_name: type.full_name + "#" + constant.name, + value: constant.value, + summary: constant.summary, + href: type.path + "#" + constant.id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + var results = []; + searchType(CrystalDocs.searchIndex.program, query, results); + return results; +}; + +CrystalDocs.rankResults = function(results, query) { + function uniqueArray(ar) { + var j = {}; + + ar.forEach(function(v) { + j[v + "::" + typeof v] = v; + }); + + return Object.keys(j).map(function(v) { + return j[v]; + }); + } + + results = results.sort(function(a, b) { + var matchedTermsDiff = uniqueArray(b.matched_terms).length - uniqueArray(a.matched_terms).length; + var aHasDocs = b.matched_fields.includes("doc"); + var bHasDocs = b.matched_fields.includes("doc"); + + var aOnlyDocs = aHasDocs && a.matched_fields.length == 1; + var bOnlyDocs = bHasDocs && b.matched_fields.length == 1; + + if (a.result_type == "type" && b.result_type != "type" && !aOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("a is type b not"); } + return -1; + } else if (b.result_type == "type" && a.result_type != "type" && !bOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("b is type, a not"); } + return 1; + } + if (a.matched_fields.includes("name")) { + if (b.matched_fields.includes("name")) { + var a_name = (CrystalDocs.prefixForType(a.result_type) || "") + ((a.result_type == "type") ? a.full_name : a.name); + var b_name = (CrystalDocs.prefixForType(b.result_type) || "") + ((b.result_type == "type") ? b.full_name : b.name); + a_name = a_name.toLowerCase(); + b_name = b_name.toLowerCase(); + for(var i = 0; i < query.normalizedTerms.length; i++) { + var term = query.terms[i].replace(/^::?|::?$/, ""); + var a_orig_index = a_name.indexOf(term); + var b_orig_index = b_name.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("term: " + term + " a: " + a_name + " b: " + b_name); } + if(CrystalDocs.DEBUG) { console.log(a_orig_index, b_orig_index, a_orig_index - b_orig_index); } + if (a_orig_index >= 0) { + if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("both have exact match", a_orig_index > b_orig_index ? -1 : 1); } + if(a_orig_index != b_orig_index) { + if(CrystalDocs.DEBUG) { console.log("both have exact match at different positions", a_orig_index > b_orig_index ? 1 : -1); } + return a_orig_index > b_orig_index ? 1 : -1; + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has exact match, b not"); } + return -1; + } + } else if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("b has exact match, a not"); } + return 1; + } + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has match in name, b not"); } + return -1; + } + } else if ( + !a.matched_fields.includes("name") && + b.matched_fields.includes("name") + ) { + return 1; + } + + if (matchedTermsDiff != 0 || (aHasDocs != bHasDocs)) { + if(CrystalDocs.DEBUG) { console.log("matchedTermsDiff: " + matchedTermsDiff, aHasDocs, bHasDocs); } + return matchedTermsDiff; + } + + var matchedFieldsDiff = b.matched_fields.length - a.matched_fields.length; + if (matchedFieldsDiff != 0) { + if(CrystalDocs.DEBUG) { console.log("matched to different number of fields: " + matchedFieldsDiff); } + return matchedFieldsDiff > 0 ? 1 : -1; + } + + var nameCompare = a.name.localeCompare(b.name); + if(nameCompare != 0){ + if(CrystalDocs.DEBUG) { console.log("nameCompare resulted in: " + a.name + "<=>" + b.name + ": " + nameCompare); } + return nameCompare > 0 ? 1 : -1; + } + + if(a.matched_fields.includes("args") && b.matched_fields.includes("args")) { + for(var i = 0; i < query.terms.length; i++) { + var term = query.terms[i]; + var aIndex = a.args_string.indexOf(term); + var bIndex = b.args_string.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("index of " + term + " in args_string: " + aIndex + " - " + bIndex); } + if(aIndex >= 0){ + if(bIndex >= 0){ + if(aIndex != bIndex){ + return aIndex > bIndex ? 1 : -1; + } + }else{ + return -1; + } + }else if(bIndex >= 0) { + return 1; + } + } + } + + return 0; + }); + + if (results.length > 1) { + // if we have more than two search terms, only include results with the most matches + var bestMatchedTerms = uniqueArray(results[0].matched_terms).length; + + results = results.filter(function(result) { + return uniqueArray(result.matched_terms).length + 1 >= bestMatchedTerms; + }); + } + return results; +}; + +CrystalDocs.prefixForType = function(type) { + switch (type) { + case "instance_method": + return "#"; + + case "class_method": + case "macro": + case "constructor": + return "."; + + default: + return false; + } +}; + +CrystalDocs.displaySearchResults = function(results, query) { + function sanitize(html){ + return html.replace(/<(?!\/?code)[^>]+>/g, ""); + } + + // limit results + if (results.length > CrystalDocs.MAX_RESULTS_DISPLAY) { + results = results.slice(0, CrystalDocs.MAX_RESULTS_DISPLAY); + } + + var $frag = document.createDocumentFragment(); + var $resultsElem = document.querySelector(".search-list"); + $resultsElem.innerHTML = ""; + + results.forEach(function(result, i) { + var url = CrystalDocs.base_path + result.href; + var type = false; + + var title = query.highlight(result.result_type == "type" ? result.full_name : result.name); + + var prefix = CrystalDocs.prefixForType(result.result_type); + if (prefix) { + title = "" + prefix + "" + title; + } + + title = "" + title + ""; + + if (result.args_string) { + title += + "" + query.highlight(result.args_string) + ""; + } + + $elem = document.createElement("li"); + $elem.className = "search-result search-result--" + result.result_type; + $elem.dataset.href = url; + $elem.setAttribute("title", result.full_name + " docs page"); + + var $title = document.createElement("div"); + $title.setAttribute("class", "search-result__title"); + var $titleLink = document.createElement("a"); + $titleLink.setAttribute("href", url); + + $titleLink.innerHTML = title; + $title.appendChild($titleLink); + $elem.appendChild($title); + $elem.addEventListener("click", function() { + $titleLink.click(); + }); + + if (result.result_type !== "type") { + var $type = document.createElement("div"); + $type.setAttribute("class", "search-result__type"); + $type.innerHTML = query.highlight(result.type); + $elem.appendChild($type); + } + + if(result.summary){ + var $doc = document.createElement("div"); + $doc.setAttribute("class", "search-result__doc"); + $doc.innerHTML = query.highlight(sanitize(result.summary)); + $elem.appendChild($doc); + } + + $elem.appendChild(document.createComment(JSON.stringify(result))); + $frag.appendChild($elem); + }); + + $resultsElem.appendChild($frag); + + CrystalDocs.toggleResultsList(true); +}; + +CrystalDocs.toggleResultsList = function(visible) { + if (visible) { + document.querySelector(".types-list").classList.add("hidden"); + document.querySelector(".search-results").classList.remove("hidden"); + } else { + document.querySelector(".types-list").classList.remove("hidden"); + document.querySelector(".search-results").classList.add("hidden"); + } +}; + +CrystalDocs.Query = function(string) { + this.original = string; + this.terms = string.split(/\s+/).filter(function(word) { + return CrystalDocs.Query.stripModifiers(word).length > 0; + }); + + var normalized = this.terms.map(CrystalDocs.Query.normalizeTerm); + this.normalizedTerms = normalized; + + function runMatcher(field, matcher) { + if (!field) { + return false; + } + var normalizedValue = CrystalDocs.Query.normalizeTerm(field); + + var matches = []; + normalized.forEach(function(term) { + if (matcher(normalizedValue, term)) { + matches.push(term); + } + }); + return matches.length > 0 ? matches : false; + } + + this.matches = function(field) { + return runMatcher(field, function(normalized, term) { + if (term[0] == "#" || term[0] == ".") { + return false; + } + return normalized.indexOf(term) >= 0; + }); + }; + + function namespaceMatcher(normalized, term){ + var i = term.indexOf(":"); + if(i >= 0){ + term = term.replace(/^::?|::?$/, ""); + var index = normalized.indexOf(term); + if((index == 0) || (index > 0 && normalized[index-1] == ":")){ + return true; + } + } + return false; + } + this.matchesMethod = function(name, kind, type) { + return runMatcher(name, function(normalized, term) { + var i = term.indexOf("#"); + if(i >= 0){ + if (kind != "instance_method") { + return false; + } + }else{ + i = term.indexOf("."); + if(i >= 0){ + if (kind != "class_method" && kind != "macro" && kind != "constructor") { + return false; + } + }else{ + //neither # nor . + if(term.indexOf(":") && namespaceMatcher(normalized, term)){ + return true; + } + } + } + + var methodName = term; + if(i >= 0){ + var termType = term.substring(0, i); + methodName = term.substring(i+1); + + if(termType != "") { + if(CrystalDocs.Query.normalizeTerm(type.full_name).indexOf(termType) < 0){ + return false; + } + } + } + return normalized.indexOf(methodName) >= 0; + }); + }; + + this.matchesNamespace = function(namespace){ + return runMatcher(namespace, namespaceMatcher); + }; + + this.highlight = function(string) { + if (typeof string == "undefined") { + return ""; + } + function escapeRegExp(s) { + return s.replace(/[.*+?\^${}()|\[\]\\]/g, "\\$&").replace(/^[#\.:]+/, ""); + } + return string.replace( + new RegExp("(" + this.normalizedTerms.map(escapeRegExp).join("|") + ")", "gi"), + "$1" + ); + }; +}; +CrystalDocs.Query.normalizeTerm = function(term) { + return term.toLowerCase(); +}; +CrystalDocs.Query.stripModifiers = function(term) { + switch (term[0]) { + case "#": + case ".": + case ":": + return term.substr(1); + + default: + return term; + } +} + +CrystalDocs.search = function(string) { + if(!CrystalDocs.searchIndex) { + console.log("CrystalDocs search index not initialized, delaying search"); + + document.addEventListener("CrystalDocs:loaded", function listener(){ + document.removeEventListener("CrystalDocs:loaded", listener); + CrystalDocs.search(string); + }); + return; + } + + document.dispatchEvent(new Event("CrystalDocs:searchStarted")); + + var query = new CrystalDocs.Query(string); + var results = CrystalDocs.runQuery(query); + results = CrystalDocs.rankResults(results, query); + CrystalDocs.displaySearchResults(results, query); + + document.dispatchEvent(new Event("CrystalDocs:searchPerformed")); +}; + +CrystalDocs.initializeIndex = function(data) { + CrystalDocs.searchIndex = data; + + document.dispatchEvent(new Event("CrystalDocs:loaded")); +}; + +CrystalDocs.loadIndex = function() { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function loadScript(file) { + script = document.createElement("script"); + script.src = file; + document.body.appendChild(script); + } + + function parseJSON(json) { + CrystalDocs.initializeIndex(JSON.parse(json)); + } + + for(var i = 0; i < document.scripts.length; i++){ + var script = document.scripts[i]; + if (script.src && script.src.indexOf("js/doc.js") >= 0) { + if (script.src.indexOf("file://") == 0) { + // We need to support JSONP files for the search to work on local file system. + var jsonPath = script.src.replace("js/doc.js", "search-index.js"); + loadScript(jsonPath); + return; + } else { + var jsonPath = script.src.replace("js/doc.js", "index.json"); + loadJSON(jsonPath, parseJSON); + return; + } + } + } + console.error("Could not find location of js/doc.js"); +}; + +// Callback for jsonp +function crystal_doc_search_index_callback(data) { + CrystalDocs.initializeIndex(data); +} + +Navigator = function(sidebar, searchInput, list, leaveSearchScope){ + this.list = list; + var self = this; + + var performingSearch = false; + + document.addEventListener('CrystalDocs:searchStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchDebounceStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchPerformed', function(){ + performingSearch = false; + }); + document.addEventListener('CrystalDocs:searchDebounceStopped', function(event){ + performingSearch = false; + }); + + function delayWhileSearching(callback) { + if(performingSearch){ + document.addEventListener('CrystalDocs:searchPerformed', function listener(){ + document.removeEventListener('CrystalDocs:searchPerformed', listener); + + // add some delay to let search results display kick in + setTimeout(callback, 100); + }); + }else{ + callback(); + } + } + + function clearMoveTimeout() { + clearTimeout(self.moveTimeout); + self.moveTimeout = null; + } + + function startMoveTimeout(upwards){ + /*if(self.moveTimeout) { + clearMoveTimeout(); + } + + var go = function() { + if (!self.moveTimeout) return; + self.move(upwards); + self.moveTimout = setTimeout(go, 600); + }; + self.moveTimeout = setTimeout(go, 800);*/ + } + + function scrollCenter(element) { + var rect = element.getBoundingClientRect(); + var middle = sidebar.clientHeight / 2; + sidebar.scrollTop += rect.top + rect.height / 2 - middle; + } + + var move = this.move = function(upwards){ + if(!this.current){ + this.highlightFirst(); + return true; + } + var next = upwards ? this.current.previousElementSibling : this.current.nextElementSibling; + if(next && next.classList) { + this.highlight(next); + scrollCenter(next); + return true; + } + return false; + }; + + this.moveRight = function(){ + }; + this.moveLeft = function(){ + }; + + this.highlight = function(elem) { + if(!elem){ + return; + } + this.removeHighlight(); + + this.current = elem; + this.current.classList.add("current"); + }; + + this.highlightFirst = function(){ + this.highlight(this.list.querySelector('li:first-child')); + }; + + this.removeHighlight = function() { + if(this.current){ + this.current.classList.remove("current"); + } + this.current = null; + } + + this.openSelectedResult = function() { + if(this.current) { + this.current.click(); + } + } + + this.focus = function() { + searchInput.focus(); + searchInput.select(); + this.highlightFirst(); + } + + function handleKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + case "i": + case "j": + case "k": + case "l": + case "c": + case "h": + case "t": + case "n": + event.stopPropagation(); + clearMoveTimeout(); + } + } + + function handleKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + self.openSelectedResult(); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + break; + case "j": + case "c": + case "ArrowUp": + if(event.ctrlKey || event.key == "ArrowUp") { + event.stopPropagation(); + self.move(true); + startMoveTimeout(true); + } + break; + case "k": + case "h": + case "ArrowDown": + if(event.ctrlKey || event.key == "ArrowDown") { + event.stopPropagation(); + self.move(false); + startMoveTimeout(false); + } + break; + case "k": + case "t": + case "ArrowLeft": + if(event.ctrlKey || event.key == "ArrowLeft") { + event.stopPropagation(); + self.moveLeft(); + } + break; + case "l": + case "n": + case "ArrowRight": + if(event.ctrlKey || event.key == "ArrowRight") { + event.stopPropagation(); + self.moveRight(); + } + break; + } + } + + function handleInputKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + clearMoveTimeout(); + } + } + + function handleInputKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + delayWhileSearching(function(){ + self.openSelectedResult(); + leaveSearchScope(); + }); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + // remove focus from search input + leaveSearchScope(); + sidebar.focus(); + break; + case "ArrowUp": + event.stopPropagation(); + event.preventDefault(); + self.move(true); + startMoveTimeout(true); + break; + + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + self.move(false); + startMoveTimeout(false); + break; + } + } + + sidebar.tabIndex = 100; // set tabIndex to enable keylistener + sidebar.addEventListener('keyup', function(event) { + handleKeyUp(event); + }); + sidebar.addEventListener('keydown', function(event) { + handleKeyDown(event); + }); + searchInput.addEventListener('keydown', function(event) { + handleInputKeyDown(event); + }); + searchInput.addEventListener('keyup', function(event) { + handleInputKeyUp(event); + }); + this.move(); +}; + +CrystalDocs.initializeVersions = function () { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function parseJSON(json) { + CrystalDocs.loadConfig(JSON.parse(json)); + } + + $elem = document.querySelector("html > head > meta[name=\"crystal_docs.json_config_url\"]") + if ($elem == undefined) { + return + } + jsonURL = $elem.getAttribute("content") + if (jsonURL && jsonURL != "") { + loadJSON(jsonURL, parseJSON); + } +} + +CrystalDocs.loadConfig = function (config) { + var projectVersions = config["versions"] + var currentVersion = document.querySelector("html > head > meta[name=\"crystal_docs.project_version\"]").getAttribute("content") + + var currentVersionInList = projectVersions.find(function (element) { + return element.name == currentVersion + }) + + if (!currentVersionInList) { + projectVersions.unshift({ name: currentVersion, url: '#' }) + } + + $version = document.querySelector(".project-summary > .project-version") + $version.innerHTML = "" + + $select = document.createElement("select") + $select.classList.add("project-versions-nav") + $select.addEventListener("change", function () { + window.location.href = this.value + }) + projectVersions.forEach(function (version) { + $item = document.createElement("option") + $item.setAttribute("value", version.url) + $item.append(document.createTextNode(version.name)) + + if (version.name == currentVersion) { + $item.setAttribute("selected", true) + $item.setAttribute("disabled", true) + } + $select.append($item) + }); + $form = document.createElement("form") + $form.setAttribute("autocomplete", "off") + $form.append($select) + $version.append($form) +} + +document.addEventListener("DOMContentLoaded", function () { + CrystalDocs.initializeVersions() +}) + +var UsageModal = function(title, content) { + var $body = document.body; + var self = this; + var $modalBackground = document.createElement("div"); + $modalBackground.classList.add("modal-background"); + var $usageModal = document.createElement("div"); + $usageModal.classList.add("usage-modal"); + $modalBackground.appendChild($usageModal); + var $title = document.createElement("h3"); + $title.classList.add("modal-title"); + $title.innerHTML = title + $usageModal.appendChild($title); + var $closeButton = document.createElement("span"); + $closeButton.classList.add("close-button"); + $closeButton.setAttribute("title", "Close modal"); + $closeButton.innerText = '×'; + $usageModal.appendChild($closeButton); + $usageModal.insertAdjacentHTML("beforeend", content); + + $modalBackground.addEventListener('click', function(event) { + var element = event.target || event.srcElement; + + if(element == $modalBackground) { + self.hide(); + } + }); + $closeButton.addEventListener('click', function(event) { + self.hide(); + }); + + $body.insertAdjacentElement('beforeend', $modalBackground); + + this.show = function(){ + $body.classList.add("js-modal-visible"); + }; + this.hide = function(){ + $body.classList.remove("js-modal-visible"); + }; + this.isVisible = function(){ + return $body.classList.contains("js-modal-visible"); + } +} + + +document.addEventListener('DOMContentLoaded', function() { + var sessionStorage; + try { + sessionStorage = window.sessionStorage; + } catch (e) { } + if(!sessionStorage) { + sessionStorage = { + setItem: function() {}, + getItem: function() {}, + removeItem: function() {} + }; + } + + var repositoryName = document.querySelector('#repository-name').getAttribute('content'); + var typesList = document.querySelector('.types-list'); + var searchInput = document.querySelector('.search-input'); + var parents = document.querySelectorAll('.types-list li.parent'); + + var scrollSidebarToOpenType = function(){ + var openTypes = typesList.querySelectorAll('.current'); + if (openTypes.length > 0) { + var lastOpenType = openTypes[openTypes.length - 1]; + lastOpenType.scrollIntoView(); + } + } + + scrollSidebarToOpenType(); + + var setPersistentSearchQuery = function(value){ + sessionStorage.setItem(repositoryName + '::search-input:value', value); + } + + for(var i = 0; i < parents.length; i++) { + var _parent = parents[i]; + _parent.addEventListener('click', function(e) { + e.stopPropagation(); + + if(e.target.tagName.toLowerCase() == 'li') { + if(e.target.className.match(/open/)) { + sessionStorage.removeItem(e.target.getAttribute('data-id')); + e.target.className = e.target.className.replace(/ +open/g, ''); + } else { + sessionStorage.setItem(e.target.getAttribute('data-id'), '1'); + if(e.target.className.indexOf('open') == -1) { + e.target.className += ' open'; + } + } + } + }); + + if(sessionStorage.getItem(_parent.getAttribute('data-id')) == '1') { + _parent.className += ' open'; + } + } + + var leaveSearchScope = function(){ + CrystalDocs.toggleResultsList(false); + window.focus(); + } + + var navigator = new Navigator(document.querySelector('.types-list'), searchInput, document.querySelector(".search-results"), leaveSearchScope); + + CrystalDocs.loadIndex(); + var searchTimeout; + var lastSearchText = false; + var performSearch = function() { + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStarted")); + + clearTimeout(searchTimeout); + searchTimeout = setTimeout(function() { + var text = searchInput.value; + + if(text == "") { + CrystalDocs.toggleResultsList(false); + }else if(text == lastSearchText){ + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStopped")); + }else{ + CrystalDocs.search(text); + navigator.highlightFirst(); + searchInput.focus(); + } + lastSearchText = text; + setPersistentSearchQuery(text); + }, 200); + }; + + if(location.hash.length > 3 && location.hash.substring(0,3) == "#q="){ + // allows directly linking a search query which is then executed on the client + // this comes handy for establishing a custom browser search engine with https://crystal-lang.org/api/#q=%s as a search URL + // TODO: Add OpenSearch description + var searchQuery = location.hash.substring(3); + history.pushState({searchQuery: searchQuery}, "Search for " + searchQuery, location.href.replace(/#q=.*/, "")); + searchInput.value = searchQuery; + document.addEventListener('CrystalDocs:loaded', performSearch); + } + + if (searchInput.value.length == 0) { + var searchText = sessionStorage.getItem(repositoryName + '::search-input:value'); + if(searchText){ + searchInput.value = searchText; + } + } + searchInput.addEventListener('keyup', performSearch); + searchInput.addEventListener('input', performSearch); + + var usageModal = new UsageModal('Keyboard Shortcuts', '' + + '' + ); + + function handleShortkeys(event) { + var element = event.target || event.srcElement; + + if(element.tagName == "INPUT" || element.tagName == "TEXTAREA" || element.parentElement.tagName == "TEXTAREA"){ + return; + } + + switch(event.key) { + case "?": + usageModal.show(); + break; + + case "Escape": + usageModal.hide(); + break; + + case "s": + case "/": + if(usageModal.isVisible()) { + return; + } + event.stopPropagation(); + navigator.focus(); + performSearch(); + break; + } + } + + document.addEventListener('keyup', handleShortkeys); + + var scrollToEntryFromLocationHash = function() { + var hash = window.location.hash; + if (hash) { + var targetAnchor = decodeURI(hash.substr(1)); + var targetEl = document.getElementById(targetAnchor) + if (targetEl) { + targetEl.offsetParent.scrollTop = targetEl.offsetTop; + } + } + }; + window.addEventListener("hashchange", scrollToEntryFromLocationHash, false); + scrollToEntryFromLocationHash(); +}); diff --git a/search-index.js b/search-index.js new file mode 100644 index 0000000..3292c89 --- /dev/null +++ b/search-index.js @@ -0,0 +1 @@ +crystal_doc_search_index_callback({"repository_name":"stackcoin","body":"[![Documentation badge](https://img.shields.io/badge/docs-latest-green.svg?style=flat-square)](https://jackharrhy.github.io/StackCoin/) ![Deploy to Dockerhub badge](https://github.com/jackharrhy/StackCoin/workflows/Deploy%20to%20Dockerhub/badge.svg)\n\n# StackCoin\n\n![StackCoin coin of Stack on coin](https://i.imgur.com/ou12BG6.png)\n\n_a discord pseudo currency, written using [discordcr](https://github.com/discordcr/discordcr)_\n\n![Creator of StackCoin running commands in a private guild, showing the different usages of the bot, such as collecting a daily dole, sending StackCoin to other users, checking a graph of data showing their balance over time, and the leaderboard of the current highest balances of the top 5 accounts](https://i.imgur.com/alF7EcU.png)\n\n---\n\n## Requirements:\n\n- crystal 0.35+\n- sqlite3, development variant\n\n## Running:\n\n```sh\ncp .env.dist .env # then populate .env\n\nshards # install deps\n\ncrystal run src/stackcoin.cr # run bot!\n```\n\n---\n\n## Contributors:\n\n- [jackharrhy](https://github.com/jackharrhy) - creator, maker of most\n- [z64](https://github.com/z64) - made small typo fix, and fixed the specs running, but also maintainer of discordcr, and wrote code that has influenced this bot heavily\n- [Mudkip](https://github.com/Mudkip) - wrote the `s!unban` command, since he was banned for a short period of time while the feature did not exist :)\n- [SteveParson](https://github.com/SteveParson) - wrote the first iteration of the `s!leaderboard` command\n- [jonyick](https://github.com/jonyick) - increased the max value that can be sent in a single transaction from `10k` -> `100k`\n- [ranguli](https://github.com/ranguli) - removed the header in the readme as a meme\n- [rfh473](https://github.com/rfh473) - gave some much needed feedback on the impl. of how stackcoin parses `$` as `s`\n\n---\n\n```txt\n[11:09] stack: i hate it\n```\n","program":{"html_id":"stackcoin/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"stackcoin","program":true,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/CrystalLogHandler","path":"CrystalLogHandler.html","kind":"class","full_name":"CrystalLogHandler","name":"CrystalLogHandler","abstract":false,"superclass":{"html_id":"stackcoin/Kemal/BaseLogHandler","kind":"class","full_name":"Kemal::BaseLogHandler","name":"BaseLogHandler"},"ancestors":[{"html_id":"stackcoin/Kemal/BaseLogHandler","kind":"class","full_name":"Kemal::BaseLogHandler","name":"BaseLogHandler"},{"html_id":"stackcoin/HTTP/Handler","kind":"module","full_name":"HTTP::Handler","name":"Handler"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/log.cr","line_number":20,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L20"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(log=::Log.for("kemal"))-class-method","html_id":"new(log=::Log.for("kemal"))-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"log","doc":null,"default_value":"::Log.for(\"kemal\")","external_name":"log","restriction":""}],"args_string":"(log = ::Log.for("kemal"))","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L21","def":{"name":"new","args":[{"name":"log","doc":null,"default_value":"::Log.for(\"kemal\")","external_name":"log","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(log)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"call(context:HTTP::Server::Context)-instance-method","html_id":"call(context:HTTP::Server::Context)-instance-method","name":"call","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"HTTP::Server::Context"}],"args_string":"(context : HTTP::Server::Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L24","def":{"name":"call","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"HTTP::Server::Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"elapsed_time = Time.measure do\n call_next(context)\nend\nelapsed_text = elapsed_text(elapsed_time)\n@log.info do\n \"#{Time.utc} #{context.response.status_code} #{context.request.method} #{context.request.resource} #{elapsed_text}\"\nend\ncontext\n"}},{"id":"write(message:String)-instance-method","html_id":"write(message:String)-instance-method","name":"write","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"}],"args_string":"(message : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L31","def":{"name":"write","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@log.info do\n message\nend"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin","path":"StackCoin.html","kind":"module","full_name":"StackCoin","name":"StackCoin","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"src/stackcoin/const.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/const.cr#L1"},{"filename":"src/stackcoin/log.cr","line_number":5,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/log.cr#L5"},{"filename":"src/stackcoin/result.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"DEBUG","name":"DEBUG","value":"ENV[\"DEBUG\"]?","doc":null,"summary":null},{"id":"EPOCH","name":"EPOCH","value":"Time.unix(1574467200)","doc":null,"summary":null},{"id":"Log","name":"Log","value":"::Log.for(\"stackcoin\")","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Api","path":"StackCoin/Api.html","kind":"class","full_name":"StackCoin::Api","name":"Api","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/api.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L6"},{"filename":"src/stackcoin/routes/auth.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L1"},{"filename":"src/stackcoin/routes/base.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L1"},{"filename":"src/stackcoin/routes/ledger.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L1"},{"filename":"src/stackcoin/routes/root.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/root.cr#L1"},{"filename":"src/stackcoin/routes/user.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/user.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(config:Config,bank:Bank,stats:Statistics,auth:StackCoin::Auth)-class-method","html_id":"new(config:Config,bank:Bank,stats:Statistics,auth:StackCoin::Auth)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"args_string":"(config : Config, bank : Bank, stats : Statistics, auth : StackCoin::Auth)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L17","def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(config, bank, stats, auth)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"run!-instance-method","html_id":"run!-instance-method","name":"run!","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L32","def":{"name":"run!","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Starting Kemal\"\nend\nKemal.run\n"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Api/Auth","path":"StackCoin/Api/Auth.html","kind":"class","full_name":"StackCoin::Api::Auth","name":"Auth","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},"ancestors":[{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/auth.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L14","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"post(\"/auth\") do |env|\n if env.request.body\n else\n next\n end\n begin\n auth_post_body = AuthPostBody.from_json(env.request.body.not_nil!)\n rescue e : JSON::ParseException\n halt(env, status_code: 403, response: json_error(\"Invalid JSON: #{e}\"))\n end\n auth_result = @auth.authenticate(auth_post_body.user_id, auth_post_body.token)\n if !auth_result.is_a?(StackCoin::Auth::Result::Authenticated)\n env.response.status_code = 401\n end\n auth_result.to_json\nend"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Api/Auth/AuthPostBody","path":"StackCoin/Api/Auth/AuthPostBody.html","kind":"class","full_name":"StackCoin::Api::Auth::AuthPostBody","name":"AuthPostBody","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/auth.cr","line_number":8,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L8"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api/Auth","kind":"class","full_name":"StackCoin::Api::Auth","name":"Auth"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L9","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"token:String-instance-method","html_id":"token:String-instance-method","name":"token","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L11","def":{"name":"token","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@token"}},{"id":"token=(token:String)-instance-method","html_id":"token=(token:String)-instance-method","name":"token=","doc":null,"summary":null,"abstract":false,"args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"args_string":"(token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L11","def":{"name":"token=","args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@token = token"}},{"id":"user_id:UInt64-instance-method","html_id":"user_id:UInt64-instance-method","name":"user_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L10","def":{"name":"user_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@user_id"}},{"id":"user_id=(user_id:UInt64)-instance-method","html_id":"user_id=(user_id:UInt64)-instance-method","name":"user_id=","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/auth.cr#L10","def":{"name":"user_id=","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@user_id = user_id"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Api/Context","path":"StackCoin/Api/Context.html","kind":"class","full_name":"StackCoin::Api::Context","name":"Context","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/api.cr","line_number":7,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L7"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(bank,stats,auth,config)-class-method","html_id":"new(bank,stats,auth,config)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":""},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":""},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":""},{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":""}],"args_string":"(bank, stats, auth, config)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L13","def":{"name":"new","args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":""},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":""},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":""},{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(bank, stats, auth, config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"auth:StackCoin::Auth-instance-method","html_id":"auth:StackCoin::Auth-instance-method","name":"auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Auth","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L10","def":{"name":"auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Auth","visibility":"Public","body":"@auth"}},{"id":"bank:Bank-instance-method","html_id":"bank:Bank-instance-method","name":"bank","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bank","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L8","def":{"name":"bank","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bank","visibility":"Public","body":"@bank"}},{"id":"config:Config-instance-method","html_id":"config:Config-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Config","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L11","def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Config","visibility":"Public","body":"@config"}},{"id":"stats:Statistics-instance-method","html_id":"stats:Statistics-instance-method","name":"stats","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Statistics","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/api.cr#L9","def":{"name":"stats","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Statistics","visibility":"Public","body":"@stats"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Api/Ledger","path":"StackCoin/Api/Ledger.html","kind":"class","full_name":"StackCoin::Api::Ledger","name":"Ledger","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},"ancestors":[{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/ledger.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L15","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"post(\"/ledger\") do |env|\n if env.request.body\n else\n next\n end\n begin\n ledger_post_body = LedgerPostBody.from_json(env.request.body.not_nil!)\n rescue e : JSON::ParseException\n halt(env, status_code: 403, response: json_error(\"Invalid JSON: #{e}\"))\n end\n access_token_valid = @auth.validate_access_token(env.request.headers[\"X-Access-Token\"])\n if !access_token_valid.is_a?(StackCoin::Auth::Result::ValidAccessToken)\n halt(env, status_code: 401, response: access_token_valid.to_json)\n end\n from_id = access_token_valid.user_id\n result = @bank.transfer(from_id, ledger_post_body.to_id, ledger_post_body.amount)\n if !result.is_a?(Bank::Result::TransferSuccess)\n env.response.status_code = 403\n end\n result.to_json\nend"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Api/Ledger/LedgerPostBody","path":"StackCoin/Api/Ledger/LedgerPostBody.html","kind":"class","full_name":"StackCoin::Api::Ledger::LedgerPostBody","name":"LedgerPostBody","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/ledger.cr","line_number":9,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L9"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api/Ledger","kind":"class","full_name":"StackCoin::Api::Ledger","name":"Ledger"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L10","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"amount:Int32-instance-method","html_id":"amount:Int32-instance-method","name":"amount","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L12","def":{"name":"amount","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@amount"}},{"id":"amount=(amount:Int32)-instance-method","html_id":"amount=(amount:Int32)-instance-method","name":"amount=","doc":null,"summary":null,"abstract":false,"args":[{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":"Int32"}],"args_string":"(amount : Int32)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L12","def":{"name":"amount=","args":[{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@amount = amount"}},{"id":"to_id:UInt64-instance-method","html_id":"to_id:UInt64-instance-method","name":"to_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L11","def":{"name":"to_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@to_id"}},{"id":"to_id=(to_id:UInt64)-instance-method","html_id":"to_id=(to_id:UInt64)-instance-method","name":"to_id=","doc":null,"summary":null,"abstract":false,"args":[{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":"UInt64"}],"args_string":"(to_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/ledger.cr#L11","def":{"name":"to_id=","args":[{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@to_id = to_id"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Api/Root","path":"StackCoin/Api/Root.html","kind":"class","full_name":"StackCoin::Api::Root","name":"Root","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},"ancestors":[{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/root.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/root.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/root.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/root.cr#L8","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"get(\"/\") do |env|\n if self.should_return_html(env)\n next render(\"src/views/home.ecr\")\n end\n infos = Hash(String, Hash(String, Array(String) | Nil)).new\n Route.list.each do |route|\n infos[route.class.name] = route.info\n end\n infos.to_json\nend"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Api/Route","path":"StackCoin/Api/Route.html","kind":"class","full_name":"StackCoin::Api::Route","name":"Route","abstract":true,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/base.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Api/Auth","kind":"class","full_name":"StackCoin::Api::Auth","name":"Auth"},{"html_id":"stackcoin/StackCoin/Api/Ledger","kind":"class","full_name":"StackCoin::Api::Ledger","name":"Ledger"},{"html_id":"stackcoin/StackCoin/Api/Root","kind":"class","full_name":"StackCoin::Api::Root","name":"Root"},{"html_id":"stackcoin/StackCoin/Api/User","kind":"class","full_name":"StackCoin::Api::User","name":"User"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[{"id":"list:Array(Route)-class-method","html_id":"list:Array(Route)-class-method","name":"list","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Route)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L5","def":{"name":"list","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Route)","visibility":"Public","body":"@@list"}}],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L24","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"auth:StackCoin::Auth-instance-method","html_id":"auth:StackCoin::Auth-instance-method","name":"auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Auth","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L21","def":{"name":"auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Auth","visibility":"Public","body":"@auth"}},{"id":"auth=(auth:StackCoin::Auth)-instance-method","html_id":"auth=(auth:StackCoin::Auth)-instance-method","name":"auth=","doc":null,"summary":null,"abstract":false,"args":[{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"args_string":"(auth : StackCoin::Auth)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L21","def":{"name":"auth=","args":[{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@auth = auth"}},{"id":"bank:Bank-instance-method","html_id":"bank:Bank-instance-method","name":"bank","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bank","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L19","def":{"name":"bank","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bank","visibility":"Public","body":"@bank"}},{"id":"bank=(bank:Bank)-instance-method","html_id":"bank=(bank:Bank)-instance-method","name":"bank=","doc":null,"summary":null,"abstract":false,"args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"}],"args_string":"(bank : Bank)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L19","def":{"name":"bank=","args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@bank = bank"}},{"id":"config:Config-instance-method","html_id":"config:Config-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Config","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L22","def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Config","visibility":"Public","body":"@config"}},{"id":"config=(config:Config)-instance-method","html_id":"config=(config:Config)-instance-method","name":"config=","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L22","def":{"name":"config=","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config = config"}},{"id":"info-instance-method","html_id":"info-instance-method","name":"info","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L36","def":{"name":"info","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"{\"routes\" => @routes, \"requires_auth\" => @requires_auth}"}},{"id":"json_error(message)-instance-method","html_id":"json_error(message)-instance-method","name":"json_error","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L15","def":{"name":"json_error","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"\"{\\\"message\\\": \\\"#{message}\\\"}\""}},{"id":"requires_auth:Array(String)?-instance-method","html_id":"requires_auth:Array(String)?-instance-method","name":"requires_auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)?","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L34","def":{"name":"requires_auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String) | Nil","visibility":"Public","body":"@requires_auth"}},{"id":"requires_auth=(requires_auth:Array(String)?)-instance-method","html_id":"requires_auth=(requires_auth:Array(String)?)-instance-method","name":"requires_auth=","doc":null,"summary":null,"abstract":false,"args":[{"name":"requires_auth","doc":null,"default_value":"","external_name":"requires_auth","restriction":"Array(String) | Nil"}],"args_string":"(requires_auth : Array(String)?)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L34","def":{"name":"requires_auth=","args":[{"name":"requires_auth","doc":null,"default_value":"","external_name":"requires_auth","restriction":"Array(String) | Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@requires_auth = requires_auth"}},{"id":"routes:Array(String)-instance-method","html_id":"routes:Array(String)-instance-method","name":"routes","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L33","def":{"name":"routes","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@routes"}},{"id":"routes=(routes:Array(String))-instance-method","html_id":"routes=(routes:Array(String))-instance-method","name":"routes=","doc":null,"summary":null,"abstract":false,"args":[{"name":"routes","doc":null,"default_value":"","external_name":"routes","restriction":"Array(String)"}],"args_string":"(routes : Array(String))","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L33","def":{"name":"routes=","args":[{"name":"routes","doc":null,"default_value":"","external_name":"routes","restriction":"Array(String)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@routes = routes"}},{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":true,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L43","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"should_return_html(env)-instance-method","html_id":"should_return_html(env)-instance-method","name":"should_return_html","doc":null,"summary":null,"abstract":false,"args":[{"name":"env","doc":null,"default_value":"","external_name":"env","restriction":""}],"args_string":"(env)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L7","def":{"name":"should_return_html","args":[{"name":"env","doc":null,"default_value":"","external_name":"env","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"headers = env.request.headers\nif headers.has_key?(\"Accept\")\n return (headers[\"Accept\"].split(',')).includes?(\"text/html\")\nend\nfalse\n"}},{"id":"stats:Statistics-instance-method","html_id":"stats:Statistics-instance-method","name":"stats","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Statistics","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L20","def":{"name":"stats","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Statistics","visibility":"Public","body":"@stats"}},{"id":"stats=(stats:Statistics)-instance-method","html_id":"stats=(stats:Statistics)-instance-method","name":"stats=","doc":null,"summary":null,"abstract":false,"args":[{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"}],"args_string":"(stats : Statistics)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/base.cr#L20","def":{"name":"stats=","args":[{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@stats = stats"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Api/User","path":"StackCoin/Api/User.html","kind":"class","full_name":"StackCoin::Api::User","name":"User","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},"ancestors":[{"html_id":"stackcoin/StackCoin/Api/Route","kind":"class","full_name":"StackCoin::Api::Route","name":"Route"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/routes/user.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/user.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Api","kind":"class","full_name":"StackCoin::Api","name":"Api"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/user.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"setup-instance-method","html_id":"setup-instance-method","name":"setup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/routes/user.cr#L8","def":{"name":"setup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"get(\"/user/:id\") do |env|\n id = env.params.url[\"id\"].to_u64?\n if id.is_a?(Nil)\n halt(env, status_code: 403)\n end\n bal = @bank.balance(id)\n if bal.is_a?(Nil)\n halt(env, status_code: 404)\n end\n user = Hash(String, String | Int32).new\n user[\"id\"] = id.to_s\n user[\"bal\"] = bal.to_s\n if should_return_html(env)\n next render(\"src/views/user.ecr\")\n end\n user.to_json\nend\nget(\"/user/\") do |env|\n users = Hash(String, Hash(String, UInt64 | Int32)).new\n @stats.all_balances.each do |id, balance|\n users[id.to_s] = Hash(String, UInt64 | Int32).new\n users[id.to_s][\"id\"] = id\n users[id.to_s][\"bal\"] = balance\n end\n if should_return_html(env)\n next render(\"src/views/users.ecr\")\n end\n users.to_json\nend\n"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Auth","path":"StackCoin/Auth.html","kind":"class","full_name":"StackCoin::Auth","name":"Auth","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Database,bank:Bank,jwt_secret_key:String)-class-method","html_id":"new(db:DB::Database,bank:Bank,jwt_secret_key:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"jwt_secret_key","doc":null,"default_value":"","external_name":"jwt_secret_key","restriction":"String"}],"args_string":"(db : DB::Database, bank : Bank, jwt_secret_key : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L37","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"jwt_secret_key","doc":null,"default_value":"","external_name":"jwt_secret_key","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, bank, jwt_secret_key)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"authenticate(user_id:UInt64,token:String)-instance-method","html_id":"authenticate(user_id:UInt64,token:String)-instance-method","name":"authenticate","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"args_string":"(user_id : UInt64, token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L52","def":{"name":"authenticate","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@db.transaction do |tx|\n cnn = tx.connection\n token_exists = (cnn.query_one(\"SELECT EXISTS(SELECT 1 FROM token WHERE user_id = ?)\", user_id.to_s, as: Int)) == 1\n if token_exists\n else\n return Result::NoSuchAccount.new(tx, \"No such account\")\n end\n db_token = cnn.query_one(\"SELECT token FROM token WHERE user_id = ?\", user_id.to_s, as: String)\n if db_token == token\n else\n return Result::InvalidToken.new(tx, \"Invalid Token\")\n end\nend\ninvalid_at = (Time.utc + 1.seconds).to_s(\"%Y-%m-%d %H:%M:%S %:z\")\npayload = {\"user_id\" => user_id, \"invalid_at\" => invalid_at}\naccess_token = JWT.encode(payload, @jwt_secret_key, JWT::Algorithm::HS256)\nResult::Authenticated.new(\"Authenticated\", access_token)\n"}},{"id":"create_account_with_token(user_id:UInt64)-instance-method","html_id":"create_account_with_token(user_id:UInt64)-instance-method","name":"create_account_with_token","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L40","def":{"name":"create_account_with_token","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"result = @bank.open_account(user_id)\nif !result.is_a?(Bank::Result::Success)\n return result\nend\ntoken = Random::Secure.hex(32)\n@db.exec(\"INSERT INTO token VALUES (?, ?)\", user_id.to_s, token)\nResult::AccountCreated.new(\"Account created\", token)\n"}},{"id":"validate_access_token(access_token:String)-instance-method","html_id":"validate_access_token(access_token:String)-instance-method","name":"validate_access_token","doc":null,"summary":null,"abstract":false,"args":[{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":"String"}],"args_string":"(access_token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L77","def":{"name":"validate_access_token","args":[{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"payload, header = JWT.decode(access_token, @jwt_secret_key, JWT::Algorithm::HS256)\ninvalid_at = Time.parse_utc(payload[\"invalid_at\"].as_s, \"%Y-%m-%d %H:%M:%S %z\")\nis_valid_access_token = invalid_at > Time.utc\nif !is_valid_access_token\n return Result::InvalidAccessToken.new(\"Invalid access token\")\nend\nResult::ValidAccessToken.new(\"Valid access token\", payload[\"user_id\"].as_i64.to_u64)\n"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Auth/Result","path":"StackCoin/Auth/Result.html","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":5,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L5"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth","kind":"class","full_name":"StackCoin::Auth","name":"Auth"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Auth/Result/AccountCreated","path":"StackCoin/Auth/Result/AccountCreated.html","kind":"class","full_name":"StackCoin::Auth::Result::AccountCreated","name":"AccountCreated","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L6"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message,token)-class-method","html_id":"new(message,token)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":""}],"args_string":"(message, token)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L9","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message, token)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L6","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"token:String-instance-method","html_id":"token:String-instance-method","name":"token","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L7","def":{"name":"token","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@token"}},{"id":"token=(token:String)-instance-method","html_id":"token=(token:String)-instance-method","name":"token=","doc":null,"summary":null,"abstract":false,"args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"args_string":"(token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L7","def":{"name":"token=","args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@token = token"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/Authenticated","path":"StackCoin/Auth/Result/Authenticated.html","kind":"class","full_name":"StackCoin::Auth::Result::Authenticated","name":"Authenticated","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":13,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L13"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message,access_token)-class-method","html_id":"new(message,access_token)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":""}],"args_string":"(message, access_token)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L16","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message, access_token)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L13","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"access_token:String-instance-method","html_id":"access_token:String-instance-method","name":"access_token","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L14","def":{"name":"access_token","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@access_token"}},{"id":"access_token=(access_token:String)-instance-method","html_id":"access_token=(access_token:String)-instance-method","name":"access_token=","doc":null,"summary":null,"abstract":false,"args":[{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":"String"}],"args_string":"(access_token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L14","def":{"name":"access_token=","args":[{"name":"access_token","doc":null,"default_value":"","external_name":"access_token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@access_token = access_token"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/InvalidAccessToken","path":"StackCoin/Auth/Result/InvalidAccessToken.html","kind":"class","full_name":"StackCoin::Auth::Result::InvalidAccessToken","name":"InvalidAccessToken","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":27,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L27"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L27","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/InvalidToken","path":"StackCoin/Auth/Result/InvalidToken.html","kind":"class","full_name":"StackCoin::Auth::Result::InvalidToken","name":"InvalidToken","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":33,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L33"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L33","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/NoSuchAccount","path":"StackCoin/Auth/Result/NoSuchAccount.html","kind":"class","full_name":"StackCoin::Auth::Result::NoSuchAccount","name":"NoSuchAccount","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":30,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L30"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L30","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Auth/Result/ValidAccessToken","path":"StackCoin/Auth/Result/ValidAccessToken.html","kind":"class","full_name":"StackCoin::Auth::Result::ValidAccessToken","name":"ValidAccessToken","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/auth.cr","line_number":20,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L20"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message,user_id)-class-method","html_id":"new(message,user_id)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":""}],"args_string":"(message, user_id)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L23","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message, user_id)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L20","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"user_id:UInt64-instance-method","html_id":"user_id:UInt64-instance-method","name":"user_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/auth.cr#L21","def":{"name":"user_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@user_id"}}],"macros":[],"types":[]}]}]},{"html_id":"stackcoin/StackCoin/Bank","path":"StackCoin/Bank.html","kind":"class","full_name":"StackCoin::Bank","name":"Bank","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Statistics","kind":"class","full_name":"StackCoin::Statistics","name":"Statistics"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Database,banned:Banned)-class-method","html_id":"new(db:DB::Database,banned:Banned)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"}],"args_string":"(db : DB::Database, banned : Banned)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L38","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, banned)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"balance(cnn:DB::Connection,user_id:UInt64)-instance-method","html_id":"balance(cnn:DB::Connection,user_id:UInt64)-instance-method","name":"balance","doc":null,"summary":null,"abstract":false,"args":[{"name":"cnn","doc":null,"default_value":"","external_name":"cnn","restriction":"DB::Connection"},{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(cnn : DB::Connection, user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L57","def":{"name":"balance","args":[{"name":"cnn","doc":null,"default_value":"","external_name":"cnn","restriction":"DB::Connection"},{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"cnn.query_one?(\"SELECT bal FROM balance WHERE user_id = ?\", user_id.to_s, as: Int32)"}},{"id":"balance(user_id:UInt64)-instance-method","html_id":"balance(user_id:UInt64)-instance-method","name":"balance","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L63","def":{"name":"balance","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@db.transaction do |tx|\n bal = self.balance(tx.connection, user_id)\n tx.commit\n return bal\nend"}},{"id":"db:DB::Database-instance-method","html_id":"db:DB::Database-instance-method","name":"db","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : DB::Database","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L41","def":{"name":"db","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@db"}},{"id":"deposit_dole(user_id:UInt64)-instance-method","html_id":"deposit_dole(user_id:UInt64)-instance-method","name":"deposit_dole","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L71","def":{"name":"deposit_dole","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"bal = 0\nnow = Time.utc\n@db.transaction do |tx|\n cnn = tx.connection\n expect_one = cnn.query_one(\"SELECT EXISTS(SELECT 1 FROM last_given_dole WHERE user_id = ?)\", user_id.to_s, as: Int)\n if expect_one == 0\n return Result::NoSuchAccount.new(tx, \"No account to deposit dole to\")\n end\n last_given = Database.parse_time(cnn.query_one(\"SELECT time FROM last_given_dole WHERE user_id = ?\", user_id.to_s, as: String))\n if last_given.day == now.day\n time_till_rollver = HumanizeTime.distance_of_time_in_words(Time.utc.at_end_of_day - Time.utc, Time.utc)\n return Result::PrematureDole.new(tx, \"Dole already received today, rollover in #{time_till_rollver}\")\n end\n self.deposit(cnn, user_id, @@dole_amount)\n cnn.exec(\"UPDATE last_given_dole SET time = ? WHERE user_id = ?\", now, user_id.to_s)\n bal = self.balance(cnn, user_id)\n args = [] of DB::Any\n args << user_id.to_s\n args << bal\n args << @@dole_amount\n args << now\n cnn.exec(\"INSERT INTO benefit(user_id, user_bal, amount, time) VALUES (?, ?, ?, ?)\", args: args)\nend\nResult::Success.new(\"#{@@dole_amount} StackCoin given, your balance is now #{bal}\")\n"}},{"id":"has_account(user_id:UInt64)-instance-method","html_id":"has_account(user_id:UInt64)-instance-method","name":"has_account","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L117","def":{"name":"has_account","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"0 < (@db.query_one(\"SELECT EXISTS(SELECT 1 FROM balance WHERE user_id = ?)\", user_id.to_s, as: Int))"}},{"id":"open_account(user_id:UInt64)-instance-method","html_id":"open_account(user_id:UInt64)-instance-method","name":"open_account","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L123","def":{"name":"open_account","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"initial_bal = 0\n@db.transaction do |tx|\n cnn = tx.connection\n expect_zero = cnn.query_one(\"SELECT EXISTS(SELECT 1 FROM balance WHERE user_id = ?)\", user_id.to_s, as: Int)\n if expect_zero > 0\n return Result::PreexistingAccount.new(tx, \"Account already open\")\n end\n cnn.exec(\"INSERT INTO balance VALUES (?, ?)\", user_id.to_s, initial_bal)\n cnn.exec(\"INSERT INTO last_given_dole VALUES (?, ?)\", user_id.to_s, EPOCH)\nend\nResult::Success.new(\"Account created, initial balance is #{initial_bal}\")\n"}},{"id":"transfer(from_id:UInt64,to_id:UInt64,amount:Int32)-instance-method","html_id":"transfer(from_id:UInt64,to_id:UInt64,amount:Int32)-instance-method","name":"transfer","doc":null,"summary":null,"abstract":false,"args":[{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":"UInt64"},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":"UInt64"},{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":"Int32"}],"args_string":"(from_id : UInt64, to_id : UInt64, amount : Int32)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L149","def":{"name":"transfer","args":[{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":"UInt64"},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":"UInt64"},{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if from_id == to_id\n return Result::TransferSelf.new(\"Can't transfer money to self\")\nend\nif amount > 0\nelse\n return Result::InvalidAmount.new(\"Amount must be greater than zero\")\nend\nif amount > 100000\n return Result::InvalidAmount.new(\"Amount can't be greater than 100000\")\nend\nif (@banned.is_banned(from_id)) || (@banned.is_banned(to_id))\n return Result::BannedUser.new(\"Banned user mentioned in transaction\")\nend\nfrom_balance, to_balance = 0, 0\n@db.transaction do |tx|\n cnn = tx.connection\n from_balance = self.balance(cnn, from_id)\n if !from_balance.is_a?(Int32)\n return Result::NoSuchAccount.new(tx, \"You don't have an account yet\")\n end\n to_balance = self.balance(cnn, to_id)\n if !to_balance.is_a?(Int32)\n return Result::NoSuchAccount.new(tx, \"User doesn't have an account yet\")\n end\n if (from_balance - amount) < 0\n return Result::InsufficientFunds.new(tx, \"Insufficient funds\")\n end\n from_balance = from_balance - amount\n self.withdraw(cnn, from_id, amount)\n to_balance = to_balance + amount\n self.deposit(cnn, to_id, amount)\n args = [] of DB::Any\n args << from_id.to_s\n args << from_balance\n args << to_id.to_s\n args << to_balance\n args << amount\n args << Time.utc\n cnn.exec(\"INSERT INTO ledger(\\n from_id, from_bal, to_id, to_bal, amount, time\\n) VALUES (\\n ?, ?, ?, ?, ?, ?\\n)\", args: args)\nend\nResult::TransferSuccess.new(\"Transfer sucessful\", from_balance, to_balance)\n"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Bank/Result","path":"StackCoin/Bank/Result.html","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":5,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L5"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank","kind":"class","full_name":"StackCoin::Bank","name":"Bank"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Bank/Result/BannedUser","path":"StackCoin/Bank/Result/BannedUser.html","kind":"class","full_name":"StackCoin::Bank::Result::BannedUser","name":"BannedUser","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":32,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L32"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L32","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/InsufficientFunds","path":"StackCoin/Bank/Result/InsufficientFunds.html","kind":"class","full_name":"StackCoin::Bank::Result::InsufficientFunds","name":"InsufficientFunds","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":29,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L29"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L29","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/InvalidAmount","path":"StackCoin/Bank/Result/InvalidAmount.html","kind":"class","full_name":"StackCoin::Bank::Result::InvalidAmount","name":"InvalidAmount","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":26,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L26"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L26","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/NoSuchAccount","path":"StackCoin/Bank/Result/NoSuchAccount.html","kind":"class","full_name":"StackCoin::Bank::Result::NoSuchAccount","name":"NoSuchAccount","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":17,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L17"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L17","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/PreexistingAccount","path":"StackCoin/Bank/Result/PreexistingAccount.html","kind":"class","full_name":"StackCoin::Bank::Result::PreexistingAccount","name":"PreexistingAccount","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":14,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L14"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L14","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/PrematureDole","path":"StackCoin/Bank/Result/PrematureDole.html","kind":"class","full_name":"StackCoin::Bank::Result::PrematureDole","name":"PrematureDole","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":20,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L20"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L20","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/TransferSelf","path":"StackCoin/Bank/Result/TransferSelf.html","kind":"class","full_name":"StackCoin::Bank::Result::TransferSelf","name":"TransferSelf","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":23,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L23"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L23","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bank/Result/TransferSuccess","path":"StackCoin/Bank/Result/TransferSuccess.html","kind":"class","full_name":"StackCoin::Bank::Result::TransferSuccess","name":"TransferSuccess","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"},{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bank.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L6"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message,from_bal,to_bal)-class-method","html_id":"new(message,from_bal,to_bal)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":""},{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":""}],"args_string":"(message, from_bal, to_bal)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L10","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":""},{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message, from_bal, to_bal)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L6","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}}],"instance_methods":[{"id":"from_bal:Int32-instance-method","html_id":"from_bal:Int32-instance-method","name":"from_bal","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L7","def":{"name":"from_bal","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@from_bal"}},{"id":"from_bal=(from_bal:Int32)-instance-method","html_id":"from_bal=(from_bal:Int32)-instance-method","name":"from_bal=","doc":null,"summary":null,"abstract":false,"args":[{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":"Int32"}],"args_string":"(from_bal : Int32)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L7","def":{"name":"from_bal=","args":[{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@from_bal = from_bal"}},{"id":"to_bal:Int32-instance-method","html_id":"to_bal:Int32-instance-method","name":"to_bal","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L8","def":{"name":"to_bal","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@to_bal"}},{"id":"to_bal=(to_bal:Int32)-instance-method","html_id":"to_bal=(to_bal:Int32)-instance-method","name":"to_bal=","doc":null,"summary":null,"abstract":false,"args":[{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":"Int32"}],"args_string":"(to_bal : Int32)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bank.cr#L8","def":{"name":"to_bal=","args":[{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@to_bal = to_bal"}}],"macros":[],"types":[]}]}]},{"html_id":"stackcoin/StackCoin/Banned","path":"StackCoin/Banned.html","kind":"class","full_name":"StackCoin::Banned","name":"Banned","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/banned.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Database)-class-method","html_id":"new(db:DB::Database)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"args_string":"(db : DB::Database)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L2","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"ban(user_id:UInt64)-instance-method","html_id":"ban(user_id:UInt64)-instance-method","name":"ban","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L22","def":{"name":"ban","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Banning '#{user_id}'\"\nend\n@banned_users << user_id\n@db.exec(\"INSERT INTO banned VALUES (?)\", args: [user_id.to_s])\n"}},{"id":"is_banned(user_id:UInt64)-instance-method","html_id":"is_banned(user_id:UInt64)-instance-method","name":"is_banned","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L18","def":{"name":"is_banned","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@banned_users.includes?(user_id)"}},{"id":"unban(user_id:UInt64)-instance-method","html_id":"unban(user_id:UInt64)-instance-method","name":"unban","doc":null,"summary":null,"abstract":false,"args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"args_string":"(user_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/banned.cr#L31","def":{"name":"unban","args":[{"name":"user_id","doc":null,"default_value":"","external_name":"user_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Unbanning '#{user_id}'\"\nend\n@banned_users.delete(user_id)\n@db.exec(\"DELETE FROM banned WHERE user_id = ?\", args: [user_id.to_s])\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot","path":"StackCoin/Bot.html","kind":"class","full_name":"StackCoin::Bot","name":"Bot","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L6"},{"filename":"src/stackcoin/commands/auth.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/auth.cr#L1"},{"filename":"src/stackcoin/commands/bal.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/bal.cr#L1"},{"filename":"src/stackcoin/commands/ban.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ban.cr#L1"},{"filename":"src/stackcoin/commands/base.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L1"},{"filename":"src/stackcoin/commands/circulation.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/circulation.cr#L1"},{"filename":"src/stackcoin/commands/dole.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L1"},{"filename":"src/stackcoin/commands/graph.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/graph.cr#L1"},{"filename":"src/stackcoin/commands/help.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L1"},{"filename":"src/stackcoin/commands/leaderboard.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/leaderboard.cr#L1"},{"filename":"src/stackcoin/commands/ledger.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ledger.cr#L1"},{"filename":"src/stackcoin/commands/mark.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/mark.cr#L1"},{"filename":"src/stackcoin/commands/open.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/open.cr#L1"},{"filename":"src/stackcoin/commands/send.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/send.cr#L1"},{"filename":"src/stackcoin/commands/unban.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/unban.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[{"id":"cleaned_message_content(prefix,message_content)-class-method","html_id":"cleaned_message_content(prefix,message_content)-class-method","name":"cleaned_message_content","doc":null,"summary":null,"abstract":false,"args":[{"name":"prefix","doc":null,"default_value":"","external_name":"prefix","restriction":""},{"name":"message_content","doc":null,"default_value":"","external_name":"message_content","restriction":""}],"args_string":"(prefix, message_content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L36","def":{"name":"cleaned_message_content","args":[{"name":"prefix","doc":null,"default_value":"","external_name":"prefix","restriction":""},{"name":"message_content","doc":null,"default_value":"","external_name":"message_content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"cleaned = (message_content.strip.split(' ')).select do |i|\n i != \"\"\nend\ncleaned[0] = (Bot.simplified_message_content_for_parsing(cleaned[0])).lchop(prefix)\nif (cleaned[0] == \"\") && cleaned.size >= 2\n cleaned.shift\n cleaned[0] = cleaned[0].downcase.lchop(prefix)\nend\ncleaned\n"}},{"id":"simplified_message_content_for_parsing(message_content)-class-method","html_id":"simplified_message_content_for_parsing(message_content)-class-method","name":"simplified_message_content_for_parsing","doc":null,"summary":null,"abstract":false,"args":[{"name":"message_content","doc":null,"default_value":"","external_name":"message_content","restriction":""}],"args_string":"(message_content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L32","def":{"name":"simplified_message_content_for_parsing","args":[{"name":"message_content","doc":null,"default_value":"","external_name":"message_content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"message_content.downcase.gsub(\"$\", \"s\")"}}],"constructors":[{"id":"new(config:Config,bank:Bank,stats:Statistics,auth:StackCoin::Auth,banned:Banned,designated_channel:StackCoin::DesignatedChannel)-class-method","html_id":"new(config:Config,bank:Bank,stats:Statistics,auth:StackCoin::Auth,banned:Banned,designated_channel:StackCoin::DesignatedChannel)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"},{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":"StackCoin::DesignatedChannel"}],"args_string":"(config : Config, bank : Bank, stats : Statistics, auth : StackCoin::Auth, banned : Banned, designated_channel : StackCoin::DesignatedChannel)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L49","def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"},{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":"StackCoin::DesignatedChannel"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(config, bank, stats, auth, banned, designated_channel)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"run!-instance-method","html_id":"run!-instance-method","name":"run!","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L130","def":{"name":"run!","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Running Discord client\"\nend\n@client.run\n"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Bot/Auth","path":"StackCoin/Bot/Auth.html","kind":"class","full_name":"StackCoin::Bot::Auth","name":"Auth","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/auth.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/auth.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/auth.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/auth.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if message.author.id != @config.owner_id\n return Result::Error.new(@client, message, \"Command only for use by bots owner!\")\nend\nmentions = Discord::Mention.parse(message.content)\nif mentions.size != 2\n return Result::Error.new(@client, message, \"Too many/little mentions in your message; two is expected\")\nend\nbot_user_mention = mentions[0]\nif !bot_user_mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message\")\nend\nif bot_user_mention.id.to_u64 == @config.client_id\n return Result::Error.new(@client, message, \"StackCoin itself can't have an account with itself!\")\nend\nbot_user = @cache.resolve_user(bot_user_mention.id)\nif !bot_user.bot\n return Result::Error.new(@client, message, \"Mentioned a non-bot user as the bot user in your message\")\nend\nbot_users_owner_mention = mentions[1]\nif !bot_users_owner_mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message\")\nend\nbot_users_owner = @cache.resolve_user(bot_users_owner_mention.id)\nif bot_users_owner.bot\n return Result::Error.new(@client, message, \"Mentioned a bot user as the bot users owner in your message\")\nend\nresult = @auth.create_account_with_token(bot_user.id.to_u64)\nif !result.is_a?(StackCoin::Auth::Result::AccountCreated)\n return Result::Error.new(@client, message, result.message)\nend\nbegin\n private_channel = @client.create_dm(bot_users_owner.id)\n response = \"Check your direct messages for a token from StackCoin :)\"\n token_message = \"Here's your token to access the StackCoin API from #{bot_user.username}: ```#{result.token}```\"\n send_msg(@client, private_channel.id, token_message)\nrescue Discord::CodeException\n owner = @cache.resolve_user(@config.owner_id)\n response = \"Direct message containing token failed to send (maybe you have DMs locked down?), ask #{owner.username} for your token instead :)\"\n token_message = \"#{bot_users_owner.username}##{bot_users_owner.discriminator}'s (#{bot_users_owner.id}) token to access the StackCoin API: ```#{result.token}```\"\n owners_private_channel = @client.create_dm(@config.owner_id)\n send_msg(@client, owners_private_channel.id, token_message)\nend\nsend_emb(message, Discord::Embed.new(title: \"_Token-authenticated bot user initialized_:\", fields: [Discord::EmbedField.new(name: \"#{message.author.username}\", value: response)]))\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Bal","path":"StackCoin/Bot/Bal.html","kind":"class","full_name":"StackCoin::Bot::Bal","name":"Bal","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/bal.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/bal.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/bal.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/bal.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"mentions = Discord::Mention.parse(message.content)\nif mentions.size > 1\n return Result::Error.new(@client, message, \"Too many mentions in your message; max is one\")\nend\nprefix = \"You don't\"\nuser = message.author\nbal = nil\nif mentions.size > 0\n mention = mentions[0]\n if !mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned entity isn't a user!\")\n end\n user = @cache.resolve_user(mention.id)\n bal = @bank.balance(mention.id.to_u64)\n if mention.id != message.author.id\n prefix = \"User doesn't\"\n end\nelse\n bal = @bank.balance(message.author.id.to_u64)\nend\nif bal.is_a?(Nil)\n return Result::Error.new(@client, message, \"#{prefix} have an account, run #{@config.prefix}open to create an account\")\nend\nsend_emb(message, Discord::Embed.new(title: \"_Balance:_\", fields: [Discord::EmbedField.new(name: \"#{user.username}\", value: \"#{bal}\")]))\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Ban","path":"StackCoin/Bot/Ban.html","kind":"class","full_name":"StackCoin::Bot::Ban","name":"Ban","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/ban.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ban.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ban.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ban.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if message.author.id != @config.owner_id\n return Result::Error.new(@client, message, \"Command only for use by bots owner!\")\nend\nmentions = Discord::Mention.parse(message.content)\nif mentions.size != 1\n return Result::Error.new(@client, message, \"Too many/little mentions in your message; one is expected\")\nend\nuser_mention = mentions[0]\nif !user_mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message: #{user_mention}\")\nend\nuser_id = user_mention.id.to_u64\nis_banned = @banned.is_banned(user_id)\nif is_banned\n return Result::Error.new(@client, message, \"User <@#{user_mention.id}> is already banned\")\nend\n@banned.ban(user_id)\nsend_msg(message, \"❌ User <@#{user_mention.id}> banned ❌\")\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Circulation","path":"StackCoin/Bot/Circulation.html","kind":"class","full_name":"StackCoin::Bot::Circulation","name":"Circulation","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/circulation.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/circulation.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/circulation.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/circulation.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"send_emb(message, Discord::Embed.new(title: \"_Total StackCoin in Circulation:_\", fields: [Discord::EmbedField.new(name: \"#{@stats.circulation} STK\", value: \"Since #{EPOCH}\")]))"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Command","path":"StackCoin/Bot/Command.html","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command","abstract":true,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/base.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Bot/Auth","kind":"class","full_name":"StackCoin::Bot::Auth","name":"Auth"},{"html_id":"stackcoin/StackCoin/Bot/Bal","kind":"class","full_name":"StackCoin::Bot::Bal","name":"Bal"},{"html_id":"stackcoin/StackCoin/Bot/Ban","kind":"class","full_name":"StackCoin::Bot::Ban","name":"Ban"},{"html_id":"stackcoin/StackCoin/Bot/Circulation","kind":"class","full_name":"StackCoin::Bot::Circulation","name":"Circulation"},{"html_id":"stackcoin/StackCoin/Bot/Dole","kind":"class","full_name":"StackCoin::Bot::Dole","name":"Dole"},{"html_id":"stackcoin/StackCoin/Bot/Graph","kind":"class","full_name":"StackCoin::Bot::Graph","name":"Graph"},{"html_id":"stackcoin/StackCoin/Bot/Help","kind":"class","full_name":"StackCoin::Bot::Help","name":"Help"},{"html_id":"stackcoin/StackCoin/Bot/Leaderboard","kind":"class","full_name":"StackCoin::Bot::Leaderboard","name":"Leaderboard"},{"html_id":"stackcoin/StackCoin/Bot/Ledger","kind":"class","full_name":"StackCoin::Bot::Ledger","name":"Ledger"},{"html_id":"stackcoin/StackCoin/Bot/Mark","kind":"class","full_name":"StackCoin::Bot::Mark","name":"Mark"},{"html_id":"stackcoin/StackCoin/Bot/Open","kind":"class","full_name":"StackCoin::Bot::Open","name":"Open"},{"html_id":"stackcoin/StackCoin/Bot/Send","kind":"class","full_name":"StackCoin::Bot::Send","name":"Send"},{"html_id":"stackcoin/StackCoin/Bot/Unban","kind":"class","full_name":"StackCoin::Bot::Unban","name":"Unban"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[{"id":"lookup:Hash(String,Command)-class-method","html_id":"lookup:Hash(String,Command)-class-method","name":"lookup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Hash(String, Command)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L5","def":{"name":"lookup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Hash(String, Command)","visibility":"Public","body":"@@lookup"}}],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L19","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"auth:StackCoin::Auth-instance-method","html_id":"auth:StackCoin::Auth-instance-method","name":"auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Auth","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L14","def":{"name":"auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Auth","visibility":"Public","body":"@auth"}},{"id":"auth=(auth:StackCoin::Auth)-instance-method","html_id":"auth=(auth:StackCoin::Auth)-instance-method","name":"auth=","doc":null,"summary":null,"abstract":false,"args":[{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"args_string":"(auth : StackCoin::Auth)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L14","def":{"name":"auth=","args":[{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":"StackCoin::Auth"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@auth = auth"}},{"id":"bank:Bank-instance-method","html_id":"bank:Bank-instance-method","name":"bank","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bank","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L12","def":{"name":"bank","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bank","visibility":"Public","body":"@bank"}},{"id":"bank=(bank:Bank)-instance-method","html_id":"bank=(bank:Bank)-instance-method","name":"bank=","doc":null,"summary":null,"abstract":false,"args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"}],"args_string":"(bank : Bank)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L12","def":{"name":"bank=","args":[{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":"Bank"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@bank = bank"}},{"id":"banned:Banned-instance-method","html_id":"banned:Banned-instance-method","name":"banned","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Banned","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L15","def":{"name":"banned","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Banned","visibility":"Public","body":"@banned"}},{"id":"banned=(banned:Banned)-instance-method","html_id":"banned=(banned:Banned)-instance-method","name":"banned=","doc":null,"summary":null,"abstract":false,"args":[{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"}],"args_string":"(banned : Banned)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L15","def":{"name":"banned=","args":[{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":"Banned"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@banned = banned"}},{"id":"cache:Discord::Cache-instance-method","html_id":"cache:Discord::Cache-instance-method","name":"cache","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Cache","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L11","def":{"name":"cache","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Cache","visibility":"Public","body":"@cache"}},{"id":"cache=(cache:Discord::Cache)-instance-method","html_id":"cache=(cache:Discord::Cache)-instance-method","name":"cache=","doc":null,"summary":null,"abstract":false,"args":[{"name":"cache","doc":null,"default_value":"","external_name":"cache","restriction":"Discord::Cache"}],"args_string":"(cache : Discord::Cache)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L11","def":{"name":"cache=","args":[{"name":"cache","doc":null,"default_value":"","external_name":"cache","restriction":"Discord::Cache"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@cache = cache"}},{"id":"client:Discord::Client-instance-method","html_id":"client:Discord::Client-instance-method","name":"client","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Client","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L10","def":{"name":"client","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Client","visibility":"Public","body":"@client"}},{"id":"client=(client:Discord::Client)-instance-method","html_id":"client=(client:Discord::Client)-instance-method","name":"client=","doc":null,"summary":null,"abstract":false,"args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":"Discord::Client"}],"args_string":"(client : Discord::Client)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L10","def":{"name":"client=","args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":"Discord::Client"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@client = client"}},{"id":"config:Config-instance-method","html_id":"config:Config-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Config","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L17","def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Config","visibility":"Public","body":"@config"}},{"id":"config=(config:Config)-instance-method","html_id":"config=(config:Config)-instance-method","name":"config=","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L17","def":{"name":"config=","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@config = config"}},{"id":"desc:String-instance-method","html_id":"desc:String-instance-method","name":"desc","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L9","def":{"name":"desc","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@desc"}},{"id":"designated_channel:DesignatedChannel-instance-method","html_id":"designated_channel:DesignatedChannel-instance-method","name":"designated_channel","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : DesignatedChannel","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L16","def":{"name":"designated_channel","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DesignatedChannel","visibility":"Public","body":"@designated_channel"}},{"id":"designated_channel=(designated_channel:DesignatedChannel)-instance-method","html_id":"designated_channel=(designated_channel:DesignatedChannel)-instance-method","name":"designated_channel=","doc":null,"summary":null,"abstract":false,"args":[{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":"DesignatedChannel"}],"args_string":"(designated_channel : DesignatedChannel)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L16","def":{"name":"designated_channel=","args":[{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":"DesignatedChannel"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@designated_channel = designated_channel"}},{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":true,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L54","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"send_emb(message,content,emb:Discord::Embed)-instance-method","html_id":"send_emb(message,content,emb:Discord::Embed)-instance-method","name":"send_emb","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""},{"name":"emb","doc":null,"default_value":"","external_name":"emb","restriction":"Discord::Embed"}],"args_string":"(message, content, emb : Discord::Embed)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L44","def":{"name":"send_emb","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""},{"name":"emb","doc":null,"default_value":"","external_name":"emb","restriction":"Discord::Embed"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"emb.colour = 16773120\nemb.timestamp = Time.utc\nemb.footer = Discord::EmbedFooter.new(text: \"StackCoin™\", icon_url: \"https://i.imgur.com/CsVxtvM.png\")\n@client.create_message(message.channel_id, content, emb)\n"}},{"id":"send_emb(message,emb:Discord::Embed)-instance-method","html_id":"send_emb(message,emb:Discord::Embed)-instance-method","name":"send_emb","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"emb","doc":null,"default_value":"","external_name":"emb","restriction":"Discord::Embed"}],"args_string":"(message, emb : Discord::Embed)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L40","def":{"name":"send_emb","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"emb","doc":null,"default_value":"","external_name":"emb","restriction":"Discord::Embed"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.send_emb(message, \"\", emb)"}},{"id":"send_msg(message,channel_id,content)-instance-method","html_id":"send_msg(message,channel_id,content)-instance-method","name":"send_msg","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"args_string":"(message, channel_id, content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L36","def":{"name":"send_msg","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@client.create_message(channel_id, content)"}},{"id":"send_msg(message,content)-instance-method","html_id":"send_msg(message,content)-instance-method","name":"send_msg","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"args_string":"(message, content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L32","def":{"name":"send_msg","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@client.create_message(message.channel_id, content)"}},{"id":"stats:Statistics-instance-method","html_id":"stats:Statistics-instance-method","name":"stats","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Statistics","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L13","def":{"name":"stats","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Statistics","visibility":"Public","body":"@stats"}},{"id":"stats=(stats:Statistics)-instance-method","html_id":"stats=(stats:Statistics)-instance-method","name":"stats=","doc":null,"summary":null,"abstract":false,"args":[{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"}],"args_string":"(stats : Statistics)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L13","def":{"name":"stats=","args":[{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":"Statistics"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@stats = stats"}},{"id":"trigger:String-instance-method","html_id":"trigger:String-instance-method","name":"trigger","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L7","def":{"name":"trigger","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@trigger"}},{"id":"usage:String?-instance-method","html_id":"usage:String?-instance-method","name":"usage","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String?","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/base.cr#L8","def":{"name":"usage","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | Nil","visibility":"Public","body":"@usage"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Context","path":"StackCoin/Bot/Context.html","kind":"class","full_name":"StackCoin::Bot::Context","name":"Context","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":18,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L18"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(client,cache,bank,stats,auth,banned,designated_channel,config)-class-method","html_id":"new(client,cache,bank,stats,auth,banned,designated_channel,config)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"cache","doc":null,"default_value":"","external_name":"cache","restriction":""},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":""},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":""},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":""},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":""},{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":""},{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":""}],"args_string":"(client, cache, bank, stats, auth, banned, designated_channel, config)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L28","def":{"name":"new","args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"cache","doc":null,"default_value":"","external_name":"cache","restriction":""},{"name":"bank","doc":null,"default_value":"","external_name":"bank","restriction":""},{"name":"stats","doc":null,"default_value":"","external_name":"stats","restriction":""},{"name":"auth","doc":null,"default_value":"","external_name":"auth","restriction":""},{"name":"banned","doc":null,"default_value":"","external_name":"banned","restriction":""},{"name":"designated_channel","doc":null,"default_value":"","external_name":"designated_channel","restriction":""},{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(client, cache, bank, stats, auth, banned, designated_channel, config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"auth:StackCoin::Auth-instance-method","html_id":"auth:StackCoin::Auth-instance-method","name":"auth","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Auth","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L23","def":{"name":"auth","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Auth","visibility":"Public","body":"@auth"}},{"id":"bank:Bank-instance-method","html_id":"bank:Bank-instance-method","name":"bank","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bank","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L21","def":{"name":"bank","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bank","visibility":"Public","body":"@bank"}},{"id":"banned:StackCoin::Banned-instance-method","html_id":"banned:StackCoin::Banned-instance-method","name":"banned","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::Banned","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L24","def":{"name":"banned","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::Banned","visibility":"Public","body":"@banned"}},{"id":"cache:Discord::Cache-instance-method","html_id":"cache:Discord::Cache-instance-method","name":"cache","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Cache","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L20","def":{"name":"cache","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Cache","visibility":"Public","body":"@cache"}},{"id":"client:Discord::Client-instance-method","html_id":"client:Discord::Client-instance-method","name":"client","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Client","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L19","def":{"name":"client","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Client","visibility":"Public","body":"@client"}},{"id":"config:Config-instance-method","html_id":"config:Config-instance-method","name":"config","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Config","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L26","def":{"name":"config","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Config","visibility":"Public","body":"@config"}},{"id":"designated_channel:StackCoin::DesignatedChannel-instance-method","html_id":"designated_channel:StackCoin::DesignatedChannel-instance-method","name":"designated_channel","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : StackCoin::DesignatedChannel","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L25","def":{"name":"designated_channel","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"StackCoin::DesignatedChannel","visibility":"Public","body":"@designated_channel"}},{"id":"stats:Statistics-instance-method","html_id":"stats:Statistics-instance-method","name":"stats","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Statistics","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L22","def":{"name":"stats","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Statistics","visibility":"Public","body":"@stats"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Dole","path":"StackCoin/Bot/Dole.html","kind":"class","full_name":"StackCoin::Bot::Dole","name":"Dole","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/dole.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L22","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"send_msg(message, (@bank.deposit_dole(message.author.id.to_u64)).message)"}},{"id":"memes(message)-instance-method","html_id":"memes(message)-instance-method","name":"memes","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/dole.cr#L9","def":{"name":"memes","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"case message.author.id.to_u64\nwhen 134337759446958081_u64\nwhen 120571255635181568_u64\nwhen 140981598987354112_u64\nwhen 72073771468468224_u64\nwhen 72069821960822784_u64\nwhen 163415804761735170_u64\nwhen 636346308403134484_u64\nelse\nend"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Graph","path":"StackCoin/Bot/Graph.html","kind":"class","full_name":"StackCoin::Bot::Graph","name":"Graph","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/graph.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/graph.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/graph.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/graph.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"mentions = Discord::Mention.parse(message.content)\nif mentions.size > 1\n return Result::Error.new(@client, message, \"Too many mentions in your message; max is one\")\nend\nprefix = \"You don't\"\nid = message.author.id\nuser = message.author\nif mentions.size > 0\n mention = mentions[0]\n if !mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned entity isn't a user!\")\n end\n id = mention.id\n user = @cache.resolve_user(mention.id)\n if mention.id != message.author.id\n prefix = \"User doesn't\"\n end\nend\nid = id.to_u64\nif !(@bank.has_account(id))\n return Result::Error.new(@client, message, \"#{prefix} have an account to see a graph of!\")\nend\nresult = @stats.graph(id)\nif result.is_a?(Statistics::Result::Graph::Success)\n @client.upload_file(channel_id: message.channel_id, content: \"#{user.username}'s STK balance over time\", file: result.file)\n result.file.delete\nelse\n client.create_message(message.channel_id, result.message)\nend\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Help","path":"StackCoin/Bot/Help.html","kind":"class","full_name":"StackCoin::Bot::Help","name":"Help","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/help.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L6","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L35","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"msg_parts = Bot.cleaned_message_content(@config.prefix, message.content)\nif msg_parts.size > 2\n return Result::Error.new(@client, message, \"Too many arguments in message, found #{msg_parts.size}\")\nend\nif msg_parts.size == 1\n send_emb(message, @root_help)\nelse\n command = msg_parts.last\n if @sub_help.has_key?(command)\n send_emb(message, @sub_help[command])\n else\n postfix = \"\"\n potential = Levenshtein.find(command, @sub_help.keys)\n if potential\n postfix = \", did you mean #{potential}?\"\n end\n Result::Error.new(@client, message, \"Unknown help section: #{command}#{postfix}\")\n end\nend\n"}},{"id":"root_help:Discord::Embed-instance-method","html_id":"root_help:Discord::Embed-instance-method","name":"root_help","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Embed","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L3","def":{"name":"root_help","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@root_help"}},{"id":"root_help=(root_help)-instance-method","html_id":"root_help=(root_help)-instance-method","name":"root_help=","doc":null,"summary":null,"abstract":false,"args":[{"name":"root_help","doc":null,"default_value":"","external_name":"root_help","restriction":""}],"args_string":"(root_help)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L3","def":{"name":"root_help=","args":[{"name":"root_help","doc":null,"default_value":"","external_name":"root_help","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@root_help = root_help"}},{"id":"sub_help:Hash(String,Discord::Embed)-instance-method","html_id":"sub_help:Hash(String,Discord::Embed)-instance-method","name":"sub_help","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Hash(String, Discord::Embed)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L4","def":{"name":"sub_help","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sub_help"}},{"id":"sub_help=(sub_help)-instance-method","html_id":"sub_help=(sub_help)-instance-method","name":"sub_help=","doc":null,"summary":null,"abstract":false,"args":[{"name":"sub_help","doc":null,"default_value":"","external_name":"sub_help","restriction":""}],"args_string":"(sub_help)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/help.cr#L4","def":{"name":"sub_help=","args":[{"name":"sub_help","doc":null,"default_value":"","external_name":"sub_help","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@sub_help = sub_help"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Leaderboard","path":"StackCoin/Bot/Leaderboard.html","kind":"class","full_name":"StackCoin::Bot::Leaderboard","name":"Leaderboard","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/leaderboard.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/leaderboard.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/leaderboard.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/leaderboard.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"fields = [] of Discord::EmbedField\n@stats.leaderboard.each_with_index do |res, i|\n user = @cache.resolve_user(res[0])\n fields << Discord::EmbedField.new(name: \"##{i + 1}: #{user.username}\", value: \"Balance: #{res[1]}\")\nend\nsend_emb(message, Discord::Embed.new(title: \"_Leaderboard:_\", fields: fields))\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Ledger","path":"StackCoin/Bot/Ledger.html","kind":"class","full_name":"StackCoin::Bot::Ledger","name":"Ledger","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/ledger.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ledger.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ledger.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/ledger.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"dates = [] of String\nfrom_ids = [] of UInt64\nto_ids = [] of UInt64\nfields = [] of Discord::EmbedField\ncondition_context = [] of String\nyyy_mm_dd_regex = /([12]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01]))/\nmatches = message.content.scan(yyy_mm_dd_regex)\nif matches.size > 1\n return Result::Error.new(@client, message, \"Too many yyyy-mm-dd string in your message; max is one\")\nend\nif matches.size > 0\n date = matches[0][1]\n dates << date\n condition_context << \"Occured on #{date}\"\nend\nmentions = Discord::Mention.parse(message.content)\nif mentions.size > 2\n return Result::Error.new(@client, message, \"Too many mentions in your message; max is two\")\nend\nmentions.each do |mentioned|\n if !mentioned.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message\")\n else\n from_ids << mentioned.id\n to_ids << mentioned.id\n condition_context << \"Mentions #{(@cache.resolve_user(mentioned.id)).username}\"\n end\nend\nreport = @stats.ledger(dates, from_ids, to_ids)\nreport.results.each_with_index do |result, i|\n begin\n from = (@cache.resolve_user(result.from_id)).username\n rescue Discord::CodeException\n from = \"(?)\"\n end\n begin\n to = (@cache.resolve_user(result.to_id)).username\n rescue Discord::CodeException\n to = \"(?)\"\n end\n fields << Discord::EmbedField.new(name: \"#{i + 1} - #{result.time}\", value: \"#{from} (#{result.from_bal}) ⟶ #{to} (#{result.to_bal}) - #{result.amount} STK\")\nend\nif condition_context.size == 0\n condition_context << \"Most recent\"\nend\nif fields.size == 0\n fields << Discord::EmbedField.new(name: \"*crickets*\", value: \"Seems like no transactions were found in the ledger :(\")\nend\ntitle = \"_Searching ledger by_:\"\ncondition_context.each do |cond|\n title = title + \"\\n- #{cond}\"\nend\nsend_emb(message, Discord::Embed.new(title: title, fields: fields))\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Mark","path":"StackCoin/Bot/Mark.html","kind":"class","full_name":"StackCoin::Bot::Mark","name":"Mark","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/mark.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/mark.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/mark.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/mark.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if message.author.id != @config.owner_id\n return Result::Error.new(@client, message, \"Command only for use by bots owner!\")\nend\nguild_id = message.guild_id.not_nil!\nchannel_id = message.channel_id\n@designated_channel.mark(guild_id, channel_id)\nsend_msg(message, \"Channel <##{channel_id}> marked as the designated channel in this guild\")\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Open","path":"StackCoin/Bot/Open.html","kind":"class","full_name":"StackCoin::Bot::Open","name":"Open","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/open.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/open.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/open.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/open.cr#L9","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"send_msg(message, (@bank.open_account(message.author.id.to_u64)).message)"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Result","path":"StackCoin/Bot/Result.html","kind":"class","full_name":"StackCoin::Bot::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":7,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L7"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Bot/Result/Base","path":"StackCoin/Bot/Result/Base.html","kind":"class","full_name":"StackCoin::Bot::Result::Base","name":"Base","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":8,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L8"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Bot/Result/Error","kind":"class","full_name":"StackCoin::Bot::Result::Error","name":"Error"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot/Result","kind":"class","full_name":"StackCoin::Bot::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(client,message,content)-class-method","html_id":"new(client,message,content)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"args_string":"(client, message, content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L9","def":{"name":"new","args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(client, message, content)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Result/Error","path":"StackCoin/Bot/Result/Error.html","kind":"class","full_name":"StackCoin::Bot::Result::Error","name":"Error","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Result/Base","kind":"class","full_name":"StackCoin::Bot::Result::Base","name":"Base"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Result/Base","kind":"class","full_name":"StackCoin::Bot::Result::Base","name":"Base"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/bot.cr","line_number":14,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/bot.cr#L14"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot/Result","kind":"class","full_name":"StackCoin::Bot::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Bot/Send","path":"StackCoin/Bot/Send.html","kind":"class","full_name":"StackCoin::Bot::Send","name":"Send","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/send.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/send.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/send.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/send.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"mentions = Discord::Mention.parse(message.content)\nif mentions.size != 1\n return Result::Error.new(@client, message, \"Too many/little mentions in your message; max is one\")\nend\nmention = mentions[0]\nif !mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message\")\nend\nmsg_parts = Bot.cleaned_message_content(@config.prefix, message.content)\nif msg_parts.size > 3\n return Result::Error.new(@client, message, \"Too many arguments in message, found #{msg_parts.size}\")\nend\namount = msg_parts.last.to_i?\nif amount.is_a?(Nil)\n return Result::Error.new(@client, message, \"Invalid amount: #{msg_parts.last}\")\nend\nresult = @bank.transfer(message.author.id.to_u64, mention.id, amount)\nif result.is_a?(Bank::Result::TransferSuccess)\n to = @cache.resolve_user(mention.id)\n send_emb(message, Discord::Embed.new(title: \"_Transaction complete_:\", fields: [Discord::EmbedField.new(name: \"#{message.author.username}\", value: \"New bal: #{result.from_bal}\"), Discord::EmbedField.new(name: \"#{to.username}\", value: \"New bal: #{result.to_bal}\")]))\nelse\n Result::Error.new(@client, message, result.message)\nend\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Bot/Unban","path":"StackCoin/Bot/Unban.html","kind":"class","full_name":"StackCoin::Bot::Unban","name":"Unban","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bot/Command","kind":"class","full_name":"StackCoin::Bot::Command","name":"Command"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/commands/unban.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/unban.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Bot","kind":"class","full_name":"StackCoin::Bot","name":"Bot"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(context:Context)-class-method","html_id":"new(context:Context)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"args_string":"(context : Context)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/unban.cr#L3","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"Context"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"invoke(message)-instance-method","html_id":"invoke(message)-instance-method","name":"invoke","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/commands/unban.cr#L10","def":{"name":"invoke","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if message.author.id != @config.owner_id\n return Result::Error.new(@client, message, \"Command only for use by bots owner!\")\nend\nmentions = Discord::Mention.parse(message.content)\nif mentions.size != 1\n return Result::Error.new(@client, message, \"Too many/little mentions in your message; one is expected\")\nend\nuser_mention = mentions[0]\nif !user_mention.is_a?(Discord::Mention::User)\n return Result::Error.new(@client, message, \"Mentioned a non-user entity in your message: #{user_mention}\")\nend\nuser_id = user_mention.id.to_u64\nis_banned = @banned.is_banned(user_id)\nif !is_banned\n return Result::Error.new(@client, message, \"User <@#{user_mention.id}> is not banned\")\nend\n@banned.unban(user_id)\nsend_msg(message, \"👌 User <@#{user_mention.id}> unbanned 👌\")\n"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Config","path":"StackCoin/Config.html","kind":"class","full_name":"StackCoin::Config","name":"Config","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/config.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[{"id":"from_env-class-method","html_id":"from_env-class-method","name":"from_env","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L10","def":{"name":"from_env","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.info do\n \"Configuring bot from environment variables\"\nend\nconfig = Config.new\nconfig.token = \"Bot #{ENV[\"STACKCOIN_DISCORD_TOKEN\"]}\"\nconfig.client_id = ENV[\"STACKCOIN_DISCORD_CLIENT_ID\"].to_u64\nconfig.prefix = ENV[\"STACKCOIN_PREFIX\"]\nconfig.test_guild_snowflake = Discord::Snowflake.new(ENV[\"STACKCOIN_TEST_GUILD_SNOWFLAKE\"])\nconfig.database_url = ENV[\"STACKCOIN_DATABASE_URL\"]\nconfig.jwt_secret_key = ENV[\"STACKCOIN_JWT_SECRET_KEY\"]\nconfig.owner_id = Discord::Snowflake.new(ENV[\"STACKCOIN_OWNER_ID\"])\nconfig\n"}}],"constructors":[],"instance_methods":[{"id":"client_id:UInt64-instance-method","html_id":"client_id:UInt64-instance-method","name":"client_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L3","def":{"name":"client_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@client_id"}},{"id":"client_id=(client_id:UInt64)-instance-method","html_id":"client_id=(client_id:UInt64)-instance-method","name":"client_id=","doc":null,"summary":null,"abstract":false,"args":[{"name":"client_id","doc":null,"default_value":"","external_name":"client_id","restriction":"UInt64"}],"args_string":"(client_id : UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L3","def":{"name":"client_id=","args":[{"name":"client_id","doc":null,"default_value":"","external_name":"client_id","restriction":"UInt64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@client_id = client_id"}},{"id":"database_url:String-instance-method","html_id":"database_url:String-instance-method","name":"database_url","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L6","def":{"name":"database_url","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@database_url"}},{"id":"database_url=(database_url:String)-instance-method","html_id":"database_url=(database_url:String)-instance-method","name":"database_url=","doc":null,"summary":null,"abstract":false,"args":[{"name":"database_url","doc":null,"default_value":"","external_name":"database_url","restriction":"String"}],"args_string":"(database_url : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L6","def":{"name":"database_url=","args":[{"name":"database_url","doc":null,"default_value":"","external_name":"database_url","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@database_url = database_url"}},{"id":"jwt_secret_key:String-instance-method","html_id":"jwt_secret_key:String-instance-method","name":"jwt_secret_key","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L7","def":{"name":"jwt_secret_key","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@jwt_secret_key"}},{"id":"jwt_secret_key=(jwt_secret_key:String)-instance-method","html_id":"jwt_secret_key=(jwt_secret_key:String)-instance-method","name":"jwt_secret_key=","doc":null,"summary":null,"abstract":false,"args":[{"name":"jwt_secret_key","doc":null,"default_value":"","external_name":"jwt_secret_key","restriction":"String"}],"args_string":"(jwt_secret_key : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L7","def":{"name":"jwt_secret_key=","args":[{"name":"jwt_secret_key","doc":null,"default_value":"","external_name":"jwt_secret_key","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@jwt_secret_key = jwt_secret_key"}},{"id":"owner_id:Discord::Snowflake-instance-method","html_id":"owner_id:Discord::Snowflake-instance-method","name":"owner_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Snowflake","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L8","def":{"name":"owner_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Snowflake","visibility":"Public","body":"@owner_id"}},{"id":"owner_id=(owner_id:Discord::Snowflake)-instance-method","html_id":"owner_id=(owner_id:Discord::Snowflake)-instance-method","name":"owner_id=","doc":null,"summary":null,"abstract":false,"args":[{"name":"owner_id","doc":null,"default_value":"","external_name":"owner_id","restriction":"Discord::Snowflake"}],"args_string":"(owner_id : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L8","def":{"name":"owner_id=","args":[{"name":"owner_id","doc":null,"default_value":"","external_name":"owner_id","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@owner_id = owner_id"}},{"id":"prefix:String-instance-method","html_id":"prefix:String-instance-method","name":"prefix","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L4","def":{"name":"prefix","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@prefix"}},{"id":"prefix=(prefix:String)-instance-method","html_id":"prefix=(prefix:String)-instance-method","name":"prefix=","doc":null,"summary":null,"abstract":false,"args":[{"name":"prefix","doc":null,"default_value":"","external_name":"prefix","restriction":"String"}],"args_string":"(prefix : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L4","def":{"name":"prefix=","args":[{"name":"prefix","doc":null,"default_value":"","external_name":"prefix","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@prefix = prefix"}},{"id":"test_guild_snowflake:Discord::Snowflake-instance-method","html_id":"test_guild_snowflake:Discord::Snowflake-instance-method","name":"test_guild_snowflake","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Discord::Snowflake","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L5","def":{"name":"test_guild_snowflake","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Discord::Snowflake","visibility":"Public","body":"@test_guild_snowflake"}},{"id":"test_guild_snowflake=(test_guild_snowflake:Discord::Snowflake)-instance-method","html_id":"test_guild_snowflake=(test_guild_snowflake:Discord::Snowflake)-instance-method","name":"test_guild_snowflake=","doc":null,"summary":null,"abstract":false,"args":[{"name":"test_guild_snowflake","doc":null,"default_value":"","external_name":"test_guild_snowflake","restriction":"Discord::Snowflake"}],"args_string":"(test_guild_snowflake : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L5","def":{"name":"test_guild_snowflake=","args":[{"name":"test_guild_snowflake","doc":null,"default_value":"","external_name":"test_guild_snowflake","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@test_guild_snowflake = test_guild_snowflake"}},{"id":"token:String-instance-method","html_id":"token:String-instance-method","name":"token","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L2","def":{"name":"token","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@token"}},{"id":"token=(token:String)-instance-method","html_id":"token=(token:String)-instance-method","name":"token=","doc":null,"summary":null,"abstract":false,"args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"args_string":"(token : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/config.cr#L2","def":{"name":"token=","args":[{"name":"token","doc":null,"default_value":"","external_name":"token","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@token = token"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Database","path":"StackCoin/Database.html","kind":"class","full_name":"StackCoin::Database","name":"Database","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/db.cr","line_number":6,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L6"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"DB_INIT_SQL","name":"DB_INIT_SQL","value":"\"CREATE TABLE IF NOT EXISTS balance (\\n user_id TEXT PRIMARY KEY,\\n bal INTERGER\\n);\\n\\nCREATE TABLE IF NOT EXISTS banned (\\n user_id TEXT PRIMARY KEY\\n);\\n\\n\\nCREATE TABLE IF NOT EXISTS designated_channel (\\n guild_id TEXT PRIMARY KEY,\\n channel_id TEXT NOT NULL\\n);\\n\\nCREATE TABLE IF NOT EXISTS token (\\n user_id TEXT PRIMARY KEY,\\n token TEXT\\n);\\n\\nCREATE TABLE IF NOT EXISTS ledger (\\n id INTEGER PRIMARY KEY AUTOINCREMENT,\\n from_id TEXT,\\n from_bal INTERGER,\\n to_id TEXT,\\n to_bal INTERGER,\\n amount INTERGER,\\n time INTERGER\\n);\\n\\nCREATE TABLE IF NOT EXISTS benefit (\\n id INTEGER PRIMARY KEY AUTOINCREMENT,\\n user_id TEXT,\\n user_bal INTERGER,\\n amount INTERGER,\\n time INTERGER\\n);\\n\\nCREATE TABLE IF NOT EXISTS last_given_dole (\\n user_id TEXT PRIMARY KEY,\\n time INTERGER\\n)\"","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[{"id":"parse_time(time)-class-method","html_id":"parse_time(time)-class-method","name":"parse_time","doc":null,"summary":null,"abstract":false,"args":[{"name":"time","doc":null,"default_value":"","external_name":"time","restriction":""}],"args_string":"(time)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L78","def":{"name":"parse_time","args":[{"name":"time","doc":null,"default_value":"","external_name":"time","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Time.parse(time, SQLite3::DATE_FORMAT, Time::Location::UTC)"}}],"constructors":[{"id":"new(config:Config,db:DB::Database)-class-method","html_id":"new(config:Config,db:DB::Database)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"args_string":"(config : Config, db : DB::Database)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L7","def":{"name":"new","args":[{"name":"config","doc":null,"default_value":"","external_name":"config","restriction":"Config"},{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(config, db)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"backup-instance-method","html_id":"backup-instance-method","name":"backup","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L62","def":{"name":"backup","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"db_file = @config.database_url.lchop(\"sqlite3://\")\nbackup_file = \"#{db_file}.backup.#{Time.utc}.gz\"\nLog.info do\n \"gzipping #{db_file} to #{backup_file}...\"\nend\nFile.open(db_file, \"r\") do |database_file|\n File.open(backup_file, \"w\") do |backup_file|\n Compress::Gzip::Writer.open(backup_file) do |gzip|\n IO.copy(database_file, gzip)\n end\n end\nend\nLog.info do\n \"backup complete!\"\nend\n"}},{"id":"populate_tables(db)-instance-method","html_id":"populate_tables(db)-instance-method","name":"populate_tables","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":""}],"args_string":"(db)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/db.cr#L56","def":{"name":"populate_tables","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(DB_INIT_SQL.split(\";\")).each do |table_init_sql|\n db.exec(table_init_sql)\nend"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/DesignatedChannel","path":"StackCoin/DesignatedChannel.html","kind":"class","full_name":"StackCoin::DesignatedChannel","name":"DesignatedChannel","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/designated_channel.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Database)-class-method","html_id":"new(db:DB::Database)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"args_string":"(db : DB::Database)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L2","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Database"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"for_guild(guild_id:Discord::Snowflake)-instance-method","html_id":"for_guild(guild_id:Discord::Snowflake)-instance-method","name":"for_guild","doc":null,"summary":null,"abstract":false,"args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"}],"args_string":"(guild_id : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L27","def":{"name":"for_guild","args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@designated_channels[guild_id]"}},{"id":"is_permitted_to_reply_in(guild_id:Discord::Snowflake,channel_id:Discord::Snowflake)-instance-method","html_id":"is_permitted_to_reply_in(guild_id:Discord::Snowflake,channel_id:Discord::Snowflake)-instance-method","name":"is_permitted_to_reply_in","doc":null,"summary":null,"abstract":false,"args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":"Discord::Snowflake"}],"args_string":"(guild_id : Discord::Snowflake, channel_id : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L19","def":{"name":"is_permitted_to_reply_in","args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if permitted_channel = @designated_channels[guild_id]?\n return permitted_channel == channel_id\nend\ntrue\n"}},{"id":"mark(guild_id:Discord::Snowflake,channel_id:Discord::Snowflake)-instance-method","html_id":"mark(guild_id:Discord::Snowflake,channel_id:Discord::Snowflake)-instance-method","name":"mark","doc":null,"summary":null,"abstract":false,"args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":"Discord::Snowflake"}],"args_string":"(guild_id : Discord::Snowflake, channel_id : Discord::Snowflake)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/designated_channel.cr#L31","def":{"name":"mark","args":[{"name":"guild_id","doc":null,"default_value":"","external_name":"guild_id","restriction":"Discord::Snowflake"},{"name":"channel_id","doc":null,"default_value":"","external_name":"channel_id","restriction":"Discord::Snowflake"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if permitted_channel = @designated_channels[guild_id]?\n @designated_channels.delete(channel_id)\n @db.exec(\"DELETE FROM designated_channel WHERE guild_id = ?\", args: [guild_id.to_s])\nend\nLog.info do\n \"Marking '#{channel_id}' as the channel to be used for messages for '#{guild_id}'\"\nend\n@designated_channels[guild_id] = channel_id\n@db.exec(\"INSERT INTO designated_channel VALUES (?, ?)\", args: [guild_id.to_s, channel_id.to_s])\n"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Result","path":"StackCoin/Result.html","kind":"class","full_name":"StackCoin::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/result.cr","line_number":1,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L1"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Auth/Result","kind":"class","full_name":"StackCoin::Auth::Result","name":"Result"},{"html_id":"stackcoin/StackCoin/Bank/Result","kind":"class","full_name":"StackCoin::Bank::Result","name":"Result"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Result/Base","path":"StackCoin/Result/Base.html","kind":"class","full_name":"StackCoin::Result::Base","name":"Base","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/result.cr","line_number":2,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L2"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"}],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Result/Error","kind":"class","full_name":"StackCoin::Result::Error","name":"Error"},{"html_id":"stackcoin/StackCoin/Result/Success","kind":"class","full_name":"StackCoin::Result::Success","name":"Success"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L3","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}},{"id":"new(message)-class-method","html_id":"new(message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L9","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"error:String?-instance-method","html_id":"error:String?-instance-method","name":"error","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String?","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L6","def":{"name":"error","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | ::Nil","visibility":"Public","body":"@error"}},{"id":"error=(error:String?)-instance-method","html_id":"error=(error:String?)-instance-method","name":"error=","doc":null,"summary":null,"abstract":false,"args":[{"name":"error","doc":null,"default_value":"","external_name":"error","restriction":"String | ::Nil"}],"args_string":"(error : String?)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L6","def":{"name":"error=","args":[{"name":"error","doc":null,"default_value":"","external_name":"error","restriction":"String | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@error = error"}},{"id":"message:String-instance-method","html_id":"message:String-instance-method","name":"message","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L5","def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}},{"id":"message=(message:String)-instance-method","html_id":"message=(message:String)-instance-method","name":"message=","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"}],"args_string":"(message : String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L5","def":{"name":"message=","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@message = message"}},{"id":"name-instance-method","html_id":"name-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L12","def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"((self.class.name.split(\"::\")).last(1))[0]"}},{"id":"success:String?-instance-method","html_id":"success:String?-instance-method","name":"success","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String?","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L7","def":{"name":"success","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String | ::Nil","visibility":"Public","body":"@success"}},{"id":"success=(success:String?)-instance-method","html_id":"success=(success:String?)-instance-method","name":"success=","doc":null,"summary":null,"abstract":false,"args":[{"name":"success","doc":null,"default_value":"","external_name":"success","restriction":"String | ::Nil"}],"args_string":"(success : String?)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L7","def":{"name":"success=","args":[{"name":"success","doc":null,"default_value":"","external_name":"success","restriction":"String | ::Nil"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@success = success"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Result/Error","path":"StackCoin/Result/Error.html","kind":"class","full_name":"StackCoin::Result::Error","name":"Error","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/result.cr","line_number":28,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L28"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Auth/Result/InvalidAccessToken","kind":"class","full_name":"StackCoin::Auth::Result::InvalidAccessToken","name":"InvalidAccessToken"},{"html_id":"stackcoin/StackCoin/Auth/Result/InvalidToken","kind":"class","full_name":"StackCoin::Auth::Result::InvalidToken","name":"InvalidToken"},{"html_id":"stackcoin/StackCoin/Auth/Result/NoSuchAccount","kind":"class","full_name":"StackCoin::Auth::Result::NoSuchAccount","name":"NoSuchAccount"},{"html_id":"stackcoin/StackCoin/Bank/Result/BannedUser","kind":"class","full_name":"StackCoin::Bank::Result::BannedUser","name":"BannedUser"},{"html_id":"stackcoin/StackCoin/Bank/Result/InsufficientFunds","kind":"class","full_name":"StackCoin::Bank::Result::InsufficientFunds","name":"InsufficientFunds"},{"html_id":"stackcoin/StackCoin/Bank/Result/InvalidAmount","kind":"class","full_name":"StackCoin::Bank::Result::InvalidAmount","name":"InvalidAmount"},{"html_id":"stackcoin/StackCoin/Bank/Result/NoSuchAccount","kind":"class","full_name":"StackCoin::Bank::Result::NoSuchAccount","name":"NoSuchAccount"},{"html_id":"stackcoin/StackCoin/Bank/Result/PreexistingAccount","kind":"class","full_name":"StackCoin::Bank::Result::PreexistingAccount","name":"PreexistingAccount"},{"html_id":"stackcoin/StackCoin/Bank/Result/PrematureDole","kind":"class","full_name":"StackCoin::Bank::Result::PrematureDole","name":"PrematureDole"},{"html_id":"stackcoin/StackCoin/Bank/Result/TransferSelf","kind":"class","full_name":"StackCoin::Bank::Result::TransferSelf","name":"TransferSelf"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Transaction,message)-class-method","html_id":"new(db:DB::Transaction,message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Transaction"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(db : DB::Transaction, message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L33","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Transaction"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L28","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}},{"id":"new(message)-class-method","html_id":"new(message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L29","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Result/Success","path":"StackCoin/Result/Success.html","kind":"class","full_name":"StackCoin::Result::Success","name":"Success","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},"ancestors":[{"html_id":"stackcoin/StackCoin/Result/Base","kind":"class","full_name":"StackCoin::Result::Base","name":"Base"},{"html_id":"stackcoin/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/result.cr","line_number":17,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L17"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Auth/Result/AccountCreated","kind":"class","full_name":"StackCoin::Auth::Result::AccountCreated","name":"AccountCreated"},{"html_id":"stackcoin/StackCoin/Auth/Result/Authenticated","kind":"class","full_name":"StackCoin::Auth::Result::Authenticated","name":"Authenticated"},{"html_id":"stackcoin/StackCoin/Auth/Result/ValidAccessToken","kind":"class","full_name":"StackCoin::Auth::Result::ValidAccessToken","name":"ValidAccessToken"},{"html_id":"stackcoin/StackCoin/Bank/Result/TransferSuccess","kind":"class","full_name":"StackCoin::Bank::Result::TransferSuccess","name":"TransferSuccess"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Result","kind":"class","full_name":"StackCoin::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(db:DB::Transaction,message)-class-method","html_id":"new(db:DB::Transaction,message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Transaction"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(db : DB::Transaction, message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L22","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"DB::Transaction"},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"id":"new(pull:JSON::PullParser)-class-method","html_id":"new(pull:JSON::PullParser)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L17","def":{"name":"new","args":[{"name":"pull","doc":null,"default_value":"","external_name":"pull","restriction":"::JSON::PullParser"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"new_from_json_pull_parser(pull)"}},{"id":"new(message)-class-method","html_id":"new(message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/result.cr#L18","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Statistics","path":"StackCoin/Statistics.html","kind":"class","full_name":"StackCoin::Statistics","name":"Statistics","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Bank","kind":"class","full_name":"StackCoin::Bank","name":"Bank"},"ancestors":[{"html_id":"stackcoin/StackCoin/Bank","kind":"class","full_name":"StackCoin::Bank","name":"Bank"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":3,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L3"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin","kind":"module","full_name":"StackCoin","name":"StackCoin"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"all_balances-instance-method","html_id":"all_balances-instance-method","name":"all_balances","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L67","def":{"name":"all_balances","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.handle_balance_result_set(\"SELECT user_id, bal FROM balance\", nil)"}},{"id":"circulation-instance-method","html_id":"circulation-instance-method","name":"circulation","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L136","def":{"name":"circulation","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@db.query_one(\"SELECT SUM(bal) FROM balance\", as: Int64)"}},{"id":"graph(id)-instance-method","html_id":"graph(id)-instance-method","name":"graph","doc":null,"summary":null,"abstract":false,"args":[{"name":"id","doc":null,"default_value":"","external_name":"id","restriction":""}],"args_string":"(id)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L79","def":{"name":"graph","args":[{"name":"id","doc":null,"default_value":"","external_name":"id","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query = \"SELECT time, to_bal, amount FROM ledger\\nWHERE to_id = ?\\nUNION\\nSELECT time, user_bal, amount FROM benefit\\nWHERE user_id = ?\\nORDER BY time\"\nid = id.to_s\ndatapoints = 0\nreader, writer = IO.pipe\n@db.query(query, args: [id, id]) do |rs|\n rs.each do\n datapoints = datapoints + 1\n time = rs.read(String)\n bal = rs.read(Int32)\n amount = rs.read(Int32)\n writer.puts(\"#{time},#{bal},#{amount}\")\n end\nend\nwriter.close\nif datapoints <= 1\n return Result::Graph::Error.new(\"Not enough datapoints!\")\nend\nrandom = UUID.random\nimage_filename = \"/tmp/stackcoin/graph_#{id}_#{random}.png\"\ntitle = \"#{id} - #{Time.utc}\"\nprocess = Process.new(\"gnuplot\", [\"-e\", \"imagefilename='#{image_filename}';customtitle='#{title}'\", \"./src/gnuplot/graph.plt\"], input: reader, output: Process::Redirect::Pipe, error: Process::Redirect::Pipe)\nstdout = process.output.gets_to_end\nstderr = process.error.gets_to_end\nif stderr != \"\"\n raise(stderr)\nend\nResult::Graph::Success.new(File.open(image_filename))\n"}},{"id":"leaderboard(limit=5)-instance-method","html_id":"leaderboard(limit=5)-instance-method","name":"leaderboard","doc":null,"summary":null,"abstract":false,"args":[{"name":"limit","doc":null,"default_value":"5","external_name":"limit","restriction":""}],"args_string":"(limit = 5)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L73","def":{"name":"leaderboard","args":[{"name":"limit","doc":null,"default_value":"5","external_name":"limit","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.handle_balance_result_set(\"SELECT user_id, bal FROM balance ORDER BY bal DESC LIMIT ?\", [limit])"}},{"id":"ledger(dates,from_ids,to_ids,limit=5)-instance-method","html_id":"ledger(dates,from_ids,to_ids,limit=5)-instance-method","name":"ledger","doc":null,"summary":null,"abstract":false,"args":[{"name":"dates","doc":null,"default_value":"","external_name":"dates","restriction":""},{"name":"from_ids","doc":null,"default_value":"","external_name":"from_ids","restriction":""},{"name":"to_ids","doc":null,"default_value":"","external_name":"to_ids","restriction":""},{"name":"limit","doc":null,"default_value":"5","external_name":"limit","restriction":""}],"args_string":"(dates, from_ids, to_ids, limit = 5)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L158","def":{"name":"ledger","args":[{"name":"dates","doc":null,"default_value":"","external_name":"dates","restriction":""},{"name":"from_ids","doc":null,"default_value":"","external_name":"from_ids","restriction":""},{"name":"to_ids","doc":null,"default_value":"","external_name":"to_ids","restriction":""},{"name":"limit","doc":null,"default_value":"5","external_name":"limit","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Log.debug do\n \"Ledger arguments: #{dates}, #{from_ids}, #{to_ids}, #{limit}\"\nend\nargs = [] of DB::Any\nconditions = [] of String\nconditions << \"WHERE\"\noptional_conditions(dates, String, \"date(time) = date(?)\")\nif (from_ids.size != 0) || (to_ids.size != 0)\n condition = \"AND\"\n if (from_ids.size == 1) || (to_ids.size == 1)\n condition = \"OR\"\n end\n conditions << \"(\"\n optional_conditions(from_ids, UInt64, \"from_id = ?\", condition)\n optional_conditions(to_ids, UInt64, \"to_id = ?\", condition)\n conditions.pop\n conditions << \")\"\n conditions << \"AND\"\nend\nconditions.pop\nconditions_flat = \"\"\nconditions.each do |condition|\n conditions_flat = conditions_flat + \" #{condition} \"\nend\nledger_query = \"SELECT from_id, from_bal, to_id, to_bal, amount, time\\nFROM ledger #{conditions_flat} ORDER BY time DESC LIMIT ?\"\nargs << limit\nLog.debug do\n \"Ledger query: #{ledger_query} - #{args}\"\nend\nresults = [] of Result::Report::Transaction\n@db.query(ledger_query, args: args) do |rs|\n rs.each do\n results << (Result::Report::Transaction.new(*rs.read(String, Int32, String, Int32, Int32, String)))\n end\nend\nResult::Report.new(dates, from_ids, to_ids, results)\n"}},{"id":"richest-instance-method","html_id":"richest-instance-method","name":"richest","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L130","def":{"name":"richest","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"richest = self.leaderboard(1)\nif richest.size == 0\n return nil\nend\nrichest[0]\n"}}],"macros":[{"id":"optional_conditions(objs,type,condition,final="AND")-macro","html_id":"optional_conditions(objs,type,condition,final=&quot;AND&quot;)-macro","name":"optional_conditions","doc":null,"summary":null,"abstract":false,"args":[{"name":"objs","doc":null,"default_value":"","external_name":"objs","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":""},{"name":"condition","doc":null,"default_value":"","external_name":"condition","restriction":""},{"name":"final","doc":null,"default_value":"\"AND\"","external_name":"final","restriction":""}],"args_string":"(objs, type, condition, final = "AND")","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L142","def":{"name":"optional_conditions","args":[{"name":"objs","doc":null,"default_value":"","external_name":"objs","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":""},{"name":"condition","doc":null,"default_value":"","external_name":"condition","restriction":""},{"name":"final","doc":null,"default_value":"\"AND\"","external_name":"final","restriction":""}],"double_splat":null,"splat_index":null,"block_arg":null,"visibility":"Public","body":" if \n{{ objs }}\n.size != 0\n conditions << \"(\"\n \n{{ objs }}\n.each do |obj|\n if obj.is_a?(\n{{ type }}\n)\n conditions << \n{{ condition }}\n\n conditions << \"OR\"\n args << obj.to_s\n \nend\n \nend\n conditions.pop\n conditions << \")\"\n conditions << \n{{ final }}\n\n \nend\n \n"}}],"types":[{"html_id":"stackcoin/StackCoin/Statistics/Result","path":"StackCoin/Statistics/Result.html","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":4,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L4"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics","kind":"class","full_name":"StackCoin::Statistics","name":"Statistics"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Base","path":"StackCoin/Statistics/Result/Base.html","kind":"class","full_name":"StackCoin::Statistics::Result::Base","name":"Base","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":5,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L5"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Error","kind":"class","full_name":"StackCoin::Statistics::Result::Error","name":"Error"}],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(client,message,content)-class-method","html_id":"new(client,message,content)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"args_string":"(client, message, content)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L6","def":{"name":"new","args":[{"name":"client","doc":null,"default_value":"","external_name":"client","restriction":""},{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""},{"name":"content","doc":null,"default_value":"","external_name":"content","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(client, message, content)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Statistics/Result/Error","path":"StackCoin/Statistics/Result/Error.html","kind":"class","full_name":"StackCoin::Statistics::Result::Error","name":"Error","abstract":false,"superclass":{"html_id":"stackcoin/StackCoin/Statistics/Result/Base","kind":"class","full_name":"StackCoin::Statistics::Result::Base","name":"Base"},"ancestors":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Base","kind":"class","full_name":"StackCoin::Statistics::Result::Base","name":"Base"},{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":11,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L11"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph","path":"StackCoin/Statistics/Result/Graph.html","kind":"class","full_name":"StackCoin::Statistics::Result::Graph","name":"Graph","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":14,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L14"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph/Error","path":"StackCoin/Statistics/Result/Graph/Error.html","kind":"class","full_name":"StackCoin::Statistics::Result::Graph::Error","name":"Error","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":22,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L22"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph","kind":"class","full_name":"StackCoin::Statistics::Result::Graph","name":"Graph"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(message)-class-method","html_id":"new(message)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"args_string":"(message)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L25","def":{"name":"new","args":[{"name":"message","doc":null,"default_value":"","external_name":"message","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(message)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"message:String-instance-method","html_id":"message:String-instance-method","name":"message","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L23","def":{"name":"message","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@message"}}],"macros":[],"types":[]},{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph/Success","path":"StackCoin/Statistics/Result/Graph/Success.html","kind":"class","full_name":"StackCoin::Statistics::Result::Graph::Success","name":"Success","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":15,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L15"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result/Graph","kind":"class","full_name":"StackCoin::Statistics::Result::Graph","name":"Graph"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(file)-class-method","html_id":"new(file)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"file","doc":null,"default_value":"","external_name":"file","restriction":""}],"args_string":"(file)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L18","def":{"name":"new","args":[{"name":"file","doc":null,"default_value":"","external_name":"file","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(file)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"file:File-instance-method","html_id":"file:File-instance-method","name":"file","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : File","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L16","def":{"name":"file","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"File","visibility":"Public","body":"@file"}}],"macros":[],"types":[]}]},{"html_id":"stackcoin/StackCoin/Statistics/Result/Report","path":"StackCoin/Statistics/Result/Report.html","kind":"class","full_name":"StackCoin::Statistics::Result::Report","name":"Report","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":30,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L30"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result","kind":"class","full_name":"StackCoin::Statistics::Result","name":"Result"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(date,from_id,to_id,results)-class-method","html_id":"new(date,from_id,to_id,results)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"date","doc":null,"default_value":"","external_name":"date","restriction":""},{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":""},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":""},{"name":"results","doc":null,"default_value":"","external_name":"results","restriction":""}],"args_string":"(date, from_id, to_id, results)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L51","def":{"name":"new","args":[{"name":"date","doc":null,"default_value":"","external_name":"date","restriction":""},{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":""},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":""},{"name":"results","doc":null,"default_value":"","external_name":"results","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(date, from_id, to_id, results)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"date:Array(String)-instance-method","html_id":"date:Array(String)-instance-method","name":"date","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(String)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L46","def":{"name":"date","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(String)","visibility":"Public","body":"@date"}},{"id":"from_id:Array(UInt64)-instance-method","html_id":"from_id:Array(UInt64)-instance-method","name":"from_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L47","def":{"name":"from_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(UInt64)","visibility":"Public","body":"@from_id"}},{"id":"results:Array(Transaction)-instance-method","html_id":"results:Array(Transaction)-instance-method","name":"results","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(Transaction)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L49","def":{"name":"results","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(Transaction)","visibility":"Public","body":"@results"}},{"id":"to_id:Array(UInt64)-instance-method","html_id":"to_id:Array(UInt64)-instance-method","name":"to_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Array(UInt64)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L48","def":{"name":"to_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Array(UInt64)","visibility":"Public","body":"@to_id"}}],"macros":[],"types":[{"html_id":"stackcoin/StackCoin/Statistics/Result/Report/Transaction","path":"StackCoin/Statistics/Result/Report/Transaction.html","kind":"class","full_name":"StackCoin::Statistics::Result::Report::Transaction","name":"Transaction","abstract":false,"superclass":{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"stackcoin/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"stackcoin/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/stackcoin/statistics.cr","line_number":31,"url":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L31"}],"repository_name":"stackcoin","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"stackcoin/StackCoin/Statistics/Result/Report","kind":"class","full_name":"StackCoin::Statistics::Result::Report","name":"Report"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(from_id,from_bal,to_id,to_bal,amount,time)-class-method","html_id":"new(from_id,from_bal,to_id,to_bal,amount,time)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":""},{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":""},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":""},{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":""},{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":""},{"name":"time","doc":null,"default_value":"","external_name":"time","restriction":""}],"args_string":"(from_id, from_bal, to_id, to_bal, amount, time)","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L39","def":{"name":"new","args":[{"name":"from_id","doc":null,"default_value":"","external_name":"from_id","restriction":""},{"name":"from_bal","doc":null,"default_value":"","external_name":"from_bal","restriction":""},{"name":"to_id","doc":null,"default_value":"","external_name":"to_id","restriction":""},{"name":"to_bal","doc":null,"default_value":"","external_name":"to_bal","restriction":""},{"name":"amount","doc":null,"default_value":"","external_name":"amount","restriction":""},{"name":"time","doc":null,"default_value":"","external_name":"time","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(from_id, from_bal, to_id, to_bal, amount, time)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"amount:Int32-instance-method","html_id":"amount:Int32-instance-method","name":"amount","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L36","def":{"name":"amount","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@amount"}},{"id":"from_bal:Int32-instance-method","html_id":"from_bal:Int32-instance-method","name":"from_bal","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L33","def":{"name":"from_bal","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@from_bal"}},{"id":"from_id:UInt64-instance-method","html_id":"from_id:UInt64-instance-method","name":"from_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L32","def":{"name":"from_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@from_id"}},{"id":"time:Time-instance-method","html_id":"time:Time-instance-method","name":"time","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Time","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L37","def":{"name":"time","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Time","visibility":"Public","body":"@time"}},{"id":"to_bal:Int32-instance-method","html_id":"to_bal:Int32-instance-method","name":"to_bal","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int32","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L35","def":{"name":"to_bal","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":"@to_bal"}},{"id":"to_id:UInt64-instance-method","html_id":"to_id:UInt64-instance-method","name":"to_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : UInt64","source_link":"https://github.com/jackharrhy/StackCoin/blob/aa1af14b894382571a4f2e590bc951c901b01d0b/src/stackcoin/statistics.cr#L34","def":{"name":"to_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"UInt64","visibility":"Public","body":"@to_id"}}],"macros":[],"types":[]}]}]}]}]}]}}) \ No newline at end of file