Module: BrasilfoneAPI::HttpAPIHandler

Defined in:
lib/brasilfone_api/http_api_handler.rb,
lib/brasilfone_api/http_api_handler/service_uri.rb,
lib/brasilfone_api/http_api_handler/uri_constants.rb

Defined Under Namespace

Modules: ServiceURI, URIConstants

Class Method Summary collapse

Class Method Details

.send_request_for_service(service, parameters = {}) ⇒ Object



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

def send_request_for_service(service, parameters = {})
  uri = BrasilfoneAPI::HttpAPIHandler::ServiceURI.uri_for_service(
    service,
    parameters
  )

  request = Net::HTTP::Get.new(uri)
  response = Net::HTTP.start(uri.host, uri.port) do |http|
    http.request(request)
  end
  XmlHasher.parse(response.body)
end