Sha256: bd8aab74ad76f5935730eade2eccff5b51ee32658de32510fbb6aa4e9bd236f7

Contents?: true

Size: 475 Bytes

Versions: 10

Compression:

Stored size: 475 Bytes

Contents

# frozen_string_literal: true

require "core"

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

      def call endpoint
        http.get("#{settings.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

10 entries across 10 versions & 1 rubygems

Version Path
pennyworth-17.8.0 lib/pennyworth/loaders/gem.rb
pennyworth-17.7.0 lib/pennyworth/loaders/gem.rb
pennyworth-17.6.0 lib/pennyworth/loaders/gem.rb
pennyworth-17.5.0 lib/pennyworth/loaders/gem.rb
pennyworth-17.4.1 lib/pennyworth/loaders/gem.rb
pennyworth-17.4.0 lib/pennyworth/loaders/gem.rb
pennyworth-17.3.0 lib/pennyworth/loaders/gem.rb
pennyworth-17.2.0 lib/pennyworth/loaders/gem.rb
pennyworth-17.1.0 lib/pennyworth/loaders/gem.rb
pennyworth-17.0.0 lib/pennyworth/loaders/gem.rb