google_holiday_calendar 0.0.1 → 0.1.2

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
- SHA1:
3
- metadata.gz: 2d7daf762af6f01eeb55d3776af29583fd092f3e
4
- data.tar.gz: 4dfe7151d30491d132f4ae187bd4fc19737cf167
2
+ SHA256:
3
+ metadata.gz: 533f91bc51a0c47f008a02ec3d621897e6405a92394e65c46b9d96fa7c750b66
4
+ data.tar.gz: a0806bbe8f27b01226cebbff992551991bf9e227c4f4916ac3a114641328542f
5
5
  SHA512:
6
- metadata.gz: 528765e8b03de7d4a44be7a4b3156bdc45c3af108e9578ddf6b8c0ebde8bcd54964f499a5dc82146468089c939ddf4e677f7904636fc1d7205bf2c972aa46fbf
7
- data.tar.gz: 776c6002ff00ac3b500c8d6421c5b75532b60bb909666d12556b6beb79f48e1df0f56eb6131a929d2afb732aca96ec1b811832b291da0790cd173a3c6bb33fba
6
+ metadata.gz: 8b52fcd6983253189a12aa198e2aacfedc85e4711c2697fb0190cb8caeb4cb8476c6d6a2f5ab2af9abc6cb18fde0d55a4901800a8210cbe7983dfd4718abd486
7
+ data.tar.gz: '05841d7af8d193e6445335f2aafc0597ae1f0b099719b03fc90aa2805d8554c8806de1e78c753c6e9d8885e9c16855e82618de180deccc06a869ae3fdb997e50'
@@ -0,0 +1,97 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+ - reopened
12
+ schedule:
13
+ - cron: "0 10 * * 5" # JST 19:00 (Fri)
14
+
15
+ env:
16
+ CI: "true"
17
+
18
+ jobs:
19
+ test:
20
+ runs-on: ubuntu-latest
21
+
22
+ container: ${{ matrix.ruby }}
23
+
24
+ strategy:
25
+ fail-fast: false
26
+
27
+ matrix:
28
+ ruby:
29
+ - ruby:2.0
30
+ - ruby:2.1
31
+ - ruby:2.2
32
+ - ruby:2.3
33
+ - ruby:2.4
34
+ - ruby:2.5
35
+ - ruby:2.6
36
+ - ruby:2.7
37
+ - ruby:3.0
38
+ - rubylang/ruby:master-nightly-bionic
39
+ include:
40
+ - ruby: rubylang/ruby:master-nightly-bionic
41
+ allow_failures: "true"
42
+
43
+ steps:
44
+ - uses: actions/checkout@v2
45
+
46
+
47
+ - name: Cache vendor/bundle
48
+ uses: actions/cache@v1
49
+ id: cache_gem
50
+ with:
51
+ path: vendor/bundle
52
+ key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
53
+ restore-keys: |
54
+ v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
55
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
56
+
57
+ - name: bundle update
58
+ run: |
59
+ set -xe
60
+ bundle config path vendor/bundle
61
+ bundle update --jobs $(nproc) --retry 3
62
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
63
+
64
+ - name: Run test
65
+ run: |
66
+ set -xe
67
+ bundle exec rspec
68
+ continue-on-error: ${{ matrix.allow_failures == 'true' }}
69
+
70
+ - name: Slack Notification (not success)
71
+ uses: lazy-actions/slatify@master
72
+ if: "! success()"
73
+ continue-on-error: true
74
+ with:
75
+ job_name: ${{ format('*build* ({0})', matrix.ruby) }}
76
+ type: ${{ job.status }}
77
+ icon_emoji: ":octocat:"
78
+ url: ${{ secrets.SLACK_WEBHOOK }}
79
+ token: ${{ secrets.GITHUB_TOKEN }}
80
+
81
+ notify:
82
+ needs:
83
+ - test
84
+
85
+ runs-on: ubuntu-latest
86
+
87
+ steps:
88
+ - name: Slack Notification (success)
89
+ uses: lazy-actions/slatify@master
90
+ if: always()
91
+ continue-on-error: true
92
+ with:
93
+ job_name: '*build*'
94
+ type: ${{ job.status }}
95
+ icon_emoji: ":octocat:"
96
+ url: ${{ secrets.SLACK_WEBHOOK }}
97
+ token: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .env
19
+
data/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ ## master
2
+ [full changelog](http://github.com/sue445/google_holiday_calendar/compare/v0.1.2...master)
3
+
4
+ ## v0.1.2
5
+ [full changelog](http://github.com/sue445/google_holiday_calendar/compare/v0.1.1...v0.1.2)
6
+
7
+ * Enable MFA requirement for gem releasing
8
+ * https://github.com/sue445/google_holiday_calendar/pull/37
9
+
10
+ ## v0.1.1
11
+ [full changelog](http://github.com/sue445/google_holiday_calendar/compare/v0.1.0...v0.1.1)
12
+
13
+ * Pass `GOOGLE_API_KEY` to `google_holiday_calendar`
14
+ * https://github.com/sue445/google_holiday_calendar/pull/20
15
+
16
+ ## v0.1.0
17
+ [full changelog](http://github.com/sue445/google_holiday_calendar/compare/v0.0.2...v0.1.0)
18
+
19
+ * Use Google Calendar API v3
20
+ * relax dependency gem version
21
+
22
+ ## v0.0.2
23
+ [full changelog](http://github.com/sue445/google_holiday_calendar/compare/v0.0.1...v0.0.2)
24
+
25
+ * bugfix: NoMethodError if not exists holidays
26
+ * Impl `GoogleHolidayCalendar::Calendar#holiday?`
27
+
28
+ ## v0.0.1
29
+ * first release
data/Gemfile CHANGED
@@ -2,3 +2,37 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in google_holiday_calendar.gemspec
4
4
  gemspec
5
+
6
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2")
7
+ gem "activesupport", "< 5.0.0"
8
+ end
9
+
10
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.1.0")
11
+ group :test do
12
+ gem "public_suffix", "< 3.0.0"
13
+ end
14
+
15
+ # NOTE: rexml v3.2.5+ requires Ruby 2.1.0+
16
+ # https://github.com/ruby/rexml/compare/v3.2.4...v3.2.5#diff-f8c7cdefc29090ed525a2be70411ce741d4124853cf6425db7d18a6ea3bb9bb3R515
17
+ gem "rexml", "< 3.2.5"
18
+ end
19
+
20
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.0")
21
+ # NOTE: rake v13.0.0+ requires Ruby 2.2.0+
22
+ gem "rake", "< 13.0.0"
23
+ end
24
+
25
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.0")
26
+ # NOTE: minitest v5.12.1+ requires Ruby 2.2.0+
27
+ gem "minitest", "< 5.12.1"
28
+ end
29
+
30
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.5.0")
31
+ # NOTE: docile 1.4.0+ requires Ruby 2.5.0+
32
+ gem "docile", "< 1.4.0"
33
+ end
34
+
35
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.3.0")
36
+ # NOTE: json v2.6.0+ requires Ruby 2.3.0+
37
+ gem "json", "< 2.6.0"
38
+ end
data/README.md CHANGED
@@ -1,4 +1,9 @@
1
- # GoogleHolidayCalendar [![Build Status](https://travis-ci.org/sue445/google_holiday_calendar.png?branch=master)](https://travis-ci.org/sue445/google_holiday_calendar) [![Coverage Status](https://coveralls.io/repos/sue445/google_holiday_calendar/badge.png)](https://coveralls.io/r/sue445/google_holiday_calendar) [![Dependency Status](https://gemnasium.com/sue445/google_holiday_calendar.png)](https://gemnasium.com/sue445/google_holiday_calendar) [![Code Climate](https://codeclimate.com/github/sue445/google_holiday_calendar.png)](https://codeclimate.com/github/sue445/google_holiday_calendar)
1
+ # GoogleHolidayCalendar
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/google_holiday_calendar.png)](http://badge.fury.io/rb/google_holiday_calendar)
4
+ [![Build Status](https://github.com/sue445/google_holiday_calendar/workflows/test/badge.svg?branch=master)](https://github.com/sue445/google_holiday_calendar/actions?query=workflow%3Atest)
5
+ [![Coverage Status](https://coveralls.io/repos/sue445/google_holiday_calendar/badge.png)](https://coveralls.io/r/sue445/google_holiday_calendar)
6
+ [![Code Climate](https://codeclimate.com/github/sue445/google_holiday_calendar.png)](https://codeclimate.com/github/sue445/google_holiday_calendar)
2
7
 
3
8
  Get holidays via Google Calendar.
4
9
 
@@ -19,20 +24,58 @@ Or install it yourself as:
19
24
 
20
25
  $ gem install google_holiday_calendar
21
26
 
27
+ ## Getting API key
28
+ ### 1. Create GCP project
29
+ https://console.cloud.google.com/projectcreate
30
+
31
+ ![create-project](img/create-project.png)
32
+
33
+ ### 2. Go to credentials
34
+ ![dashboard](img/dashboard.png)
35
+
36
+ ### 3. Create credential with API key
37
+ ![create-credential](img/create-credential.png)
38
+
39
+ ### 4. Enable restrictions (Optional)
40
+ Click RESTRICT KEY
41
+
42
+ ![api-key-created](img/api-key-created.png)
43
+
44
+ e.g. "IP addresses" in Application restrictions
45
+
46
+ ![application-restrictions](img/application-restrictions.png)
47
+
48
+ ### 5. Enable calendar API
49
+ Go to Library
50
+
51
+ ![dashboard-library](img/dashboard-library.png)
52
+
53
+ Search with "Calendar" and enable "Google Calendar API".
54
+
55
+ ![search-apis](img/search-apis.png)
56
+
57
+ ![enable-google-calendar-api](img/enable-google-calendar-api.png)
58
+
22
59
  ## Usage (via ruby)
23
60
 
24
61
  ```ruby
25
62
  require "google_holiday_calendar"
26
63
 
27
- usa_calendar = GoogleHolidayCalendar::Calendar.new(country: "usa", lang: "en")
64
+ usa_calendar = GoogleHolidayCalendar::Calendar.new(country: "usa", lang: "en", api_key: "YOUR_API_KEY")
28
65
 
29
- usa_calendar.holidays(start_date: "2014-01-01", end_date: "2014-03-01, limit: 5")
66
+ usa_calendar.holidays(start_date: "2014-01-01", end_date: "2014-03-01", limit: 5)
30
67
  # => {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)"}
31
68
 
32
- japan_calendar = GoogleHolidayCalendar::Calendar.new(country: "japanese", lang: "ja")
69
+ japan_calendar = GoogleHolidayCalendar::Calendar.new(country: "japanese", lang: "ja", api_key: "YOUR_API_KEY")
33
70
 
34
- japan_calendar.holidays(start_date: "2014-01-01", end_date: "2014-03-01, limit: 5")
71
+ japan_calendar.holidays(start_date: "2014-01-01", end_date: "2014-03-01", limit: 5)
35
72
  # => {Wed, 01 Jan 2014=>"元日", Thu, 02 Jan 2014=>"銀行休業日", Fri, 03 Jan 2014=>"銀行休業日", Mon, 13 Jan 2014=>"成人の日", Tue, 11 Feb 2014=>"建国記念の日"}
73
+
74
+ japan_calendar.holiday?("2014-01-01")
75
+ # => true
76
+
77
+ japan_calendar.holiday?("2014-02-01")
78
+ # => false
36
79
  ```
37
80
 
38
81
  ## Usage (via bash)
@@ -42,11 +85,13 @@ japan_calendar.holidays(start_date: "2014-01-01", end_date: "2014-03-01, limit:
42
85
  $ date +"%Y-%m-%d"
43
86
  2014-02-24
44
87
 
45
- $ google_holiday_calendar
88
+ $ GOOGLE_API_KEY=xxxx google_holiday_calendar
46
89
  2014-03-09: Daylight Saving Time starts
90
+ ```
47
91
 
92
+ ```sh
48
93
  # get holidays (2014/01/01 - 2014/07/01)
49
- $ google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01
94
+ $ GOOGLE_API_KEY=xxxx google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01
50
95
  2014-01-01: New Year's Day
51
96
  2014-01-20: Martin Luther King Day
52
97
  2014-02-14: Valentine's Day
@@ -57,16 +102,19 @@ $ google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01
57
102
  2014-05-11: Mothers' Day
58
103
  2014-05-26: Memorial Day
59
104
  2014-06-15: Fathers' Day
105
+ ```
60
106
 
107
+ ```sh
61
108
  # get holidays (with limit)
62
- $ google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01 --limit=3
63
- google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01 --limit=3
109
+ $ GOOGLE_API_KEY=xxxx google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01 --limit=3
64
110
  2014-02-14: Valentine's Day
65
111
  2014-02-17: Presidents' Day (Washington's Birthday)
66
112
  2014-04-13: Thomas Jefferson's Birthday
113
+ ```
67
114
 
115
+ ```sh
68
116
  # get holidays (specify country and language)
69
- $ google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01 --country=japanese --lang=ja
117
+ $ GOOGLE_API_KEY=xxxx google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01 --country=japanese --lang=ja
70
118
  2014-01-01: 元日
71
119
  2014-01-02: 銀行休業日
72
120
  2014-01-03: 銀行休業日
@@ -79,6 +127,9 @@ $ google_holiday_calendar --start-date=2014-01-01 --end-date=2014-07-01 --countr
79
127
  2014-05-06: みどりの日 振替休日
80
128
  ```
81
129
 
130
+ ## More reference
131
+ http://rubydoc.info/github/sue445/google_holiday_calendar
132
+
82
133
  ## Contributing
83
134
 
84
135
  1. Fork it ( http://github.com/sue445/google_holiday_calendar/fork )
@@ -4,11 +4,11 @@ require 'google_holiday_calendar'
4
4
  require 'optparse'
5
5
 
6
6
  options = {
7
- start_date: nil,
8
- end_date: nil,
9
- limit: 10,
10
- country: "usa",
11
- lang: "en",
7
+ start_date: nil,
8
+ end_date: nil,
9
+ limit: 10,
10
+ country: "usa",
11
+ lang: "en",
12
12
  }
13
13
 
14
14
  opt = OptionParser.new
@@ -20,12 +20,13 @@ opt.on('--lang[=LANG]' , 'default: en') {|v| options[:lang
20
20
  opt.parse!(ARGV)
21
21
 
22
22
  GoogleHolidayCalendar::Calendar.new(
23
- country: options[:country],
24
- lang: options[:lang],
23
+ country: options[:country],
24
+ lang: options[:lang],
25
+ api_key: ENV["GOOGLE_API_KEY"],
25
26
  ).holidays(
26
- start_date: options[:start_date],
27
- end_date: options[:end_date],
28
- limit: options[:limit],
27
+ start_date: options[:start_date],
28
+ end_date: options[:end_date],
29
+ limit: options[:limit],
29
30
  ).each do |date, title|
30
31
  puts "#{date}: #{title}"
31
32
  end
@@ -13,22 +13,31 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/sue445/google_holiday_calendar"
14
14
  spec.license = "MIT"
15
15
 
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = spec.homepage
18
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
19
+ spec.metadata["rubygems_mfa_required"] = "true"
20
+
16
21
  spec.required_ruby_version = '>= 2.0.0'
17
22
 
18
- spec.files = `git ls-files -z`.split("\x0")
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|img)/}) }
27
+ end
19
28
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
29
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
30
  spec.require_paths = ["lib"]
22
31
 
23
- spec.add_dependency "activesupport", "~> 4.0.0"
32
+ spec.add_dependency "activesupport", ">= 4.0.0"
24
33
 
25
- spec.add_development_dependency "bundler", "~> 1.5"
34
+ spec.add_development_dependency "bundler", ">= 1.5"
35
+ spec.add_development_dependency "coveralls"
36
+ spec.add_development_dependency "delorean"
26
37
  spec.add_development_dependency "rake"
27
- spec.add_development_dependency "rspec", "3.0.0.beta1"
28
- spec.add_development_dependency "rspec-its"
38
+ spec.add_development_dependency "rspec"
29
39
  spec.add_development_dependency "rspec-collection_matchers"
30
- spec.add_development_dependency "delorean"
40
+ spec.add_development_dependency "rspec-its"
41
+ spec.add_development_dependency "webmock"
31
42
  spec.add_development_dependency "yard"
32
- spec.add_development_dependency "memoist"
33
- spec.add_development_dependency "coveralls"
34
43
  end
@@ -1,14 +1,16 @@
1
1
  module GoogleHolidayCalendar
2
2
  require 'open-uri'
3
+ require 'cgi'
3
4
 
4
5
  class Calendar
5
6
  attr_reader :country, :lang
6
7
 
7
8
  # @param country [String]
8
9
  # @param lang [String]
9
- def initialize(country: "usa", lang: "en")
10
+ def initialize(country: "usa", lang: "en", api_key: nil)
10
11
  @country = country.downcase
11
12
  @lang = lang.downcase
13
+ @api_key = api_key
12
14
  end
13
15
 
14
16
  # get holidays via google calendar
@@ -16,24 +18,29 @@ module GoogleHolidayCalendar
16
18
  # @param end_date [String,Date] end date ("YYYY-MM-DD" or Date). not contain this date. default: 1 month after the start_date
17
19
  # @param limit [Integer]
18
20
  # @return [Hash] key: date, value: holiday title
21
+ # @return [{}] if found no holidays, return empty hash
19
22
  def holidays(start_date: nil, end_date: nil, limit: 10)
20
23
  start_date = Date.today unless start_date
21
24
  end_date = to_date(start_date) + 1.month unless end_date
22
25
 
23
- url = "http://www.google.com/calendar/feeds/#{@country}__#{@lang}@holiday.calendar.google.com/public/full?"
26
+ calendar_id = "#{@lang}.#{@country}#holiday@group.v.calendar.google.com"
27
+ url = "https://www.googleapis.com/calendar/v3/calendars/#{CGI.escape(calendar_id)}/events?"
24
28
  params = {
25
- "alt" => "json",
26
- "start-min" => to_ymd(start_date),
27
- "start-max" => to_ymd(end_date),
28
- "max-results" => limit,
29
+ "key" => @api_key,
30
+ "timeMin" => to_ymd(start_date),
31
+ "timeMax" => to_ymd(end_date),
32
+ "maxResults" => limit,
29
33
  }
30
34
  url += params.to_query
31
35
 
32
36
  calendar_response = fetch(url)
33
37
 
34
- holidays = calendar_response["feed"]["entry"].inject({}){ |res, entry|
35
- date = Date.parse(entry["gd$when"][0]["startTime"])
36
- title = entry["title"]["$t"]
38
+ entries = calendar_response["items"]
39
+ return {} unless entries
40
+
41
+ holidays = entries.inject({}){ |res, item|
42
+ date = Date.parse(item['start']['date'])
43
+ title = item["summary"]
37
44
  res[date] =title
38
45
  res
39
46
  }
@@ -41,6 +48,13 @@ module GoogleHolidayCalendar
41
48
  Hash[holidays.sort_by{|k,v| k }]
42
49
  end
43
50
 
51
+ # whether arg is holiday
52
+ # @param arg [#to_date, String] {Date}, {Time}, or date like String (ex. "YYYY-MM-DD")
53
+ def holiday?(arg)
54
+ date = to_date(arg)
55
+ holidays(start_date: date, end_date: date + 1.day, limit: 1).length > 0
56
+ end
57
+
44
58
  private
45
59
 
46
60
  # @param url [String]
@@ -54,7 +68,7 @@ module GoogleHolidayCalendar
54
68
  # @return [String] YYYY-MM-DD
55
69
  def to_ymd(arg)
56
70
  date = to_date(arg)
57
- date.strftime("%Y-%m-%d")
71
+ date.strftime("%Y-%m-%d") + "T00:00:00Z"
58
72
  end
59
73
 
60
74
  # @param arg [Date,String]
@@ -62,6 +76,8 @@ module GoogleHolidayCalendar
62
76
  def to_date(arg)
63
77
  if arg.is_a?(String)
64
78
  Date.parse(arg)
79
+ elsif arg.respond_to?(:to_date)
80
+ arg.to_date
65
81
  else
66
82
  arg
67
83
  end
@@ -1,3 +1,3 @@
1
1
  module GoogleHolidayCalendar
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require "google_holiday_calendar/version"
2
2
  require "google_holiday_calendar/calendar"
3
- require "active_support/core_ext"
3
+ require "active_support/all"
4
4
 
5
5
  module GoogleHolidayCalendar
6
6
  # Your code goes here...
metadata CHANGED
@@ -1,45 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_holiday_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-23 00:00:00.000000000 Z
11
+ date: 2021-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.5'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,21 +53,21 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: delorean
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.0.0.beta1
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 3.0.0.beta1
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec-its
70
+ name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec-collection_matchers
84
+ name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: delorean
98
+ name: rspec-collection_matchers
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: yard
112
+ name: rspec-its
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: memoist
126
+ name: webmock
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: coveralls
140
+ name: yard
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -159,10 +159,11 @@ extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
161
  - ".coveralls.yml"
162
+ - ".github/workflows/test.yml"
162
163
  - ".gitignore"
163
164
  - ".rspec"
164
- - ".travis.yml"
165
165
  - ".yardopts"
166
+ - CHANGELOG.md
166
167
  - Gemfile
167
168
  - LICENSE.txt
168
169
  - README.md
@@ -172,17 +173,15 @@ files:
172
173
  - lib/google_holiday_calendar.rb
173
174
  - lib/google_holiday_calendar/calendar.rb
174
175
  - lib/google_holiday_calendar/version.rb
175
- - spec/google_holiday_calendar/calendar_spec.rb
176
- - spec/google_holiday_calendar_spec.rb
177
- - spec/spec_helper.rb
178
- - spec/support/examples/holidays_in_japan_at_jan.rb
179
- - spec/support/examples/holidays_in_usa_at_jan.rb
180
- - spec/support/utils/util.rb
181
176
  homepage: https://github.com/sue445/google_holiday_calendar
182
177
  licenses:
183
178
  - MIT
184
- metadata: {}
185
- post_install_message:
179
+ metadata:
180
+ homepage_uri: https://github.com/sue445/google_holiday_calendar
181
+ source_code_uri: https://github.com/sue445/google_holiday_calendar
182
+ changelog_uri: https://github.com/sue445/google_holiday_calendar/blob/master/CHANGELOG.md
183
+ rubygems_mfa_required: 'true'
184
+ post_install_message:
186
185
  rdoc_options: []
187
186
  require_paths:
188
187
  - lib
@@ -197,16 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
196
  - !ruby/object:Gem::Version
198
197
  version: '0'
199
198
  requirements: []
200
- rubyforge_project:
201
- rubygems_version: 2.2.0
202
- signing_key:
199
+ rubygems_version: 3.2.22
200
+ signing_key:
203
201
  specification_version: 4
204
202
  summary: Get holidays via Google Calendar.
205
- test_files:
206
- - spec/google_holiday_calendar/calendar_spec.rb
207
- - spec/google_holiday_calendar_spec.rb
208
- - spec/spec_helper.rb
209
- - spec/support/examples/holidays_in_japan_at_jan.rb
210
- - spec/support/examples/holidays_in_usa_at_jan.rb
211
- - spec/support/utils/util.rb
212
- has_rdoc:
203
+ test_files: []
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 2.1.0
5
- before_install:
6
- - gem install bundler -v '= 1.5.2'
7
- branches:
8
- only:
9
- - master
10
- notifications:
11
- email: false
@@ -1,56 +0,0 @@
1
- describe GoogleHolidayCalendar::Calendar do
2
- describe "#holidays" do
3
- subject{ calendar.holidays(start_date: start_date, end_date: end_date, limit: limit) }
4
-
5
- let(:limit) { 10 }
6
- let(:start_date){ "2014-01-01" }
7
- let(:end_date) { "2014-01-31" }
8
-
9
- context "Without country and lang" do
10
- let(:calendar){ GoogleHolidayCalendar::Calendar.new }
11
-
12
- its(:count){ should > 0 }
13
- end
14
-
15
- context "With country and lang" do
16
- let(:calendar){ GoogleHolidayCalendar::Calendar.new(country: country, lang: lang) }
17
-
18
- context "When holidays in Japan" do
19
- let(:country) { "japanese" }
20
- let(:lang) { "ja" }
21
-
22
- context "When args are YYYY-MM-DD" do
23
- let(:start_date){ "2014-01-01" }
24
- let(:end_date) { "2014-01-31" }
25
-
26
- it_behaves_like :holidays_in_japan_at_jan
27
- end
28
-
29
- context "When args are instance" do
30
- let(:start_date){ date("2014-01-01") }
31
- let(:end_date) { date("2014-01-31") }
32
-
33
- it_behaves_like :holidays_in_japan_at_jan
34
- end
35
-
36
- context "Without start_date and end_date" do
37
- let(:start_date){ nil }
38
- let(:end_date) { nil }
39
-
40
- before do
41
- time_travel_to "2014-01-01"
42
- end
43
-
44
- it_behaves_like :holidays_in_japan_at_jan
45
- end
46
- end
47
-
48
- context "When holidays in America" do
49
- let(:country) { "usa" }
50
- let(:lang) { "en" }
51
-
52
- it_behaves_like :holidays_in_usa_at_jan
53
- end
54
- end
55
- end
56
- end
@@ -1,5 +0,0 @@
1
- describe GoogleHolidayCalendar do
2
- it 'should have a version number' do
3
- expect(GoogleHolidayCalendar::VERSION).not_to be_nil
4
- end
5
- end
data/spec/spec_helper.rb DELETED
@@ -1,30 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'google_holiday_calendar'
3
-
4
- require 'rspec'
5
- require 'rspec/its'
6
- require 'rspec/collection_matchers'
7
- require 'delorean'
8
- require 'memoist'
9
-
10
- require 'coveralls'
11
- Coveralls.wear!
12
-
13
- # Requires supporting ruby files with custom matchers and macros, etc,
14
- # in spec/support/ and its subdirectories.
15
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
16
-
17
- RSpec.configure do |config|
18
- config.include Delorean
19
-
20
- config.after(:each) do
21
- back_to_the_present
22
- end
23
-
24
- config.before(:suite) do
25
- class GoogleHolidayCalendar::Calendar
26
- extend Memoist
27
- memoize :fetch
28
- end
29
- end
30
- end
@@ -1,7 +0,0 @@
1
- shared_examples :holidays_in_japan_at_jan do
2
- its(:count){ should == 4 }
3
- it{ should include(date("2014-01-01") => "元日") }
4
- it{ should include(date("2014-01-02") => "銀行休業日") }
5
- it{ should include(date("2014-01-03") => "銀行休業日") }
6
- it{ should include(date("2014-01-13") => "成人の日") }
7
- end
@@ -1,5 +0,0 @@
1
- shared_examples :holidays_in_usa_at_jan do
2
- its(:count){ should == 2 }
3
- it{ should include(date("2014-01-01") => "New Year's Day") }
4
- it{ should include(date("2014-01-20") => "Martin Luther King Day") }
5
- end
@@ -1,3 +0,0 @@
1
- def date(str)
2
- Date.parse(str)
3
- end