Module: Juhe::ExpressCompany::ClassMethods
- Defined in:
- lib/juhe_ruby/express.rb
Instance Method Summary collapse
Instance Method Details
#company_code_of(company_name, options = nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/juhe_ruby/express.rb', line 18 def company_code_of(company_name, = nil) refresh_companies() if @companies.nil? @companies.each do |company| return company["no"] if company["com"] == company_name end end |
#refresh_companies(options) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/juhe_ruby/express.rb', line 26 def refresh_companies() app_key = ([:app_key] if ) || Juhe.app_key result = JSON.parse(open(BASE_URL+"?key="+app_key).read) raise result["reason"] if result["resultcode"] != "200" @companies = result["result"] end |