actv 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4269228c84454953535d04d0d80db8626a4aa9e9
4
- data.tar.gz: 7820be864d4ab4ac32e21ae8c2e5b7e4dcc4b911
3
+ metadata.gz: d2c960eeba970c1ae3b64b260f4e75e7d0c2d439
4
+ data.tar.gz: 8da74b6d45cc994aafb1f77de9088c4831dc4246
5
5
  SHA512:
6
- metadata.gz: 1de425fa54d216951dfa56044e98077f0aa40be68412201f97884dcf4af70e5ba16e7db149ade31e5194c370364fe5df4bfc2a4a5cc98545151756e4713bb584
7
- data.tar.gz: 44d6ba3cb4485219c8edd1357040de16f66c6f4a101ff46f4d008650dc73cd3d319e5aaa2e838d975c3a57b98eb911dda7273e388b1d4572edd93d19b717852e
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 "#{authoritative_reg_start_date} UTC"
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 "#{authoritative_reg_end_date} UTC"
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
@@ -1,3 +1,3 @@
1
1
  module ACTV
2
- VERSION = "2.5.0"
2
+ VERSION = "2.5.1"
3
3
  end
@@ -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 format_date 1.day.from_now }
88
- it "returns the correct date in the correct timezone" do
89
- subject.registration_open_date.should be_within(1.second).of Time.parse format_date_in_utc 1.day.from_now
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 format_date 1.day.from_now }
95
- it "returns the correct date in the correct timezone" do
96
- subject.registration_close_date.should be_within(1.second).of Time.parse format_date_in_utc 1.day.from_now
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("2013-05-10T00:00:00")
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 "returns the correct date in the correct timezone" do
106
- subject.event_start_date.should eq Time.parse "2013-05-10T00:00:00 -0400"
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("2013-05-10T00:00:00")
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 "returns the correct date in the correct timezone" do
116
- subject.event_end_date.should eq Time.parse "2013-05-10T00:00:00 -0400"
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.0
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-10-12 00:00:00.000000000 Z
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.8
415
+ rubygems_version: 2.4.5
416
416
  signing_key:
417
417
  specification_version: 4
418
418
  summary: Active API