Sha256: 86bea15b50fe3ac1dd1e947e1fc3a3d519ca9d3343dca52b0a171e1f4a060e27
Contents?: true
Size: 559 Bytes
Versions: 10
Compression:
Stored size: 559 Bytes
Contents
# frozen_string_literal: true require "core" module Pennyworth module Loaders # Loads an array gems from the Standard Gems API. class StandardGem include Import[:settings, :http] def call endpoint http.get("#{settings.standard_gems_api_url}/#{endpoint}") .then do |response| response.status.success? ? records(response.body.to_s) : Core::EMPTY_HASH end end private def records(body) = JSON(body, symbolize_names: true).fetch :gems, Core::EMPTY_ARRAY end end end
Version data entries
10 entries across 10 versions & 1 rubygems