Module: Deployman::Net::Get

Defined in:
lib/deployman/net/get.rb

Class Method Summary collapse

Class Method Details

.send(url) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/deployman/net/get.rb', line 5

def self.send (url)

  # create http object
  uri = URI.parse(url)
  http = Net::HTTP.new(uri.host, uri.port)

  # create request object
  request = Net::HTTP::Get.new(uri.request_uri)

  # do request and get response
  response = http.request(request)

  # parse JSON to array
  resp_data = JSON.parse(response.body)

end