Module: YunTongXun::Helper

Included in:
Sms, Voice
Defined in:
lib/yuntongxun_api/helper.rb

Instance Method Summary collapse

Instance Method Details

#get_response(params) ⇒ Object

获得响应结果



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/yuntongxun_api/helper.rb', line 11

def get_response(params)
  uri = URI.parse(url)
  https = Net::HTTP.new(uri.host, uri.port)
  https.use_ssl = true
  request = Net::HTTP::Post.new(url, headers)
  request.body = params.to_json
  response = https.request(request)

  YunTongXun.logger.info response.body
  return JSON.parse(response.body)
end