Class: Zold::Invoice
- Inherits:
-
Object
- Object
- Zold::Invoice
- Defined in:
- lib/zold/commands/invoice.rb
Overview
Generate invoice
Instance Method Summary collapse
-
#initialize(wallets:, remotes:, copies:, log: Log::Quiet.new) ⇒ Invoice
constructor
A new instance of Invoice.
- #run(args = []) ⇒ Object
Constructor Details
#initialize(wallets:, remotes:, copies:, log: Log::Quiet.new) ⇒ Invoice
Returns a new instance of Invoice.
35 36 37 38 39 40 |
# File 'lib/zold/commands/invoice.rb', line 35 def initialize(wallets:, remotes:, copies:, log: Log::Quiet.new) @wallets = wallets @remotes = remotes @copies = copies @log = log end |
Instance Method Details
#run(args = []) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/zold/commands/invoice.rb', line 42 def run(args = []) opts = Slop.parse(args, help: true, suppress_errors: true) do |o| o. = "Usage: zold invoice ID [options] Where: 'ID' is the wallet ID of the money receiver Available options:" o.integer '--length', 'The length of the invoice prefix (default: 8)', default: 8 o.string '--network', 'The name of the network we work in', default: 'test' o.bool '--help', 'Print instructions' end mine = Args.new(opts, @log).take || return raise 'Receiver wallet ID is required' if mine[0].nil? id = Zold::Id.new(mine[0]) invoice(id, opts) end |