Skip to content

Instantly share code, notes, and snippets.

# Step 1. Obtain token
curl -X POST \
-F "client_id=b6394b15282889398719c67983594d20" \
-F "client_secret=4aee41059af4d350a6ead3a285f0c438de146857d4134b6e63d5b1291971b12f" \
-F "grant_type=client_credentials" \
-F "scope=write_partner_users" \
'https://berlin.staging.wimdu.com/api/v3/oauth/token'
# Step 2. Create user.
# fill out <token> (obtained in Step.1)
class Foo
include CliSpinnable
def call
with_spinner do |cli|
#...
end
end
end
CliSpinnable.with_spinner do |cli|
cli.print('Text') #=> / Text
cli.tick #=> ✓ Text
cli.fail #=> × Text
1 / 0 #=> × Text # exceptions raised within the block also triggers printing fail mark
end
require 'cli_spinnable'
module Cli
extend CliSpinnable
end
puts 'HAPPY RUN (should succeed):'
Cli.with_spinner do |cli|
cli.print 'Downloading something'
sleep 1