Extended ical feed list.

This commit is contained in:
Martin Edenhofer 2015-09-22 22:29:37 +02:00
parent 904e407e96
commit 8a2dd87861
2 changed files with 88 additions and 42 deletions

View file

@ -61,7 +61,7 @@ returnes preset of ical feeds
returns
{
'US Holidays' => 'http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics',
'US' => 'http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics',
...
}
@ -69,50 +69,85 @@ returns
def self.ical_feeds
gfeeds = {
'Australian Holidays' => 'en.australian',
'Austrian Holidays' => 'de.austrian',
'Brazilian Holidays' => 'en.brazilian',
'Canadian Holidays' => 'en.canadian',
'China Holidays' => 'en.china',
'Switzerland Holidays' => 'de.ch',
'Christian Holidays' => 'en.christian',
'Danish Holidays' => 'da.danish',
'Dutch Holidays' => 'nl.dutch',
'Finnish Holidays' => 'en.finnish',
'French Holidays' => 'fe.french',
'German Holidays' => 'de.german',
'Greek Holidays' => 'en.greek',
'Hong Kong Holidays' => 'en.hong_kong',
'Indian Holidays' => 'en.indian',
'Indonesian Holidays' => 'en.indonesian',
'Iranian Holidays' => 'en.iranian',
'Irish Holidays' => 'en.irish',
'Islamic Holidays' => 'en.islamic',
'Italian Holidays' => 'it.italian',
'Japanese Holidays' => 'en.japanese',
'Jewish Holidays' => 'en.jewish',
'Malaysian Holidays' => 'en.malaysia',
'Mexican Holidays' => 'en.mexican',
'New Zealand Holidays' => 'en.new_zealand',
'Norwegian Holidays' => 'en.norwegian',
'Philippines Holidays' => 'en.philippines',
'Polish Holidays' => 'en.polish',
'Portuguese Holidays' => 'en.portuguese',
'Russian Holidays' => 'en.russian',
'Singapore Holidays' => 'en.singapore',
'South Africa Holidays' => 'en.sa',
'South Korean Holidays' => 'en.south_korea',
'Spain Holidays' => 'en.spain',
'Swedish Holidays' => 'en.swedish',
'Taiwan Holidays' => 'en.taiwan',
'Thai Holidays' => 'en.thai',
'UK Holidays' => 'en.uk',
'US Holidays' => 'en.usa',
'Vietnamese Holidays' => 'en.vietnamese',
'Australian' => 'en.australian',
'Austrian' => 'de.austrian',
'Argentina' => 'en.ar',
'Bahamas' => 'en.bs',
'Belarus' => 'en.by',
'Brazilian' => 'en.brazilian',
'Bulgaria' => 'en.bulgarian',
'Canadian' => 'en.canadian',
'China' => 'en.china',
'Chile' => 'en.cl',
'Costa Rica' => 'en.cr',
'Colombia' => 'en.co',
'Croatia' => 'en.croatian',
'Cuba' => 'en.cu',
'Cyprus' => 'de.cy',
'Switzerland' => 'de.ch',
'Christian' => 'en.christian',
'Danish' => 'da.danish',
'Dutch' => 'nl.dutch',
'Egypt' => 'en.eg',
'Ethiopia' => 'en.et',
'Ecuador' => 'en.ec',
'Estonia' => 'en.ee',
'Finnish' => 'en.finnish',
'French' => 'en.french',
'German' => 'de.german',
'Greek' => 'en.greek',
'Ghana' => 'en.gh',
'Hong Kong' => 'en.hong_kong',
'Haiti' => 'en.ht',
'Hungary' => 'en.hungarian',
'Indian' => 'en.indian',
'Indonesian' => 'en.indonesian',
'Iranian' => 'en.ir',
'Irish' => 'en.irish',
'Islamic' => 'en.islamic',
'Italian' => 'it.italian',
'Israel' => 'en.jewish',
'Japanese' => 'en.japanese',
'Jewish' => 'en.jewish',
'Kuwait' => 'en.kw',
'Latvia' => 'en.latvian',
'Liechtenstein' => 'en.li',
'Lithuania' => 'en.lithuanian',
'Luxembourg' => 'en.lu',
'Malaysian' => 'en.malaysia',
'Mexican' => 'en.mexican',
'Morocco' => 'en.ma',
'Mauritius' => 'en.mu',
'Moldova' => 'en.md',
'New Zealand' => 'en.new_zealand',
'Norwegian' => 'en.norwegian',
'Philippines' => 'en.philippines',
'Polish' => 'en.polish',
'Portuguese' => 'en.portuguese',
'Pakistan' => 'en.pk',
'Russian' => 'en.russian',
'Senegal' => 'en.sn',
'Singapore' => 'en.singapore',
'South Africa' => 'en.sa',
'South Korean' => 'en.south_korea',
'Spain' => 'en.spain',
'Slovakia' => 'en.slovak',
'Serbia' => 'en.rs',
'Slovenia' => 'en.slovenian',
'Swedish' => 'en.swedish',
'Taiwan' => 'en.taiwan',
'Thai' => 'en.th',
'Turkey' => 'en.turkish',
'UK' => 'en.uk',
'US' => 'en.usa',
'Ukraine' => 'en.ukrainian',
'Uruguay' => 'en.uy',
'Vietnamese' => 'en.vietnamese',
'Venezuela' => 'en.ve',
}
all_feeds = {}
gfeeds.each {|key, name|
all_feeds["http://www.google.com/calendar/ical/#{name}%23holiday%40group.v.calendar.google.com/public/basic.ics"] = key
all_feeds["http://www.google.com/calendar/ical/#{name}%23holiday%40group.v.calendar.google.com/public/basic.ics"] = "#{key} - Holidays"
}
all_feeds
end

