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 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 def self.ical_feeds
gfeeds = { gfeeds = {
'Australian Holidays' => 'en.australian', 'Australian' => 'en.australian',
'Austrian Holidays' => 'de.austrian', 'Austrian' => 'de.austrian',
'Brazilian Holidays' => 'en.brazilian', 'Argentina' => 'en.ar',
'Canadian Holidays' => 'en.canadian', 'Bahamas' => 'en.bs',
'China Holidays' => 'en.china', 'Belarus' => 'en.by',
'Switzerland Holidays' => 'de.ch', 'Brazilian' => 'en.brazilian',
'Christian Holidays' => 'en.christian', 'Bulgaria' => 'en.bulgarian',
'Danish Holidays' => 'da.danish', 'Canadian' => 'en.canadian',
'Dutch Holidays' => 'nl.dutch', 'China' => 'en.china',
'Finnish Holidays' => 'en.finnish', 'Chile' => 'en.cl',
'French Holidays' => 'fe.french', 'Costa Rica' => 'en.cr',
'German Holidays' => 'de.german', 'Colombia' => 'en.co',
'Greek Holidays' => 'en.greek', 'Croatia' => 'en.croatian',
'Hong Kong Holidays' => 'en.hong_kong', 'Cuba' => 'en.cu',
'Indian Holidays' => 'en.indian', 'Cyprus' => 'de.cy',
'Indonesian Holidays' => 'en.indonesian', 'Switzerland' => 'de.ch',
'Iranian Holidays' => 'en.iranian', 'Christian' => 'en.christian',
'Irish Holidays' => 'en.irish', 'Danish' => 'da.danish',
'Islamic Holidays' => 'en.islamic', 'Dutch' => 'nl.dutch',
'Italian Holidays' => 'it.italian', 'Egypt' => 'en.eg',
'Japanese Holidays' => 'en.japanese', 'Ethiopia' => 'en.et',
'Jewish Holidays' => 'en.jewish', 'Ecuador' => 'en.ec',
'Malaysian Holidays' => 'en.malaysia', 'Estonia' => 'en.ee',
'Mexican Holidays' => 'en.mexican', 'Finnish' => 'en.finnish',
'New Zealand Holidays' => 'en.new_zealand', 'French' => 'en.french',
'Norwegian Holidays' => 'en.norwegian', 'German' => 'de.german',
'Philippines Holidays' => 'en.philippines', 'Greek' => 'en.greek',
'Polish Holidays' => 'en.polish', 'Ghana' => 'en.gh',
'Portuguese Holidays' => 'en.portuguese', 'Hong Kong' => 'en.hong_kong',
'Russian Holidays' => 'en.russian', 'Haiti' => 'en.ht',
'Singapore Holidays' => 'en.singapore', 'Hungary' => 'en.hungarian',
'South Africa Holidays' => 'en.sa', 'Indian' => 'en.indian',
'South Korean Holidays' => 'en.south_korea', 'Indonesian' => 'en.indonesian',
'Spain Holidays' => 'en.spain', 'Iranian' => 'en.ir',
'Swedish Holidays' => 'en.swedish', 'Irish' => 'en.irish',
'Taiwan Holidays' => 'en.taiwan', 'Islamic' => 'en.islamic',
'Thai Holidays' => 'en.thai', 'Italian' => 'it.italian',
'UK Holidays' => 'en.uk', 'Israel' => 'en.jewish',
'US Holidays' => 'en.usa', 'Japanese' => 'en.japanese',
'Vietnamese Holidays' => 'en.vietnamese', '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 = {} all_feeds = {}
gfeeds.each {|key, name| 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 all_feeds
end end

View file

@ -10,56 +10,67 @@ class GeoIpCalendar < ActiveSupport::TestCase
assert(result) assert(result)
assert_equal('My Calendar', result['name']) assert_equal('My Calendar', result['name'])
assert_equal('America/Los_Angeles', result['timezone']) assert_equal('America/Los_Angeles', result['timezone'])
assert_equal('', result['ical_url'])
result = Service::GeoCalendar.location( '127.0.0.1' ) result = Service::GeoCalendar.location( '127.0.0.1' )
assert(result) assert(result)
assert_equal('My Calendar', result['name']) assert_equal('My Calendar', result['name'])
assert_equal('America/Los_Angeles', result['timezone']) assert_equal('America/Los_Angeles', result['timezone'])
assert_equal('', result['ical_url'])
result = Service::GeoCalendar.location( '195.65.29.254' ) result = Service::GeoCalendar.location( '195.65.29.254' )
assert(result) assert(result)
assert_equal('Switzerland', result['name']) assert_equal('Switzerland', result['name'])
assert_equal('Europe/Zurich', result['timezone']) 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' ) result = Service::GeoCalendar.location( '195.191.132.18' )
assert(result) assert(result)
assert_equal('Switzerland', result['name']) assert_equal('Switzerland', result['name'])
assert_equal('Europe/Zurich', result['timezone']) 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' ) result = Service::GeoCalendar.location( '134.109.140.74' )
assert(result) assert(result)
assert_equal('Germany', result['name']) assert_equal('Germany', result['name'])
assert_equal('Europe/Berlin', result['timezone']) 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' ) result = Service::GeoCalendar.location( '46.253.55.170' )
assert(result) assert(result)
assert_equal('Germany', result['name']) assert_equal('Germany', result['name'])
assert_equal('Europe/Berlin', result['timezone']) 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' ) result = Service::GeoCalendar.location( '169.229.216.200' )
assert(result) assert(result)
assert_equal('United States/California', result['name']) assert_equal('United States/California', result['name'])
assert_equal('America/Los_Angeles', result['timezone']) 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' ) result = Service::GeoCalendar.location( '17.171.2.25' )
assert(result) assert(result)
assert_equal('United States/California', result['name']) assert_equal('United States/California', result['name'])
assert_equal('America/Los_Angeles', result['timezone']) 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' ) result = Service::GeoCalendar.location( '184.168.47.225' )
assert(result) assert(result)
assert_equal('United States/Arizona', result['name']) assert_equal('United States/Arizona', result['name'])
assert_equal('America/Phoenix', result['timezone']) 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' ) result = Service::GeoCalendar.location( '69.172.201.245' )
assert(result) assert(result)
assert_equal('United States/New York', result['name']) assert_equal('United States/New York', result['name'])
assert_equal('America/New_York', result['timezone']) 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' ) result = Service::GeoCalendar.location( '132.247.70.37' )
assert(result) assert(result)
assert_equal('Mexico/Sonora', result['name']) assert_equal('Mexico/Sonora', result['name'])
assert_equal('America/Hermosillo', result['timezone']) 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
end end