Module: TempoCli
- Defined in:
- lib/tempo_cli.rb
Constant Summary collapse
- CONFIG_FILE =
ENV['HOME']+'/.tempo'
Class Attribute Summary collapse
-
.password ⇒ Object
Returns the value of attribute password.
-
.username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Class Attribute Details
.password ⇒ Object
Returns the value of attribute password.
10 11 12 |
# File 'lib/tempo_cli.rb', line 10 def password @password end |
.username ⇒ Object
Returns the value of attribute username.
10 11 12 |
# File 'lib/tempo_cli.rb', line 10 def username @username end |
Class Method Details
.create_entry(command) ⇒ Object
12 13 14 15 16 |
# File 'lib/tempo_cli.rb', line 12 def create_entry(command) get_credentials! resource = RestClient::Resource.new 'https://app.keeptempo.com/entries', username, password resource.post({:command => command}.to_xml(:root => 'entry'), :content_type => 'application/xml', :accept => 'application/xml') end |
.get_credentials! ⇒ Object
18 19 20 21 22 |
# File 'lib/tempo_cli.rb', line 18 def get_credentials! abort "You must create a #{CONFIG_FILE} file to use this CLI." unless File.exist?(CONFIG_FILE) config = YAML.load(File.read(CONFIG_FILE)).symbolize_keys @username, @password = config[:username], config[:password] end |