Protected Areas API

Creates a API to query by wdpa_id (to feed third party projects on protected-planet-consumer)

The query can be done using:

http://localhost:3000/api/protected_areas?wdpa_id=[wdpa_id]

You can check the code on

controllers/api/protected_areas.rb
models/protected_areas.rb
test/integration/api_test.rb

Well, I have tried to put everything in the controller like this:

ProtectedArea.
                        without_geometry.
                        select("*").
                        where('wdpa_id = ?', 1).
                        joins(:legal_status, :iucn_category, :countries).
                        joins("LEFT JOIN governances g ON governance_id = g.id \
                          LEFT JOIN regions r ON region_id = r.id \
                          LEFT JOIN designations d ON designation_id = d.id \
                          LEFT JOIN jurisdictions j ON jurisdiction_id = j.id")
                        .first

This seems a bit complex (we need left joins in some cases) and it doesn't handle columns with the same names in different tables. In this case I would go for plain SQL but not sure if this is the best way to handle this data.