Class: AnmsmRuby::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/anmsm_ruby.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



7
8
9
10
11
12
13
14
# File 'lib/anmsm_ruby.rb', line 7

def initialize
  # Resort feed
  @resort_svc = OData::Service.new "http://wcf.tourinsoft.com/Syndication/anmsm/817bee9d-faf4-4680-9d05-e41c2c90ae5a", {:namespace => "Anmsm::Resort"}
  # Weather feed
  @weather_svc = OData::Service.new "http://wcf.tourinsoft.com/Syndication/anmsm/fc13de9f-fa6c-45bf-9f25-1f023a3e6db5", {:namespace => "Anmsm::Weather"}
  # Snow feed
  @snow_svc = OData::Service.new "http://wcf.tourinsoft.com/Syndication/anmsm/ce4e4296-6132-4e11-b8db-ea21b92e736c", {:namespace => "Anmsm::Snow"}
end

Instance Attribute Details

#resort_svcObject

Returns the value of attribute resort_svc.



6
7
8
# File 'lib/anmsm_ruby.rb', line 6

def resort_svc
  @resort_svc
end

Instance Method Details

#all_resortsObject

returns general info for all resorts



17
18
19
20
# File 'lib/anmsm_ruby.rb', line 17

def all_resorts
  @resort_svc.Objects.order_by("NOMSTATION")
  @resort_svc.execute
end

#info_for_resort(resort_name) ⇒ Object

returns general info for the given resorts



23
24
25
26
# File 'lib/anmsm_ruby.rb', line 23

def info_for_resort(resort_name)
  @resort_svc.Objects.filter("NOMSTATION eq '#{resort_name}'")
  @resort_svc.execute
end

#snow_info_for_resort(resort) ⇒ Object

returns snow info for the given resort



29
30
31
32
33
# File 'lib/anmsm_ruby.rb', line 29

def snow_info_for_resort(resort)
  resort_id = resort.SyndicObjectID
  @snow_svc.Objects.filter("STATION eq '#{resort_id}'").order_by("Updated")
  @snow_svc.execute
end

#weather_for_resort(resort) ⇒ Object

returns weather info for the given resort



36
37
38
39
40
41
42
# File 'lib/anmsm_ruby.rb', line 36

def weather_for_resort(resort)
  resort_id = resort.SyndicObjectID
  @weather_svc.Objects.filter("STATION eq '#{resort_id}'").order_by("day(Updated)")
                                                          .order_by("month(Updated)")
                                                          .order_by("year(Updated)")
  @weather_svc.execute
end