Module: YelloAPI

Included in:
YST
Defined in:
lib/yst/yello_api.rb

Constant Summary collapse

TOKEN_FILE =
File.join(ENV['HOME'], '/.yello_security_token')

Instance Method Summary collapse

Instance Method Details

#my_votesObject



23
24
25
26
# 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) ⇒ Object



6
7
8
9
10
11
# 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) ⇒ Object



13
14
15
16
17
18
19
20
21
# 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