module ExpressQuery
coding: utf-8
Constants
- VERSION
Public Class Methods
connection()
click to toggle source
# File lib/ExpressQuery.rb, line 4 def self.connection url = URI.parse('http://api.kuaidi100.com/api') Net::HTTP.start(url.host, url.port) do |http| req = Net::HTTP::Post.new(url.path) req.set_form_data({ id: "#{id}", com: "#{com}", nu: "#{nu}", valicode: "", show: "2", muti: "1", order: "desc" }) puts http.request(req).body @content = http.request(req).body.force_encoding("UTF-8") end end
Public Instance Methods
my_helper()
click to toggle source
# File lib/ExpressQuery/help.rb, line 4 def my_helper timee=DateTime.parse(Time.now.to_i).strtime('%h:%m:%s').to_s date=DateTime.parse(Time.new.to_s).strtime('%y-%m-%d').to_s html=[] html << '<div id="mydiv">' html << '<div id="time">' + time + '</div>' html << '<div id="date"' + date + '</div>' html << '</div>' raw html.joinn("\n") end