holidays_from_google_calendar 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e141f7e77b5d28a0f6286c5ce57a9e3140459d8e
4
- data.tar.gz: c49f47556e87dc460485d09689637dbbb3cc0413
3
+ metadata.gz: a59e69c462038c25af1aa0b4823cf9016b52b14e
4
+ data.tar.gz: dcd9fd8b0cfd5fa346183eb7870538df0bf3c188
5
5
  SHA512:
6
- metadata.gz: 18ca26424001c47596268618ab2816980f76ab07a8d4d89f86806eda50453a0df748a1567e62f63d07f5b88969f9bef9a11b762c65381a39d00e1c79f620ace9
7
- data.tar.gz: a2769dc98cf24f2f85072e06a5e88f7e5eef5f802c39414ec671d3d51822c8fb250c3b065d7b1a7d716e07e72455686b95bf60a15a0d62cd26c95bad4bac4dd0
6
+ metadata.gz: 5b7419bbaae8268b58db9fa448089c0e9283f6c3cdc689e546d372cecb0f81301a9b7f8975fbd90d5a3a2deab8a7de8fa4a5d0536d0de88eb7a669c73d2e16bd
7
+ data.tar.gz: 130fab39c62241f14dbb9f6678e11ea85c00425f50bcae587334bbb209a51576171276fdabf855406079f43252e200f1305f538c2785c6f5875128f6574760ed
data/.rubocop.yml CHANGED
@@ -29,6 +29,10 @@ ClassAndModuleChildren:
29
29
  Style/SingleLineBlockParams:
30
30
  Enabled: false
31
31
 
32
+ # Allow using `{...}` for anytime
33
+ Style/BlockDelimiters:
34
+ Enabled: false
35
+
32
36
  # Prefer Kernel#sprintf
33
37
  FormatString:
34
38
  EnforcedStyle: sprintf
data/.travis.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.3
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2
4
6
  before_install: gem install bundler -v 1.10.6
data/README.md CHANGED
@@ -1,11 +1,7 @@
1
- # HolidaysFromGoogleCalendar
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/holidays_from_google_calendar`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
1
+ # HolidaysFromGoogleCalendar [![Build Status](https://travis-ci.org/necojackarc/holidays_from_google_calendar.svg?branch=master)](https://travis-ci.org/necojackarc/holidays_from_google_calendar) [![Code Climate](https://codeclimate.com/github/necojackarc/holidays_from_google_calendar/badges/gpa.svg)](https://codeclimate.com/github/necojackarc/holidays_from_google_calendar) [![Test Coverage](https://codeclimate.com/github/necojackarc/holidays_from_google_calendar/badges/coverage.svg)](https://codeclimate.com/github/necojackarc/holidays_from_google_calendar/coverage)
2
+ Under construction.
6
3
 
7
4
  ## Installation
8
-
9
5
  Add this line to your application's Gemfile:
10
6
 
11
7
  ```ruby
@@ -14,28 +10,85 @@ gem 'holidays_from_google_calendar'
14
10
 
15
11
  And then execute:
16
12
 
17
- $ bundle
13
+ ```bash
14
+ $ bundle
15
+ ```
18
16
 
19
17
  Or install it yourself as:
20
18
 
21
- $ gem install holidays_from_google_calendar
19
+ ```bash
20
+ $ gem install holidays_from_google_calendar
21
+ ```
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
26
25
 
