Module: TransparenciaAlagoas

Extended by:
TransparenciaAlagoas
Included in:
TransparenciaAlagoas
Defined in:
lib/http_client.rb,
lib/models/bidding.rb,
lib/models/servant.rb,
lib/models/patrimony.rb,
lib/transparencia_alagoas.rb,
lib/transparencia_alagoas/version.rb

Defined Under Namespace

Classes: Bidding, HttpClient, Patrimony, Servant

Constant Summary collapse

VERSION =
"0.1.1"

Instance Method Summary collapse

Instance Method Details

#dispatch_get_request(url, options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/transparencia_alagoas.rb', line 15

def dispatch_get_request(url, options)
	options.each do |key, value|
   	url += "&#{key}=#{value}"
   end

	http_client = TransparenciaAlagoas::HttpClient.new
   response = http_client.doGet(URI.escape(url), nil)

   begin  
   	{status_code: response.code, status_message: response.message, data: JSON.parse(response.body)}
 	rescue  
   	{status_code: 500, status_message: "Wrong Request, please check the url #{url}", data: []}
 	end  
end