require 'faraday' require 'json' require 'byebug' class DSADataSource < ::Nanoc::DataSource identifier :dsa_api def items verenigingen = JSON.parse Faraday.get('https://dsa.ugent.be/api/verenigingen').body puts verenigingen["associations"].map do |vereniging| # byebug puts "Loading #{vereniging["abbreviation"]} from dsa api" new_item( '', vereniging, "/verenigingen/#{vereniging["abbreviation"]}" ) new_item( Faraday.get(vereniging["logo"]).body, vereniging, "/images/#{vereniging["abbreviation"]}" ) end verenigingen["associations"].map do |vereniging| # byebug puts "Loading #{vereniging["abbreviation"]} from dsa api" new_item( Faraday.get(vereniging["logo"]).body, vereniging, "/images/#{vereniging["abbreviation"]}.jpg" ) end end end