All Projects → sue445 → google_holiday_calendar

sue445 / google_holiday_calendar

Licence: MIT license
Get holidays via Google Calendar.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to google holiday calendar

Localer
Automatic detecting missing I18n translations tool.
Stars: ✭ 219 (+942.86%)
Mutual labels:  gem
graphql authorize
Authorization helpers for ruby-graphql fields
Stars: ✭ 23 (+9.52%)
Mutual labels:  gem
extra extra
Manage in-app release notes for your Rails application using Markdown
Stars: ✭ 21 (+0%)
Mutual labels:  gem
Unimidi
Realtime MIDI IO for Ruby
Stars: ✭ 229 (+990.48%)
Mutual labels:  gem
open dota api
Ruby client for Dota 2 from OpenDotaAPI
Stars: ✭ 19 (-9.52%)
Mutual labels:  gem
omniauth-multi-provider-saml
An extension to omniauth-saml for handling multiple identity providers
Stars: ✭ 14 (-33.33%)
Mutual labels:  gem
Jekyll Toc
Jekyll plugin which generates a table of contents.
Stars: ✭ 211 (+904.76%)
Mutual labels:  gem
vrt-ruby
Ruby library for interacting with Bugcrowd's VRT
Stars: ✭ 15 (-28.57%)
Mutual labels:  gem
memo wise
The wise choice for Ruby memoization
Stars: ✭ 486 (+2214.29%)
Mutual labels:  gem
lightly
Ruby file cache for performing heavy tasks, lightly.
Stars: ✭ 37 (+76.19%)
Mutual labels:  gem
Victor
Ruby SVG Image Builder
Stars: ✭ 237 (+1028.57%)
Mutual labels:  gem
Forest Rails
🌱 Rails Liana for Forest Admin
Stars: ✭ 247 (+1076.19%)
Mutual labels:  gem
ibandit
Convert national banking details into IBANs, and vice-versa.
Stars: ✭ 90 (+328.57%)
Mutual labels:  gem
Localeapp
Send and retrieve your ruby i18n localizations to the Locale translation service
Stars: ✭ 225 (+971.43%)
Mutual labels:  gem
slackify
Build Slackbot on Rails using Slack Event API
Stars: ✭ 20 (-4.76%)
Mutual labels:  gem
Bootsnap
Boot large Ruby/Rails apps faster
Stars: ✭ 2,480 (+11709.52%)
Mutual labels:  gem
Notion-GCal-Sync
A Python script to automate the syncing of tasks between Google Calendar and the all-in-one productivity workspace, Notion. It utilizes API and is customizable for your own needs. Free to use.
Stars: ✭ 120 (+471.43%)
Mutual labels:  google-calendar
public-holidays-js
Public holidays by country. Readonly from google calendar. Nodejs module.
Stars: ✭ 18 (-14.29%)
Mutual labels:  google-calendar
magister-calendar
📅 Automatically plan your Magister appointments in your Google calendar.
Stars: ✭ 12 (-42.86%)
Mutual labels:  google-calendar
schked
Framework agnostic scheduler to run recurring jobs.
Stars: ✭ 78 (+271.43%)
Mutual labels:  gem

GoogleHolidayCalendar

Gem Version Build Status Coverage Status Code Climate

Get holidays via Google Calendar.

Requirements

  • ruby 2.0.0+

Installation

Add this line to your application's Gemfile:

gem 'google_holiday_calendar'

And then execute:

$ bundle

Or install it yourself as:

$ gem install google_holiday_calendar

Getting API key

1. Create GCP project

https://console.cloud.google.com/projectcreate

create-project

2. Go to credentials

dashboard

3. Create credential with API key

create-credential

4. Enable restrictions (Optional)

Click RESTRICT KEY

api-key-created

e.g. "IP addresses" in Application restrictions

application-restrictions

5. Enable calendar API

Go to Library

dashboard-library

Search with "Calendar" and enable "Google Calendar API".

search-apis

enable-google-calendar-api

Usage (via ruby)

require "google_holiday_calendar"

usa_calendar = GoogleHolidayCalendar::Calendar.new(country: "usa", lang: "en", api_key: "YOUR_API_KEY")

usa_calendar.holidays(start_date: "2014-01-01", end_date: "2014-03-01", limit: 5)
# => {Wed, 01 Jan 2014=>"New Year's Day", Mon, 20 Jan 2014=>"Martin Luther King Day", Fri, 14 Feb 2014=>"Valentine's Day", Mon, 17 Feb 2014=>"Presidents' Day (Washington's Birthday)"}

japan_calendar = GoogleHolidayCalendar::Calendar.new(country: "japanese", lang: "ja", api_key: "YOUR_API_KEY")

japan_calendar.holidays(start_date: "2014-01-01", end_date: "2014-03-01", limit: 5)
# => {Wed, 01 Jan 2014=>"元日", Thu, 02 Jan 2014=>"銀行休業日", Fri, 03 Jan 2014=>"銀行休業日", Mon, 13 Jan 2014=>"成人の日", Tue, 11 Feb 2014=>"建国記念の日"}

japan_calendar.holiday?("2014-01-01")
# => true

japan_calendar.holiday?("2014-02-01")
# => false

Usage (via bash)

# get holidays (today - 1 month after)
$ date +"%Y-%m-%d"
2014-02-24

$ GOOGLE_API_KEY=xxxx google_holiday_calendar
2014-03-09: Daylight Saving Time starts
# get holidays (2014/01/01 - 2014/07/01)
$ GOOGLE_API_KEY=xxxx google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01
2014-01-01: New Year's Day
2014-01-20: Martin Luther King Day
2014-02-14: Valentine's Day
2014-02-17: Presidents' Day (Washington's Birthday)
2014-03-09: Daylight Saving Time starts
2014-04-13: Thomas Jefferson's Birthday
2014-04-20: Easter Sunday
2014-05-11: Mothers' Day
2014-05-26: Memorial Day
2014-06-15: Fathers' Day
# get holidays (with limit)
$ GOOGLE_API_KEY=xxxx google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01 --limit=3
2014-02-14: Valentine's Day
2014-02-17: Presidents' Day (Washington's Birthday)
2014-04-13: Thomas Jefferson's Birthday
# get holidays (specify country and language)
$ GOOGLE_API_KEY=xxxx google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01 --country=japanese --lang=ja
2014-01-01: 元日
2014-01-02: 銀行休業日
2014-01-03: 銀行休業日
2014-01-13: 成人の日
2014-02-11: 建国記念の日
2014-03-21: 春分の日
2014-04-29: 昭和の日
2014-05-03: 憲法記念日
2014-05-04: みどりの日
2014-05-06: みどりの日 振替休日

More reference

https://sue445.github.io/google_holiday_calendar/

Contributing

  1. Fork it ( http://github.com/sue445/google_holiday_calendar/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].