Module: Yinxiangma::Valid

Defined in:
lib/yinxiangma/valid.rb

Instance Method Summary collapse

Instance Method Details

#yinxiangma_validObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/yinxiangma/valid.rb', line 4

def yinxiangma_valid
  valid_uri = "http://www.yinxiangma.com/api/yzm.valid.php"
  http = Net::HTTP
  answer, error = http.post_form(URI.parse(valid_uri), {
    "s" => "cb9d0fe8dabdea89019d845be3059973",
    "t" => params[:YinXiangMa_challenge],
    "i" => params[:YinXiangMa_response]
    }).body.split('+')

  if(answer == 'true')
    return true
  elsif(answer == 'false')
    return false
  end
end