national_day_list 1.0.3 → 1.0.4
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.
- checksums.yaml +4 -4
- data/lib/nationalday.rb +24 -0
- data/lib/nationaldaylist.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c05e9b1feafdd7d74933e3b464ea6da6c24361fb
|
4
|
+
data.tar.gz: 972c44fca05b3b60c7d81456666394b68f9e6cca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21cd0bdf8a877cd52a78a08a798511eab2168d18b9aa601a104d26a143a730921c77a4f6d444a7d9ee5302afed69253209e74e4d601454461ef82818840022e4
|
7
|
+
data.tar.gz: 8ad23d7b0949c1c91b5b8650091712f70c5805cdf8b127c74be24c46b5c05aed4303ab9d1d853ad5fd7a9dcc144ae615572eaa7b28bb7776515b637d12d77b19
|
data/lib/nationalday.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
class NationalDay
|
2
|
+
attr_accessor :name, :url, :summary, :image
|
3
|
+
attr_reader :has_details
|
4
|
+
def initialize(hash)
|
5
|
+
hash.each do |k,v|
|
6
|
+
self.send("#{k}=",v)
|
7
|
+
end
|
8
|
+
@has_details=false
|
9
|
+
end
|
10
|
+
|
11
|
+
#add details from the provided has, if no hash is provided details with automatically be pulled from the url
|
12
|
+
#Checkl to see if #has_details is true to avoid excess network requests
|
13
|
+
def add_details(hash=Scraper.scrape_day_details(url))
|
14
|
+
hash.each do |k,v|
|
15
|
+
#tfw you cant check to see if a method is defined with a string, only a symbol
|
16
|
+
self.send("#{k}=",v)
|
17
|
+
end
|
18
|
+
@has_details=true
|
19
|
+
end
|
20
|
+
|
21
|
+
def ==(other)
|
22
|
+
name==other.name&&url==other.url&&summary==other.summary&&image==other.image
|
23
|
+
end
|
24
|
+
end
|
data/lib/nationaldaylist.rb
CHANGED
@@ -5,7 +5,7 @@ class NationalDayList
|
|
5
5
|
attr_accessor :use_cache
|
6
6
|
MONTHS ||= ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"]
|
7
7
|
URL_BASE ||= "http://www.nationaldaycalendar.com/"
|
8
|
-
VERSION ||= '1.0.
|
8
|
+
VERSION ||= '1.0.4'
|
9
9
|
|
10
10
|
def initialize(use_cache=true)
|
11
11
|
@use_cache = use_cache
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: national_day_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Sattelberger
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- config/enviroment.rb
|
108
108
|
- lib/cli.rb
|
109
109
|
- lib/dayofmonth.rb
|
110
|
+
- lib/nationalday.rb
|
110
111
|
- lib/nationaldaylist.rb
|
111
112
|
- lib/scraper.rb
|
112
113
|
homepage: https://github.com/sattelbergerp/national-day-list
|