Class: YST
Constant Summary
collapse
- TOKEN_FILE =
File.join(ENV['HOME'], '/.yello_security_token')
Instance Method Summary
collapse
Methods included from YelloAPI
#my_votes, #submit_registration, #submit_vote
Instance Method Details
#register(email) ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/yst.rb', line 7
def register(email)
email = sanitize_email(email)
return puts "Invalid Yello Email: #{email}" unless valid_email?(email)
token = submit_registration(email)
`echo '#{email}:#{token}' > #{TOKEN_FILE}`
puts "Successfully registered! Access token has been saved for future requests. (token: #{token})"
end
|
#vote(answer) ⇒ Object
17
18
19
20
21
|
# File 'lib/yst.rb', line 17
def vote(answer)
return puts "Invalid answer (must be single letter): #{answer}" unless answer.length == 1
puts submit_vote(answer.downcase)
end
|
#votes ⇒ Object
23
24
25
|
# File 'lib/yst.rb', line 23
def votes
puts my_votes
end
|