libtad 0.1.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.
- checksums.yaml +7 -0
- data/lib/libtad.rb +123 -0
- data/lib/services/astronomy.rb +102 -0
- data/lib/services/date_calculator.rb +155 -0
- data/lib/services/holidays.rb +34 -0
- data/lib/services/onthisday.rb +42 -0
- data/lib/services/places.rb +26 -0
- data/lib/services/time.rb +143 -0
- data/lib/types/astronomy/astronomy_current.rb +58 -0
- data/lib/types/astronomy/astronomy_day.rb +32 -0
- data/lib/types/astronomy/astronomy_day_event.rb +76 -0
- data/lib/types/astronomy/astronomy_event.rb +24 -0
- data/lib/types/astronomy/astronomy_event_class.rb +37 -0
- data/lib/types/astronomy/astronomy_location.rb +31 -0
- data/lib/types/astronomy/astronomy_object.rb +27 -0
- data/lib/types/astronomy/astronomy_object_details.rb +32 -0
- data/lib/types/astronomy/astronomy_object_type.rb +36 -0
- data/lib/types/astronomy/moonphase.rb +37 -0
- data/lib/types/date_calculator/business_days_filter.rb +39 -0
- data/lib/types/date_calculator/business_holiday.rb +26 -0
- data/lib/types/date_calculator/period.rb +44 -0
- data/lib/types/date_calculator/weekdays.rb +54 -0
- data/lib/types/holidays/holiday.rb +93 -0
- data/lib/types/holidays/holiday_state.rb +35 -0
- data/lib/types/holidays/holiday_type.rb +107 -0
- data/lib/types/onthisday/event.rb +51 -0
- data/lib/types/onthisday/event_type.rb +15 -0
- data/lib/types/onthisday/name.rb +24 -0
- data/lib/types/onthisday/person.rb +39 -0
- data/lib/types/places/country.rb +20 -0
- data/lib/types/places/geo.rb +34 -0
- data/lib/types/places/location.rb +43 -0
- data/lib/types/places/location_ref.rb +24 -0
- data/lib/types/places/place.rb +24 -0
- data/lib/types/places/region.rb +35 -0
- data/lib/types/time/datetime.rb +93 -0
- data/lib/types/time/dst_entry.rb +48 -0
- data/lib/types/time/time.rb +30 -0
- data/lib/types/time/time_change.rb +49 -0
- data/lib/types/time/timezone.rb +51 -0
- metadata +137 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
module LibTAD
|
2
|
+
module TADTime
|
3
|
+
# Information about date, time and timezone.
|
4
|
+
class TADTime
|
5
|
+
# @return [String]
|
6
|
+
# ISO representation of date and time, time zone included
|
7
|
+
# (@see https://dev-test.timeanddate.com/docs/external-references#ISO8601 ISO8601)
|
8
|
+
# if different from UTC. If time is not applicable, only the date is shown.
|
9
|
+
#
|
10
|
+
# Example: 2011-06-08T09:18:16+02:00
|
11
|
+
# Example: 2011-06-08T07:18:16 (UTC time)
|
12
|
+
# Example: 2011-06-08 (only date)
|
13
|
+
attr_reader :iso
|
14
|
+
|
15
|
+
# @return [DateTime]
|
16
|
+
# Date and time, split up into components.
|
17
|
+
attr_reader :datetime
|
18
|
+
|
19
|
+
# @return [TimeZone]
|
20
|
+
# Timezone information.
|
21
|
+
attr_reader :timezone
|
22
|
+
|
23
|
+
def initialize(hash)
|
24
|
+
@iso = hash.fetch('iso', nil)
|
25
|
+
@datetime = TADDateTime.new.from_json hash['datetime'] unless !hash.key?('datetime')
|
26
|
+
@timezone = TADTimeZone.new hash['timezone'] unless !hash.key?('timezone')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module LibTAD
|
2
|
+
module TADTime
|
3
|
+
# Information about a time change.
|
4
|
+
class TimeChange
|
5
|
+
# @return [Integer]
|
6
|
+
# New DST offset in seconds. Value will be null/empty if there is no DST for this location.
|
7
|
+
attr_reader :newdst
|
8
|
+
|
9
|
+
# @return [Integer]
|
10
|
+
# New time zone offset to UTC in seconds if there is a time zone change for this place. Otherwise the value will be null/empty.
|
11
|
+
# Time zones changes happen only very rarely, so the field will be null/empty on most occasions.
|
12
|
+
attr_reader :newzone
|
13
|
+
|
14
|
+
# @return [Integer]
|
15
|
+
# New total offset to UTC in seconds.
|
16
|
+
attr_reader :newoffset
|
17
|
+
|
18
|
+
# @return [String]
|
19
|
+
# Time stamp of transition in UTC time, formatted as ISO 8601 time.
|
20
|
+
#
|
21
|
+
# Example: 2011-03-27T01:00:00
|
22
|
+
# @see https://dev-test.timeanddate.com/docs/external-references#ISO8601 ISO8601
|
23
|
+
attr_reader :utctime
|
24
|
+
|
25
|
+
# @return [String]
|
26
|
+
# Local time before transition, formatted as ISO 8601 time.
|
27
|
+
#
|
28
|
+
# Example: 2011-03-27T02:00:00
|
29
|
+
# @see https://dev-test.timeanddate.com/docs/external-references#ISO8601 ISO8601
|
30
|
+
attr_reader :oldlocaltime
|
31
|
+
|
32
|
+
# @return [String]
|
33
|
+
# Local time after transition, formatted as ISO 8601 time.
|
34
|
+
#
|
35
|
+
# Example: 2011-03-27T03:00:00
|
36
|
+
# @see https://dev-test.timeanddate.com/docs/external-references#ISO8601 ISO8601
|
37
|
+
attr_reader :newlocaltime
|
38
|
+
|
39
|
+
def initialize(hash)
|
40
|
+
@newdst = hash.fetch('newdst', nil)
|
41
|
+
@newzone = hash.fetch('newzone', nil)
|
42
|
+
@newoffset = hash.fetch('newoffset', nil)
|
43
|
+
@utctime = hash.fetch('utctime', nil)
|
44
|
+
@oldlocaltime = hash.fetch('oldlocaltime', nil)
|
45
|
+
@newlocaltime = hash.fetch('newlocaltime', nil)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module LibTAD
|
2
|
+
module TADTime
|
3
|
+
# Timezone information.
|
4
|
+
class TADTimeZone
|
5
|
+
# @return [String]
|
6
|
+
# The time zone offset (from UTC) in string representation.
|
7
|
+
#
|
8
|
+
# Example: +11:00
|
9
|
+
attr_reader :offset
|
10
|
+
|
11
|
+
# @return [String]
|
12
|
+
# Abbreviated time zone name.
|
13
|
+
#
|
14
|
+
# Example: LHDT
|
15
|
+
attr_reader :zoneabb
|
16
|
+
|
17
|
+
# @return [String]
|
18
|
+
# Full time zone name.
|
19
|
+
#
|
20
|
+
# Example: Lord Howe Daylight Time
|
21
|
+
attr_reader :zonename
|
22
|
+
|
23
|
+
# @return [Integer]
|
24
|
+
# Basic time zone offset (without DST) in seconds.
|
25
|
+
#
|
26
|
+
# Example: 37800
|
27
|
+
attr_reader :zoneoffset
|
28
|
+
|
29
|
+
# @return [Integer]
|
30
|
+
# DST component of time zone offset in seconds.
|
31
|
+
#
|
32
|
+
# Example: 1800
|
33
|
+
attr_reader :zonedst
|
34
|
+
|
35
|
+
# @return [Integer]
|
36
|
+
# Total offset from UTC in seconds.
|
37
|
+
#
|
38
|
+
#Example: 39600
|
39
|
+
attr_reader :zonetotaloffset
|
40
|
+
|
41
|
+
def initialize(hash)
|
42
|
+
@offset = hash.fetch('offset', nil)
|
43
|
+
@zoneabb = hash.fetch('zoneabb', nil)
|
44
|
+
@zonename = hash.fetch('zonename', nil)
|
45
|
+
@zoneoffset = hash.fetch('zoneoffset', nil)
|
46
|
+
@zonedst = hash.fetch('zonedst', nil)
|
47
|
+
@zonetotaloffset = hash.fetch('zonetotaloffset', nil)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: libtad
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Alvsåker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-09-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: yard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rdoc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Library for accessing Time and Date APIs
|
70
|
+
email: api@timeanddate.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- lib/libtad.rb
|
76
|
+
- lib/services/astronomy.rb
|
77
|
+
- lib/services/date_calculator.rb
|
78
|
+
- lib/services/holidays.rb
|
79
|
+
- lib/services/onthisday.rb
|
80
|
+
- lib/services/places.rb
|
81
|
+
- lib/services/time.rb
|
82
|
+
- lib/types/astronomy/astronomy_current.rb
|
83
|
+
- lib/types/astronomy/astronomy_day.rb
|
84
|
+
- lib/types/astronomy/astronomy_day_event.rb
|
85
|
+
- lib/types/astronomy/astronomy_event.rb
|
86
|
+
- lib/types/astronomy/astronomy_event_class.rb
|
87
|
+
- lib/types/astronomy/astronomy_location.rb
|
88
|
+
- lib/types/astronomy/astronomy_object.rb
|
89
|
+
- lib/types/astronomy/astronomy_object_details.rb
|
90
|
+
- lib/types/astronomy/astronomy_object_type.rb
|
91
|
+
- lib/types/astronomy/moonphase.rb
|
92
|
+
- lib/types/date_calculator/business_days_filter.rb
|
93
|
+
- lib/types/date_calculator/business_holiday.rb
|
94
|
+
- lib/types/date_calculator/period.rb
|
95
|
+
- lib/types/date_calculator/weekdays.rb
|
96
|
+
- lib/types/holidays/holiday.rb
|
97
|
+
- lib/types/holidays/holiday_state.rb
|
98
|
+
- lib/types/holidays/holiday_type.rb
|
99
|
+
- lib/types/onthisday/event.rb
|
100
|
+
- lib/types/onthisday/event_type.rb
|
101
|
+
- lib/types/onthisday/name.rb
|
102
|
+
- lib/types/onthisday/person.rb
|
103
|
+
- lib/types/places/country.rb
|
104
|
+
- lib/types/places/geo.rb
|
105
|
+
- lib/types/places/location.rb
|
106
|
+
- lib/types/places/location_ref.rb
|
107
|
+
- lib/types/places/place.rb
|
108
|
+
- lib/types/places/region.rb
|
109
|
+
- lib/types/time/datetime.rb
|
110
|
+
- lib/types/time/dst_entry.rb
|
111
|
+
- lib/types/time/time.rb
|
112
|
+
- lib/types/time/time_change.rb
|
113
|
+
- lib/types/time/timezone.rb
|
114
|
+
homepage: https://timeanddate.com
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubygems_version: 3.0.3
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Time and Date API client
|
137
|
+
test_files: []
|