{"id":23533359,"url":"https://github.com/necojackarc/holidays_from_google_calendar","last_synced_at":"2025-10-15T04:48:55.581Z","repository":{"id":48104798,"uuid":"51192881","full_name":"necojackarc/holidays_from_google_calendar","owner":"necojackarc","description":"Retriving national holidays from Google Calendar.","archived":false,"fork":false,"pushed_at":"2022-09-27T11:51:48.000Z","size":38,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T17:45:09.995Z","etag":null,"topics":["google-calendar","holidays","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/holidays_from_google_calendar","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/necojackarc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-06T06:48:02.000Z","updated_at":"2024-12-28T03:07:12.000Z","dependencies_parsed_at":"2022-08-12T18:40:45.762Z","dependency_job_id":null,"html_url":"https://github.com/necojackarc/holidays_from_google_calendar","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necojackarc%2Fholidays_from_google_calendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necojackarc%2Fholidays_from_google_calendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necojackarc%2Fholidays_from_google_calendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necojackarc%2Fholidays_from_google_calendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/necojackarc","download_url":"https://codeload.github.com/necojackarc/holidays_from_google_calendar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337308,"owners_count":21414093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-calendar","holidays","ruby"],"created_at":"2024-12-25T23:14:56.156Z","updated_at":"2025-10-15T04:48:55.516Z","avatar_url":"https://github.com/necojackarc.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HolidaysFromGoogleCalendar \n\n[![CI](https://github.com/necojackarc/holidays_from_google_calendar/actions/workflows/ci.yml/badge.svg)](https://github.com/necojackarc/holidays_from_google_calendar/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/necojackarc/holidays_from_google_calendar/badge.svg?branch=master)](https://coveralls.io/github/necojackarc/holidays_from_google_calendar?branch=master)\n[![Code Climate](https://codeclimate.com/github/necojackarc/holidays_from_google_calendar/badges/gpa.svg)](https://codeclimate.com/github/necojackarc/holidays_from_google_calendar)\n\nHolidaysFromGoogleCalendar can retrieve national holidays from Google Calendar with very simple interface.\n\nThe results is going to be cached and you can preload holidays with your favorite range at initialization if you want.\nThese features help you to reduce access times to Google Calendar API.\n\nI am sure that you only need to access the API a very few times if you preload holidays with proper range.\n\nUsing Google Calendar, available nations are same as Google Calendar.\n\nNote that you can only retrieve holidays which Google Calendar has.\nGoogle Calendar appears not to have all holidays, so you cannot retrieve very old ones and far future's.\n\n## Features\n### Main\n* List holidays of a particular nation in a particular year\n* List holidays of a particular nation in a particular month\n* Check a date whether it is a holiday or not in a particular nation\n\n### Others\n* Cacheing results using LRU algorithm\n* Preload holidays at initialization\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'holidays_from_google_calendar'\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n\n```bash\n$ gem install holidays_from_google_calendar\n```\n\n## Usage\n### Configuration\nAll parameters you can pass are below:\n\n```ruby\nusa_holidays = HolidaysFromGoogleCalendar::Holidays.new do |config|\n  config.credential = {\n    api_key: \"YOUR OWN GOOGLE API KEY\"\n  }\n\n  config.calendar = {\n    nation: \"usa\",\n    language: \"en\"\n  }\n\n  config.cache = {\n    enable: true,\n    max_size: 1000 # DEFAULT_CACHE_SIZE is 1000\n  }\n\n  config.preload = {\n    enable: true, # Require cache enabled\n    date_range: 1.year # Retrive holidays from \"this day last year\" to \"this day next year\"\n  }\nend\n```\n\nDefault parameters of `cache` and `preload` are same as above.\n\n### List holidays of a particular nation in a particular year\nReturns a array of holidays in a particular year.\n\n```ruby\nusa_holidays.in_year(Date.current)\n```\n\n### List holidays of a particular nation in a particular month\nReturns a array of holidays in a particular month.\n\n```ruby\nusa_holidays.in_month(Date.current)\n```\n\n### Check a date whether it is a holiday or not in a particular nation\nReturns `true` when the day is holiday, Saturday or Sunday.\n\n```ruby\nusa_holidays.holiday?(Date.current)\n```\n\n### Sample code\n```ruby\nrequire \"holidays_from_google_calendar\"\n\nusa_holidays = HolidaysFromGoogleCalendar::Holidays.new do |config|\n  config.calendar = {\n    nation: \"usa\",\n    language: \"en\"\n  }\n\n  config.credential = {\n    api_key: \"YOUR OWN GOOGLE API KEY\"\n  }\nend\n\nusa_holidays.in_year(Date.parse(\"2016-02-06\")) # Retrieve 2016's holidays\n=\u003e [#\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42df748 @date=Fri, 01 Jan 2016, @name=\"New Year's Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42def28 @date=Mon, 18 Jan 2016, @name=\"Martin Luther King Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42de820 @date=Sun, 14 Feb 2016, @name=\"Valentine's Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42de0f0 @date=Mon, 15 Feb 2016, @name=\"Presidents' Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42dd808 @date=Sun, 13 Mar 2016, @name=\"Daylight Saving Time starts\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42dc8e0 @date=Sun, 27 Mar 2016, @name=\"Easter Sunday\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab3b40 @date=Wed, 13 Apr 2016, @name=\"Thomas Jefferson's Birthday\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab36b8 @date=Sun, 08 May 2016, @name=\"Mother's Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab3230 @date=Mon, 30 May 2016, @name=\"Memorial Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab2d08 @date=Sun, 19 Jun 2016, @name=\"Father's Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab26a0 @date=Mon, 04 Jul 2016, @name=\"Independence Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab21a0 @date=Mon, 05 Sep 2016, @name=\"Labor Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab1cc8 @date=Mon, 10 Oct 2016, @name=\"Columbus Day (regional holiday)\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab1610 @date=Mon, 31 Oct 2016, @name=\"Halloween\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab0f30 @date=Sun, 06 Nov 2016, @name=\"Daylight Saving Time ends\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab0a58 @date=Tue, 08 Nov 2016, @name=\"Election Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab0648 @date=Fri, 11 Nov 2016, @name=\"Veterans Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab0238 @date=Thu, 24 Nov 2016, @name=\"Thanksgiving Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42d7f20 @date=Sat, 24 Dec 2016, @name=\"Christmas Eve\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42d7a70 @date=Sun, 25 Dec 2016, @name=\"Christmas Day\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42d7660 @date=Mon, 26 Dec 2016, @name=\"Christmas Day observed\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42d70e8 @date=Sat, 31 Dec 2016, @name=\"New Year's Eve\"\u003e,\n\nusa_holidays.in_month(Date.parse(\"3rd March 2016\")) # Retrieve holidays of March, 2016\n=\u003e [#\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42dd808 @date=Sun, 13 Mar 2016, @name=\"Daylight Saving Time starts\"\u003e,\n #\u003cHolidaysFromGoogleCalendar::Holiday:0x007ff7d42dc8e0 @date=Sun, 27 Mar 2016, @name=\"Easter Sunday\"\u003e]\n\nusa_holidays.holiday?(Date.parse(\"Oct 31 2016\")) # Halloween\n=\u003e true\n\nusa_holidays.holiday?(Date.parse(\"April 16th 2016\")) # Saturday\n=\u003e true\n\nusa_holidays.holiday?(Date.parse(\"April 17th 2016\")) # Sunday\n=\u003e true\n\nusa_holidays.holiday?(Date.parse(\"Aug 2 2016\")) # Weekday (Tuesday)\n=\u003e false\n```\n\n## Development\nNeed to set the following environment variable to run rspec:\n\n```bash\nGOOGLE_API_KEY=\"YOUR OWN GOOGLE API KEY\"\n```\n\n## Contributing\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/holidays_from_google_calendar. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.\n\n## License\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnecojackarc%2Fholidays_from_google_calendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnecojackarc%2Fholidays_from_google_calendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnecojackarc%2Fholidays_from_google_calendar/lists"}