Sha256: 70dc64de7f6b9b61316de9da37eb70097a1bd94ec882c69a15c7453a9f9c3866

Contents?: true

Size: 485 Bytes

Versions: 7

Compression:

Stored size: 485 Bytes

Contents

# frozen_string_literal: true

require "core"

module Pennyworth
  module Loaders
    # Loads an array gems from the RubyGems API.
    class Gem
      include Import[:configuration, :http]

      def call endpoint
        http.get("#{configuration.ruby_gems_api_url}/#{endpoint}")
            .then do |response|
              return JSON response.body.to_s, symbolize_names: true if response.status.success?

              Core::EMPTY_HASH
            end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pennyworth-16.7.0 lib/pennyworth/loaders/gem.rb
pennyworth-16.5.0 lib/pennyworth/loaders/gem.rb
pennyworth-16.4.0 lib/pennyworth/loaders/gem.rb
pennyworth-16.3.0 lib/pennyworth/loaders/gem.rb
pennyworth-16.2.0 lib/pennyworth/loaders/gem.rb
pennyworth-16.1.0 lib/pennyworth/loaders/gem.rb
pennyworth-16.0.0 lib/pennyworth/loaders/gem.rb