Permalink
Browse files

Add support for 1.8.7

  • Loading branch information...
1 parent d71ac70 commit 3885842483dbb72cdf78dc1418f44b069763b8ad @drewtempelmeyer committed Jan 20, 2012
Showing with 10 additions and 1 deletion.
  1. +8 −0 .travis.yml
  2. +2 −1 lib/textcaptcha.rb
View
@@ -0,0 +1,8 @@
+language: ruby
+script: bundle exec rake test
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - 1.9.3
+ - jruby
+
View
@@ -21,7 +21,8 @@ def configure
# Textcaptcha.obtain # => { :question => "What's eight - 7?", :answers => [ "c4ca4238a0b923820dcc509a6f75849b", "f97c5d29941bfb1b2fdab0874906ab82" ] }
def obtain
api_response = HTTParty.get(URL << self.configuration.api_key)
- { :question => api_response['captcha']['question'], :answers => Array.new(api_response['captcha']['answer']) }
+ answers = api_response['captcha']['answer'].is_a?(String) ? [ api_response['captcha']['answer'] ] : api_response['captcha']['answer']
+ { :question => api_response['captcha']['question'], :answers => answers }
end
alias :get :obtain

0 comments on commit 3885842

Please sign in to comment.