Sha256: d95712e2425d542979e54ba34eda8eb4699d52eb7d0e5a03b4b22891498719d6

Contents?: true

Size: 429 Bytes

Versions: 1

Compression:

Stored size: 429 Bytes

Contents

require 'net/http'

module Pears
  module Provider
    # Fetch a yaml file via HTTP
    class RemoteFile < Base
      def initialize(remote_url, on_failure: :raise)
        yaml_data = Net::HTTP.get(URI(remote_url))
        @data = parse_yaml(yaml_data)

      rescue SocketError, InvalidProviderData => e
        if on_failure == :null
          @data = {}
        else
          raise e
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pears-0.0.8 lib/pears/provider/remote_file.rb