Sha256: 44a8ac54879ee72bd12379c6e0a3f7df762ee172868abd0dd48e1d41730cf3fb

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

require_relative "snowreports/version"
require_relative "snowreports/builder"
require_relative "snowreports/endpoint"
require_relative "snowreports/fetcher"

module Snowreports
  def self.fetch(ski_field)
    endpoint = Endpoint.all.fetch(ski_field)
    response = Fetcher.fetch(path: endpoint.path)
    Builder.build(xml: response.body, field_id: endpoint.id)
  end

  def self.all
    Endpoint.all.each_with_object([]) do |(_field_name, endpoint), acc|
      response = Fetcher.fetch(path: endpoint.path)
      acc << Builder.build(xml: response.body, field_id: endpoint.id)
      acc
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
snowreports-0.3.0 lib/snowreports.rb
snowreports-0.2.0 lib/snowreports.rb
snowreports-0.1.0 lib/snowreports.rb