Class: Taxbear::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/taxbear/cli.rb

Instance Method Summary collapse

Instance Method Details

#loginObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/taxbear/cli.rb', line 6

def 
  valid_token = false
  while !valid_token
    token = ask("What is your TaxJar API token?")
    valid_token = Taxjar.validate_token(token)
    say_nope if !valid_token
  end
  Config.save_token(token)
  print_success "Success! You are now ready to access the TaxJar API."
end

#zip(zipcode) ⇒ Object



18
19
20
21
22
23
# File 'lib/taxbear/cli.rb', line 18

def zip(zipcode)
  rates = Taxjar.get_rates_by_zipcode(zipcode)
  TableBuilder.print_rates_for_zipcode(rates, zipcode)
rescue => e
  print_error(e.message)
end