app/models/service_api_search.rb
# get data from api and map services if it has them
get data from api and map services if it has them
get data from api and map services if it has them
def create_service_objects
        services = get_services
        if services["collection"]["locations"] 
            services = services["collection"]["locations"]
        else
            services = nil
        end
        if services
            services_array = services.map { |service|  {name: service["display_name"], url: service["url"]} } 
        else
            services_array = nil
        end
        p services_array
    end
def create_service_objects services = get_services if services [ "collection" ] [ "locations" ] services = services [ "collection" ] [ "locations" ] else services = nil end if services services_array = services . map { | service | { name : service [ "display_name" ] , url : service [ "url" ] } } else services_array = nil end p services_array end
get data from api and map services if it has them
get data from api and map services if it has them
# if there are locations for the services set services otherwise set to nill # if there are services map the name and URL otherwise return nil