ruby-calendarific 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ruby-calendarific.rb +36 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4687ca916aef30a767af545348a728ace31b1b89
4
+ data.tar.gz: 6ba62d72087de72b0570d7a848d8bdd27db91a68
5
+ SHA512:
6
+ metadata.gz: b9e5ca187a84cb955b9920b3b8fbbe4df387b4737581bccba65d5b25333c676c6b24a2d2db1ba7f6fb48437a39f7bad91a0dd50c0db4126660b5f20ae908cca5
7
+ data.tar.gz: 6ce54de6e99e1129cb58c75b8fe688795c28e111b9faddf3e03c519f6c91a8f3e20cb6d2c53ddd264d253ca55c77b01c166e7fb72a3eae7ca0483aab23c12cc1
@@ -0,0 +1,36 @@
1
+ require 'addressable/uri'
2
+ require 'json'
3
+ require 'net/http'
4
+ require 'openssl'
5
+
6
+ module Calendarific
7
+ class V2
8
+ def initialize(api_key = false)
9
+ @api_key = api_key
10
+ end
11
+
12
+ def holidays(params = Hash.new)
13
+ if !params.has_key?('api_key')
14
+ params['api_key'] = @api_key
15
+ end
16
+
17
+ uri = Addressable::URI.new
18
+ uri.query_values = params
19
+
20
+ uri = URI("https://calendarific.com/api/v2/holidays?#{uri.query}")
21
+
22
+ Net::HTTP.start(
23
+ uri.host,
24
+ uri.port,
25
+ :use_ssl => true,
26
+ :verify_mode => OpenSSL::SSL::VERIFY_NONE
27
+ ) do |http|
28
+ request = Net::HTTP::Get.new uri
29
+
30
+ response = http.request request
31
+ return JSON.parse(response.body)
32
+ end
33
+ end
34
+ end
35
+ end
36
+
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-calendarific
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Calendarific
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Official Ruby library for Calendarific Global Holiday API - https://calendarific.com
14
+ email: info@calendarific.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/ruby-calendarific.rb
20
+ homepage: https://calendarific.com
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.2.3
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Official Ruby library for Calendarific Global Holiday API - https://calendarific.com
44
+ test_files: []