Sha256: 9317cb3d2983309491ba4bc9616924f5b4436e7d4f59763ce37c0733325c477c

Contents?: true

Size: 625 Bytes

Versions: 6

Compression:

Stored size: 625 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(snowhq_id: endpoint.snowhq_id)
    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(snowhq_id: endpoint.snowhq_id)
      acc << Builder.build(xml: response.body, field_id: endpoint.id)
      acc
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snowreports-0.6.3 lib/snowreports.rb
snowreports-0.6.2 lib/snowreports.rb
snowreports-0.6.1 lib/snowreports.rb
snowreports-0.6.0 lib/snowreports.rb
snowreports-0.5.0 lib/snowreports.rb
snowreports-0.4.0 lib/snowreports.rb