Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

when query created_at, actual query 'created at'

  • Loading branch information...
commit 017659dd2938111b587b972da369abe0f568a940 1 parent 2c02de7
vkill authored
4 CHANGELOG
View
@@ -1,3 +1,7 @@
+== 0.1.2.2
+
+* modify, when query "created_at", actual query "created at"
+
== 0.1.2
* modify bin display
6 lib/youdao_fanyi/connector.rb
View
@@ -27,10 +27,8 @@ def initialize
def request(word, *options)
options = options.extract_options!
- @q = word.to_s
- @response = self.class.get('', :query => {:q => word}.merge(:key => @key, :keyfrom => @keyfrom))
-# require "pry"
-# binding.pry
+ @q = word.to_s.gsub("_"," ")
+ @response = self.class.get('', :query => {:q => @q}.merge(:key => @key, :keyfrom => @keyfrom))
@results = JSON.load(@response.body)
@error_code, @query = @results['errorCode'], @results['query']
@translation = @error_code == 0 ? @results['translation'].first : YoudaoFanyi::Errors.error_message(@error_code)
2  lib/youdao_fanyi/version.rb
View
@@ -1,6 +1,6 @@
#encoding: utf-8
module YoudaoFanyi
- VERSION = "0.1.2.1"
+ VERSION = "0.1.2.2"
end
2  spec/youdao_fanyi/connector_spec.rb
View
@@ -81,6 +81,8 @@ def translate(response, query, translation)
connector = YoudaoFanyi::Connector.new.request("中国")
# connector.q.should == "%E4%B8%AD%E5%9B%BD" #CGI::escape
connector.q.should == "中国"
+ connector = YoudaoFanyi::Connector.new.request(:created_at)
+ connector.q.should == "created at"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.