View file

@ -10,56 +10,67 @@ class GeoIpCalendar < ActiveSupport::TestCase
assert(result)
assert_equal('My Calendar', result['name'])
assert_equal('America/Los_Angeles', result['timezone'])
assert_equal('', result['ical_url'])
result = Service::GeoCalendar.location( '127.0.0.1' )
assert(result)
assert_equal('My Calendar', result['name'])
assert_equal('America/Los_Angeles', result['timezone'])
assert_equal('', result['ical_url'])
result = Service::GeoCalendar.location( '195.65.29.254' )
assert(result)
assert_equal('Switzerland', result['name'])
assert_equal('Europe/Zurich', result['timezone'])
assert_equal('http://www.google.com/calendar/ical/de.ch%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
result = Service::GeoCalendar.location( '195.191.132.18' )
assert(result)
assert_equal('Switzerland', result['name'])
assert_equal('Europe/Zurich', result['timezone'])
assert_equal('http://www.google.com/calendar/ical/de.ch%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
result = Service::GeoCalendar.location( '134.109.140.74' )
assert(result)
assert_equal('Germany', result['name'])
assert_equal('Europe/Berlin', result['timezone'])
assert_equal('http://www.google.com/calendar/ical/de.german%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
result = Service::GeoCalendar.location( '46.253.55.170' )
assert(result)
assert_equal('Germany', result['name'])
assert_equal('Europe/Berlin', result['timezone'])
assert_equal('http://www.google.com/calendar/ical/de.german%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
result = Service::GeoCalendar.location( '169.229.216.200' )
assert(result)
assert_equal('United States/California', result['name'])
assert_equal('America/Los_Angeles', result['timezone'])
assert_equal('http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
result = Service::GeoCalendar.location( '17.171.2.25' )
assert(result)
assert_equal('United States/California', result['name'])
assert_equal('America/Los_Angeles', result['timezone'])
assert_equal('http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
result = Service::GeoCalendar.location( '184.168.47.225' )
assert(result)
assert_equal('United States/Arizona', result['name'])
assert_equal('America/Phoenix', result['timezone'])
assert_equal('http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
result = Service::GeoCalendar.location( '69.172.201.245' )
assert(result)
assert_equal('United States/New York', result['name'])
assert_equal('America/New_York', result['timezone'])
assert_equal('http://www.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
result = Service::GeoCalendar.location( '132.247.70.37' )
assert(result)
assert_equal('Mexico/Sonora', result['name'])
assert_equal('America/Hermosillo', result['timezone'])
assert_equal('http://www.google.com/calendar/ical/en.mexican%23holiday%40group.v.calendar.google.com/public/basic.ics', result['ical_url'])
end
end