Module: OnTheSnow::Helper

Included in:
API
Defined in:
lib/onthesnow/helper.rb

Instance Method Summary collapse

Instance Method Details

#build_profile_url_from_snow_resort_url(url) ⇒ Object



28
29
30
# File 'lib/onthesnow/helper.rb', line 28

def build_profile_url_from_snow_resort_url(url)
  url.split("/")[0..-2].join("/").concat("/profile.html")
end

#profile(url) ⇒ Object



24
25
26
# File 'lib/onthesnow/helper.rb', line 24

def profile(url)
  Nokogiri::HTML(open(url))
end

#remove_chars(element) ⇒ Object



32
33
34
# File 'lib/onthesnow/helper.rb', line 32

def remove_chars(element)
  element.gsub(/Ski Report.*$/,"").strip
end

#rss(url) ⇒ Object



20
21
22
# File 'lib/onthesnow/helper.rb', line 20

def rss(url)
  SimpleRSS.parse(open(url))
end

#rss_url(state) ⇒ Object



16
17
18
# File 'lib/onthesnow/helper.rb', line 16

def rss_url(state)
  "#{url}/#{state}/snow.rss"
end

#site_map_rss_urlObject



8
9
10
# File 'lib/onthesnow/helper.rb', line 8

def site_map_rss_url
  @site_map_rss_url ||= ::OnTheSnow.config.site_map_rss_url
end

#sitemapObject



12
13
14
# File 'lib/onthesnow/helper.rb', line 12

def sitemap
  @sitemap ||= Nokogiri::HTML(open(site_map_rss_url))
end

#urlObject



4
5
6
# File 'lib/onthesnow/helper.rb', line 4

def url
  @url ||= ::OnTheSnow.config.url
end