NoMethodError: undefined method 'empty?' for #URI :: HTTPS: 0x000000063069d8

0

I'm doing a REST request but when I run I get this error:

NoMethodError: undefined method 'empty?' for #<URI::HTTPS:0x000000063069d8>

My code:

  require 'net/http'


require 'uri'


def mandareq

  url = URI("https://gateway.plusmms.net/rest/message?")

  http = Net::HTTP.new(url.host, url.port)

  request = Net::HTTP::Post.new(url)

  request.body = {to:[number],text:'teste',from:'Remetente'}


  response = http.request(request)
  puts response.read_body

end

Any solution?

    
asked by anonymous 15.01.2018 / 13:23

1 answer

0

I was able to solve, just add the following code:

  http.use_ssl = true

Below this line:

  http = Net::HTTP.new(url.host, url.port)
    
15.01.2018 / 14:00