Sha256: 986bb892b4751f11f9884ebe725e40665b3d000c24a9e9199bdfcd69c4093983
Contents?: true
Size: 585 Bytes
Versions: 3
Compression:
Stored size: 585 Bytes
Contents
require 'faraday' module Snowreports class Fetcher BASE_PATH = "https://www.snowhq.com/" class << self attr_accessor :user, :pass end def self.fetch(path:) conn.get(path + "/xml") end def self.conn @conn ||= begin conn = Faraday.new(url: BASE_PATH) snow_user = user || ENV["SNOW_USER"] snow_pass = pass || ENV["SNOW_PASS"] raise "You must supply a username and password for API access" unless snow_user && snow_pass conn.basic_auth(snow_user, snow_pass) conn end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
snowreports-0.3.0 | lib/snowreports/fetcher.rb |
snowreports-0.2.0 | lib/snowreports/fetcher.rb |
snowreports-0.1.0 | lib/snowreports/fetcher.rb |