actv 2.5.0 → 2.5.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.
- checksums.yaml +4 -4
- data/lib/actv/event.rb +10 -2
- data/lib/actv/version.rb +1 -1
- data/spec/actv/event_spec.rb +28 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2c960eeba970c1ae3b64b260f4e75e7d0c2d439
|
4
|
+
data.tar.gz: 8da74b6d45cc994aafb1f77de9088c4831dc4246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e6a72e9414ac777636128bd6132fca7f9628db065c3b58f7c851d45267786e34f386b773d49747bde5b2378c4ed34fea3fc6b1966ee3169bb3292533ba3c928
|
7
|
+
data.tar.gz: a985e4045b5053a58a56bee24e49e58cf0854a65f3c704b703387fd5c59ff73e07f13408fb40f92486f2edd875da9a55e97505abdc78d2afee972551f40dee6c
|
data/lib/actv/event.rb
CHANGED
@@ -99,13 +99,13 @@ module ACTV
|
|
99
99
|
# Returns the asset's registration open date
|
100
100
|
# in UTC. This is pulled from the salesStartDate
|
101
101
|
def registration_open_date
|
102
|
-
Time.parse
|
102
|
+
Time.parse parse_date_with_correct_timezone_or_offset(authoritative_reg_start_date)
|
103
103
|
end
|
104
104
|
|
105
105
|
# Returns the asset's registration end date
|
106
106
|
# in UTC. This is pulled from the salesEndDate
|
107
107
|
def registration_close_date
|
108
|
-
Time.parse
|
108
|
+
Time.parse parse_date_with_correct_timezone_or_offset(authoritative_reg_end_date)
|
109
109
|
end
|
110
110
|
|
111
111
|
# Returns the asset's start date
|
@@ -161,6 +161,14 @@ module ACTV
|
|
161
161
|
|
162
162
|
private
|
163
163
|
|
164
|
+
def parse_date_with_correct_timezone_or_offset date
|
165
|
+
if self.awcamps30? || self.awcamps? || self.regcenter2? || self.regcenter?
|
166
|
+
"#{date} #{format_timezone_offset(place.timezoneOffset)}"
|
167
|
+
else
|
168
|
+
"#{date} UTC"
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
164
172
|
# EG: -7 => "-0700"
|
165
173
|
def format_timezone_offset(offset)
|
166
174
|
(offset < 0 ? "-" : "") << offset.abs.to_s.rjust(2,'0') << '00'
|
data/lib/actv/version.rb
CHANGED
data/spec/actv/event_spec.rb
CHANGED
@@ -84,36 +84,52 @@ describe ACTV::Event do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
describe '#registration_open_date' do
|
87
|
-
before { subject.stub(:sales_start_date).and_return
|
88
|
-
|
89
|
-
|
87
|
+
before { subject.stub(:sales_start_date).and_return '2016-11-10T00:00:00' }
|
88
|
+
it 'returns the correct date with correct timezone offset when asset belongs to camps or regcenter' do
|
89
|
+
expect(subject.registration_open_date).to eq '2016-11-10T00:00:00 -0500'
|
90
|
+
end
|
91
|
+
context 'when asset not belongs to camps or regcenter' do
|
92
|
+
before { subject.stub(:sourceSystem).and_return :legacyGuid => 'testid' }
|
93
|
+
it 'returns the correct date in utc timezone' do
|
94
|
+
expect(subject.registration_open_date).to eq '2016-11-10T00:00:00 UTC'
|
95
|
+
end
|
90
96
|
end
|
91
97
|
end
|
92
98
|
|
93
99
|
describe '#registration_close_date' do
|
94
|
-
before { subject.stub(:sales_end_date).and_return
|
95
|
-
|
96
|
-
subject.
|
100
|
+
before { subject.stub(:sales_end_date).and_return '2016-12-10T00:00:00' }
|
101
|
+
context 'when asset belongs to camps or regcenter' do
|
102
|
+
before { subject.stub(:awcamps?).and_return true }
|
103
|
+
it 'returns the correct date with the correct timezone offset' do
|
104
|
+
expect(subject.registration_close_date).to eq '2016-12-10T00:00:00 -0500'
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'when asset not belongs to camps or regcenter' do
|
109
|
+
before { subject.stub(:sourceSystem).and_return :legacyGuid => 'testid' }
|
110
|
+
it 'returns the correct date in utc timezone' do
|
111
|
+
expect(subject.registration_close_date).to eq '2016-12-10T00:00:00 UTC'
|
112
|
+
end
|
97
113
|
end
|
98
114
|
end
|
99
115
|
|
100
116
|
describe '#event_start_date' do
|
101
117
|
before do
|
102
|
-
subject.stub(:activity_start_date).and_return(
|
118
|
+
subject.stub(:activity_start_date).and_return('2013-05-10T00:00:00')
|
103
119
|
subject.stub(:timezone_offset).and_return(-4)
|
104
120
|
end
|
105
|
-
it
|
106
|
-
subject.event_start_date.should eq Time.parse
|
121
|
+
it 'returns the correct date in the correct timezone' do
|
122
|
+
subject.event_start_date.should eq Time.parse '2013-05-10T00:00:00 -0400'
|
107
123
|
end
|
108
124
|
end
|
109
125
|
|
110
126
|
describe '#event_end_date' do
|
111
127
|
before do
|
112
|
-
subject.stub(:activity_end_date).and_return(
|
128
|
+
subject.stub(:activity_end_date).and_return('2013-05-10T00:00:00')
|
113
129
|
subject.stub(:timezone_offset).and_return(-4)
|
114
130
|
end
|
115
|
-
it
|
116
|
-
subject.event_end_date.should eq Time.parse
|
131
|
+
it 'returns the correct date in the correct timezone' do
|
132
|
+
subject.event_end_date.should eq Time.parse '2013-05-10T00:00:00 -0400'
|
117
133
|
end
|
118
134
|
end
|
119
135
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathaniel Barnes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -412,7 +412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
412
412
|
version: '0'
|
413
413
|
requirements: []
|
414
414
|
rubyforge_project:
|
415
|
-
rubygems_version: 2.4.
|
415
|
+
rubygems_version: 2.4.5
|
416
416
|
signing_key:
|
417
417
|
specification_version: 4
|
418
418
|
summary: Active API
|