27
- ## Development
26
+ ### Sample code
27
+ ```ruby
28
+ require "holidays_from_google_calendar"
29
+
30
+ usa_holidays = HolidaysFromGoogleCalendar::Holidays.new do |config|
31
+ config.calendar = {
32
+ nation: "usa",
33
+ language: "en"
34
+ }
35
+
36
+ config.credential = {
37
+ api_key: "YOUR OWN GOOGLE API KEY"
38
+ }
39
+ end
40
+
41
+ usa_holidays.in_year(Date.parse("2016-02-06")) # Retrieve 2016's holidays
42
+ => [#<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42df748 @date=Fri, 01 Jan 2016, @name="New Year's Day">,
43
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42def28 @date=Mon, 18 Jan 2016, @name="Martin Luther King Day">,
44
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42de820 @date=Sun, 14 Feb 2016, @name="Valentine's Day">,
45
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42de0f0 @date=Mon, 15 Feb 2016, @name="Presidents' Day">,
46
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42dd808 @date=Sun, 13 Mar 2016, @name="Daylight Saving Time starts">,
47
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42dc8e0 @date=Sun, 27 Mar 2016, @name="Easter Sunday">,
48
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab3b40 @date=Wed, 13 Apr 2016, @name="Thomas Jefferson's Birthday">,
49
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab36b8 @date=Sun, 08 May 2016, @name="Mother's Day">,
50
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab3230 @date=Mon, 30 May 2016, @name="Memorial Day">,
51
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab2d08 @date=Sun, 19 Jun 2016, @name="Father's Day">,
52
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab26a0 @date=Mon, 04 Jul 2016, @name="Independence Day">,
53
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab21a0 @date=Mon, 05 Sep 2016, @name="Labor Day">,
54
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab1cc8 @date=Mon, 10 Oct 2016, @name="Columbus Day (regional holiday)">,
55
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab1610 @date=Mon, 31 Oct 2016, @name="Halloween">,
56
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab0f30 @date=Sun, 06 Nov 2016, @name="Daylight Saving Time ends">,
57
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab0a58 @date=Tue, 08 Nov 2016, @name="Election Day">,
58
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab0648 @date=Fri, 11 Nov 2016, @name="Veterans Day">,
59
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d4ab0238 @date=Thu, 24 Nov 2016, @name="Thanksgiving Day">,
60
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42d7f20 @date=Sat, 24 Dec 2016, @name="Christmas Eve">,
61
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42d7a70 @date=Sun, 25 Dec 2016, @name="Christmas Day">,
62
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42d7660 @date=Mon, 26 Dec 2016, @name="Christmas Day observed">,
63
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42d70e8 @date=Sat, 31 Dec 2016, @name="New Year's Eve">,
64
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42d62b0 @date=Sun, 01 Jan 2017, @name="New Year's Day">]
65
+
66
+ usa_holidays.in_month(Date.parse("3rd March 2016")) # Retrieve holidays of March, 2016
67
+ => [#<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42dd808 @date=Sun, 13 Mar 2016, @name="Daylight Saving Time starts">,
68
+ #<HolidaysFromGoogleCalendar::Holiday:0x007ff7d42dc8e0 @date=Sun, 27 Mar 2016, @name="Easter Sunday">]
69
+
70
+ usa_holidays.holiday?(Date.parse("Oct 31 2016")) # Halloween
71
+ => true
72
+
73
+ usa_holidays.holiday?(Date.parse("April 16th 2016")) # Satruday
74
+ => true
75
+
76
+ usa_holidays.holiday?(Date.parse("April 17th 2016")) # Sunday
77
+ => true
78
+
79
+ usa_holidays.holiday?(Date.parse("Aug 2 2016")) # Weekday (Tuesday)
80
+ => false
81
+ ```
28
82
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
83
+ ## Development
84
+ Need to set the following environment variable to run rspec.
30
85
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
86
+ ```bash
87
+ GOOGLE_API_KEY="YOUR OWN GOOGLE API KEY"
88
+ ```
32
89
 
33
90
  ## Contributing
34
-
35
91
  Bug 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.
36
92
 
37
-
38
93
  ## License
39
-
40
94
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -25,4 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "bundler", "~> 1.10"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "rspec-its"
29
+ spec.add_development_dependency "simplecov"
30
+ spec.add_development_dependency "codeclimate-test-reporter"
28
31
  end
@@ -7,7 +7,7 @@ module HolidaysFromGoogleCalendar
7
7
  def initialize
8
8
  @calendar = {
9
9
  nation: "japanese",
10
- language: "ja"
10
+ language: "en"
11
11
  }
12
12
 
13
13
  @cache = {
@@ -1,3 +1,3 @@
1
1
  module HolidaysFromGoogleCalendar
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: holidays_from_google_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - necojackarc
@@ -80,6 +80,48 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-its
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: codeclimate-test-reporter
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
83
125
  description: Retriving national holidays from Google Calendar.
84
126
  email:
85
127
  - necojackarc@gmail.com