Class: Moneylovercli::Commands::Wallets
- Inherits:
-
Moneylovercli::Command
- Object
- Moneylovercli::Command
- Moneylovercli::Commands::Wallets
- Defined in:
- lib/moneylovercli/commands/wallets.rb
Instance Method Summary collapse
- #execute(_input: $stdin, output: $stdout) ⇒ Object
-
#initialize(options) ⇒ Wallets
constructor
A new instance of Wallets.
Methods inherited from Moneylovercli::Command
#command, #config, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(options) ⇒ Wallets
Returns a new instance of Wallets.
12 13 14 15 |
# File 'lib/moneylovercli/commands/wallets.rb', line 12 def initialize() super @options = end |
Instance Method Details
#execute(_input: $stdin, output: $stdout) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/moneylovercli/commands/wallets.rb', line 17 def execute(_input: $stdin, output: $stdout) config = YAML.load_file('config.yml') access_token = config['access_token'] wallets = Moneylovercli::Api::Wallet.new(token: access_token) .list .parsed_response output.puts TTY::Table.new( %w[ID Name], wallets['data'].map { |data| [data['_id'], data['name']] } ) end |