module YelloAPI
Constants
- TOKEN_FILE
Public Instance Methods
my_votes()
click to toggle source
# File lib/yst/yello_api.rb, line 23 def my_votes response = HTTParty.get("#{base_uri}/votes?token=#{parse_token}") response.body end
submit_registration(email)
click to toggle source
# File lib/yst/yello_api.rb, line 6 def submit_registration(email) response = HTTParty.post("#{base_uri}/users", { body: { email: email } }) response.body end
submit_vote(answer)
click to toggle source
# File lib/yst/yello_api.rb, line 13 def submit_vote(answer) response = HTTParty.post("#{base_uri}/votes", { body: { token: parse_token, answer: answer } }) response.body end
Private Instance Methods
base_uri()
click to toggle source
# File lib/yst/yello_api.rb, line 35 def base_uri 'https://yst.yellosec.co'.freeze end
parse_token()
click to toggle source
# File lib/yst/yello_api.rb, line 30 def parse_token raise 'You must first register your email via --register' unless File.exists?(TOKEN_FILE) File.read(TOKEN_FILE).split(':').last.chomp end