Module: Juhe::Express
- Includes:
- ExpressCompany
- Defined in:
- lib/juhe_ruby/express.rb
Constant Summary collapse
- BASE_URL =
"http://v.juhe.cn/exp/index"
Class Method Summary collapse
Methods included from ExpressCompany
Class Method Details
.search(company_name, number, options = nil) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/juhe_ruby/express.rb', line 40 def self.search(company_name, number, = nil) app_key = ([:app_key] if ) || Juhe.app_key url = BASE_URL \ + "?key=" \ + app_key \ + "&no=" + number \ + "&com=" + company_code_of(company_name, ) result = JSON.parse(open(url).read) raise result["reason"] if result["resultcode"] != "200" result["result"] end |