Class: Fengqiao::Request
- Inherits:
-
Object
- Object
- Fengqiao::Request
- Defined in:
- lib/fengqiao/request.rb
Instance Method Summary collapse
- #do ⇒ Object
-
#initialize(req_xml) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(req_xml) ⇒ Request
Returns a new instance of Request.
8 9 10 |
# File 'lib/fengqiao/request.rb', line 8 def initialize(req_xml) @req_xml = req_xml end |
Instance Method Details
#do ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fengqiao/request.rb', line 12 def do str = @req_xml + Fengqiao.check_word verifyCode = Digest::MD5.base64digest(str) data = { xml: @req_xml, verifyCode: verifyCode } res = ::Faraday.new(url: SEND_GATEWAY).post do |req| req.headers['Content-Type'] = 'application/x-www-form-urlencoded' req.body = data end REXML::Document.new res.body end |