ruby-holidayapi 1.0.0

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-holidayapi.rb +36 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 179fa8c7be02c7addaab4d4fd5cf6c41a0a2af06
4
+ data.tar.gz: 0a963f7505a85dca11ee86c5c81a67a4dcd7ecd1
5
+ SHA512:
6
+ metadata.gz: 23ab09668e28609c8c3c4f96b270cc45c5d4ee001a17e94dd6c833e8f89e9f8b0e4095cba6ac883791b964ff708512f28f47680e0aec4d804720af6b72be1aaf
7
+ data.tar.gz: 50cb1331a58b2a6da308c60acde86f440a9c4f2c294f06ab33b970e18d301792dd74954588cabbb8856811b60ed7bddcf1d6e93d8e4caeeb6614e6be830fdc79
@@ -0,0 +1,36 @@
1
+ require 'addressable/uri'
2
+ require 'json'
3
+ require 'net/http'
4
+ require 'openssl'
5
+
6
+ module HolidayAPI
7
+ class V1
8
+ def initialize(key = false)
9
+ @key = key
10
+ end
11
+
12
+ def holidays(params = Hash.new)
13
+ if !params.has_key?('key')
14
+ params['key'] = @key
15
+ end
16
+
17
+ uri = Addressable::URI.new
18
+ uri.query_values = params
19
+
20
+ uri = URI("https://holidayapi.com/v1/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-holidayapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Josh Sherman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Official Ruby library for Holiday API
14
+ email: hello@holidayapi.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/ruby-holidayapi.rb
20
+ homepage: https://holidayapi.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.4.6
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Official Ruby library for Holiday API
44
+ test_files: []