Active 0.0.30 → 0.0.31
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.
- data/lib/services/IActivity.rb +1 -1
- data/lib/services/activity.rb +7 -1
- data/lib/services/gsa.rb +8 -1
- data/lib/services/reg_center.rb +8 -0
- data/spec/activity_spec.rb +3 -0
- data/spec/gsa_spec.rb +11 -2
- data/version.txt +1 -1
- metadata +4 -4
data/lib/services/IActivity.rb
CHANGED
@@ -8,7 +8,7 @@ module Active
|
|
8
8
|
attr_accessor
|
9
9
|
|
10
10
|
attr_accessor :title, :url, :categories, :address, :start_date, :start_time, :end_time, :end_date, :category, :desc,
|
11
|
-
:asset_id, :asset_type_id, :data
|
11
|
+
:asset_id, :asset_type_id, :data, :online_registration
|
12
12
|
|
13
13
|
attr_reader :asset_type_id
|
14
14
|
|
data/lib/services/activity.rb
CHANGED
@@ -292,7 +292,13 @@ module Active
|
|
292
292
|
end
|
293
293
|
# The asset type id lets us know what system is came from
|
294
294
|
|
295
|
-
|
295
|
+
def online_registration
|
296
|
+
if @gsa
|
297
|
+
return @gsa.online_registration
|
298
|
+
else
|
299
|
+
return false
|
300
|
+
end
|
301
|
+
end
|
296
302
|
|
297
303
|
def primary_category
|
298
304
|
return @primary.primary_category unless @primary.nil?
|
data/lib/services/gsa.rb
CHANGED
@@ -125,8 +125,15 @@ module Active
|
|
125
125
|
|
126
126
|
def last_modified
|
127
127
|
@data["meta"]["lastModifiedDateTime"] if @data["meta"].has_key?("lastModifiedDateTime")
|
128
|
-
end
|
129
128
|
|
129
|
+
end
|
130
|
+
|
131
|
+
def online_registration
|
132
|
+
if @data["meta"].has_key?("onlineRegistrationAvailable")
|
133
|
+
(@data["meta"]["onlineRegistrationAvailable"].downcase == "true") ? true : false
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
130
137
|
# def contact_email
|
131
138
|
# if @data["meta"].has_key?("contactEmail") && !@data["meta"]["contactEmail"].blank?
|
132
139
|
# @data["meta"]["contactEmail"]
|
data/lib/services/reg_center.rb
CHANGED
@@ -46,6 +46,14 @@ module Active
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def registration_url
|
50
|
+
if @data.has_key?("event") && @data["event"].has_key?("registrationUrl")
|
51
|
+
@data["event"]["registrationUrl"]
|
52
|
+
else
|
53
|
+
""
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
49
57
|
def event_url
|
50
58
|
@data[:event][:eventUrl]
|
51
59
|
end
|
data/spec/activity_spec.rb
CHANGED
@@ -13,6 +13,9 @@ describe Activity do
|
|
13
13
|
@a = Activity.new( GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","language":"en","title":"2011 Rohto Ironman 70.3 California | Oceanside, California \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","summary":"","meta":{"eventDate":"2011-04-02T00:00:00-07:00","location":"Oceanside Harbor","tag":["event:10","Triathlon:10"],"eventLongitude":"-117.3586","endDate":"2011-04-02","locationName":"Oceanside Harbor","lastModifiedDateTime":"2010-09-30 06:16:05.107","splitMediaType":["Event","Ironman","Long Course"],"endTime":"0:00:00","city":"Oceanside","google-site-verification":"","startTime":"0:00:00","eventId":"1838902","description":"","longitude":"-117.3586","substitutionUrl":"1838902","sortDate":"2001-04-02","eventState":"California","eventLatitude":"33.19783","keywords":"Event","eventAddress":"1540 Harbor Drive North","dma":"San Diego","seourl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","country":"United States","category":"Activities","market":"San Diego","contactName":"World Triathlon Corporation","assetTypeId":"3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6","eventZip":"92054","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"33.19783","startDate":"2011-04-02","state":"California","mediaType":["Event","Event\\Ironman","Event\\Long Course"],"estParticipants":"2500","assetId":["77ACABBD-BA83-4C78-925D-CE49DEDDF20C","77acabbd-ba83-4c78-925d-ce49deddf20c"],"participationCriteria":"All","onlineDonationAvailable":"0","assetName":["2011 Rohto Ironman 70.3 California","2011 Rohto Ironman 70.3 California"],"zip":"92054","eventURL":"http://www.ironmancalifornia.com/","contactPhone":"813-868-5940","contactEmail":"california70.3@ironman.com","onlineMembershipAvailable":"0","trackbackurl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","onlineRegistrationAvailable":"true","image1":"http://www.active.com/images/events/hotrace.gif","lastModifiedDate":"2010-09-30","channel":"Triathlon"}}')) )
|
14
14
|
@ats_activity = Activity.new(ATS.new( {"destinationID"=>"", "assetId"=>"EEBC04D9-EA80-46C6-B9DD-6EBF49F8678F", "substitutionUrl"=>"1875345", "city"=>"San Francisco", "contactName"=>"Pete Berg", "trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1875345&assetId=EEBC04D9-EA80-46C6-B9DD-6EBF49F8678F", :asset_id=>"EEBC04D9-EA80-46C6-B9DD-6EBF49F8678F", "category"=>"Activities", "zip"=>"94111", "userCommentText"=>nil, "location"=>"San Francisco metro area", "latitude"=>"37.7983181", :asset_type_name=>"Active.com Event Registration", "searchWeight"=>"1", "country"=>"United States", "participationCriteria"=>"Adult,Family,Kids,Men,Women", "dma"=>"San Francisco - Oakland - San Jose", :asset_name=>"URBAN HUNT: San Francisco", :asset_type_id=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "isSearchable"=>"true", :xmlns=>"http://api.asset.services.active.com", :url=>"http://www.active.com/page/Event_Details.htm?event_id=1875345", "row"=>"1", "image1"=>nil, "startDate"=>"2010-10-16", "contactPhone"=>"607-222-9845", "onlineDonationAvailable"=>"0", "avgUserRating"=>nil, "market"=>"San Francisco - Oakland - San Jose", :substitution_url=>"1875345", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "assetName"=>"URBAN HUNT: San Francisco", "channel"=>["More Sports\\Adventure Racing", "Running"], "seourl"=>"http://www.active.com/running/san-francisco-ca/urban-hunt-san-francisco-2010", "mediaType"=>["Event", "Event\\5 mile", "=difficulty:Beginner", "=difficulty:Intermediate"], "startTime"=>"11:00:00", "endTime"=>"11:00:00", "contactEmail"=>"info@realityrush.com", "eventResults"=>nil, "longitude"=>"-122.4000032", "endDate"=>"2010-10-16", "onlineRegistrationAvailable"=>"false", "onlineMembershipAvailable"=>"0", "state"=>"California", "estParticipants"=>"100", "eventURL"=>"http://www.realityrush.com/events/urban-hunt-san-francisco-oct-16th-2010/"}))
|
15
15
|
end
|
16
|
+
it "should have online registration" do
|
17
|
+
@a.online_registration.should be_true
|
18
|
+
end
|
16
19
|
it "should have asset ids" do
|
17
20
|
@a.asset_id.should_not be_nil
|
18
21
|
@a.asset_id.should eql("77ACABBD-BA83-4C78-925D-CE49DEDDF20C")
|
data/spec/gsa_spec.rb
CHANGED
@@ -11,6 +11,15 @@ describe GSA do
|
|
11
11
|
before(:each) do
|
12
12
|
@a = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","language":"en","title":"2011 Rohto Ironman 70.3 California | Oceanside, California \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","summary":"","meta":{"eventDate":"2011-04-02T00:00:00-07:00","location":"Oceanside Harbor","tag":["event:10","Triathlon:10"],"eventLongitude":"-117.3586","endDate":"2011-04-02","locationName":"Oceanside Harbor","lastModifiedDateTime":"2010-09-30 06:16:05.107","splitMediaType":["Event","Ironman","Long Course"],"endTime":"0:00:00","city":"Oceanside","google-site-verification":"","startTime":"0:00:00","eventId":"1838902","description":"","longitude":"-117.3586","substitutionUrl":"1838902","sortDate":"2001-04-02","eventState":"California","eventLatitude":"33.19783","keywords":"Event","eventAddress":"1540 Harbor Drive North","dma":"San Diego","seourl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","country":"United States","category":"Activities","market":"San Diego","contactName":"World Triathlon Corporation","assetTypeId":"3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6","eventZip":"92054","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"33.19783","startDate":"2011-04-02","state":"California","mediaType":["Event","Event\\Ironman","Event\\Long Course"],"estParticipants":"2500","assetId":["77ACABBD-BA83-4C78-925D-CE49DEDDF20C","77acabbd-ba83-4c78-925d-ce49deddf20c"],"participationCriteria":"All","onlineDonationAvailable":"0","assetName":["2011 Rohto Ironman 70.3 California","2011 Rohto Ironman 70.3 California"],"zip":"92054","eventURL":"http://www.ironmancalifornia.com/","contactPhone":"813-868-5940","contactEmail":"california70.3@ironman.com","onlineMembershipAvailable":"0","trackbackurl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","onlineRegistrationAvailable":"true","image1":"http://www.active.com/images/events/hotrace.gif","lastModifiedDate":"2010-09-30","channel":"Triathlon"}}'))
|
13
13
|
end
|
14
|
+
it "should have online registration" do
|
15
|
+
@a.online_registration.should be_true
|
16
|
+
@a = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","language":"en","title":"2011 Rohto Ironman 70.3 California | Oceanside, California \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","summary":"","meta":{"eventDate":"2011-04-02T00:00:00-07:00","location":"Oceanside Harbor","tag":["event:10","Triathlon:10"],"eventLongitude":"-117.3586","endDate":"2011-04-02","locationName":"Oceanside Harbor","lastModifiedDateTime":"2010-09-30 06:16:05.107","splitMediaType":["Event","Ironman","Long Course"],"endTime":"0:00:00","city":"Oceanside","google-site-verification":"","startTime":"0:00:00","eventId":"1838902","description":"","longitude":"-117.3586","substitutionUrl":"1838902","sortDate":"2001-04-02","eventState":"California","eventLatitude":"33.19783","keywords":"Event","eventAddress":"1540 Harbor Drive North","dma":"San Diego","seourl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","country":"United States","category":"Activities","market":"San Diego","contactName":"World Triathlon Corporation","assetTypeId":"3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6","eventZip":"92054","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"33.19783","startDate":"2011-04-02","state":"California","mediaType":["Event","Event\\Ironman","Event\\Long Course"],"estParticipants":"2500","assetId":["77ACABBD-BA83-4C78-925D-CE49DEDDF20C","77acabbd-ba83-4c78-925d-ce49deddf20c"],"participationCriteria":"All","onlineDonationAvailable":"0","assetName":["2011 Rohto Ironman 70.3 California","2011 Rohto Ironman 70.3 California"],"zip":"92054","eventURL":"http://www.ironmancalifornia.com/","contactPhone":"813-868-5940","contactEmail":"california70.3@ironman.com","onlineMembershipAvailable":"0","trackbackurl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","onlineRegistrationAvailable":"TRUE","image1":"http://www.active.com/images/events/hotrace.gif","lastModifiedDate":"2010-09-30","channel":"Triathlon"}}'))
|
17
|
+
@a.online_registration.should be_true
|
18
|
+
end
|
19
|
+
it "should NOT have online registration" do
|
20
|
+
@a = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","language":"en","title":"2011 Rohto Ironman 70.3 California | Oceanside, California \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","summary":"","meta":{"eventDate":"2011-04-02T00:00:00-07:00","location":"Oceanside Harbor","tag":["event:10","Triathlon:10"],"eventLongitude":"-117.3586","endDate":"2011-04-02","locationName":"Oceanside Harbor","lastModifiedDateTime":"2010-09-30 06:16:05.107","splitMediaType":["Event","Ironman","Long Course"],"endTime":"0:00:00","city":"Oceanside","google-site-verification":"","startTime":"0:00:00","eventId":"1838902","description":"","longitude":"-117.3586","substitutionUrl":"1838902","sortDate":"2001-04-02","eventState":"California","eventLatitude":"33.19783","keywords":"Event","eventAddress":"1540 Harbor Drive North","dma":"San Diego","seourl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","country":"United States","category":"Activities","market":"San Diego","contactName":"World Triathlon Corporation","assetTypeId":"3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6","eventZip":"92054","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"33.19783","startDate":"2011-04-02","state":"California","mediaType":["Event","Event\\Ironman","Event\\Long Course"],"estParticipants":"2500","assetId":["77ACABBD-BA83-4C78-925D-CE49DEDDF20C","77acabbd-ba83-4c78-925d-ce49deddf20c"],"participationCriteria":"All","onlineDonationAvailable":"0","assetName":["2011 Rohto Ironman 70.3 California","2011 Rohto Ironman 70.3 California"],"zip":"92054","eventURL":"http://www.ironmancalifornia.com/","contactPhone":"813-868-5940","contactEmail":"california70.3@ironman.com","onlineMembershipAvailable":"0","trackbackurl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","onlineRegistrationAvailable":"false","image1":"http://www.active.com/images/events/hotrace.gif","lastModifiedDate":"2010-09-30","channel":"Triathlon"}}'))
|
21
|
+
@a.online_registration.should be_false
|
22
|
+
end
|
14
23
|
it "should have asset ids" do
|
15
24
|
@a.asset_id.should_not be_nil
|
16
25
|
@a.asset_type_id.should_not be_nil
|
@@ -184,8 +193,8 @@ describe GSA do
|
|
184
193
|
it "should have a valid first and last name" do
|
185
194
|
g = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/running/san-ramon-ca/primos-run-for-education-2010","language":"en","title":"Primo\u0026#39;s Run for Education | San Ramon, California 94568 \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/running/san-ramon-ca/primos-run-for-education-2010","summary":"Active partnered with ESPN. United States. United Kingdom Ireland France\u003cbr\u003e Italy Spain Sweden Germany Portugal Netherlands Austria Australia \u003cb\u003e...\u003c/b\u003e ","meta":{"startDate":"2010-10-11","eventDate":"2010-10-11T00:00:00-07:00","location":"Iron Horse School","tag":["event:10","Running:10"],"state":"California","eventLongitude":"-121.9074859","endDate":"2010-10-11","lastModifiedDateTime":"2010-10-12 10:16:46.88","splitMediaType":["Event","5K","Half Marathon","\u003ddifficulty:Beginner","\u003ddifficulty:Intermediate"],"locationName":"Iron Horse School","endTime":"0:00:00","mediaType":["Event","Event\\5K","Event\\Half Marathon","\u003ddifficulty:Beginner","\u003ddifficulty:Intermediate"],"city":"San Ramon","google-site-verification":"","estParticipants":"10000","startTime":"0:00:00","assetId":["FBF1EF76-B8BF-427A-85DD-D310DB9E075D","fbf1ef76-b8bf-427a-85dd-d310db9e075d"],"eventId":"1899115","participationCriteria":"Family","description":"","longitude":"-121.9074859","onlineDonationAvailable":"0","substitutionUrl":"1899115","assetName":["Primo\'s Run for Education","Primo\'s Run for Education"],"zip":"94568","contactPhone":"925-875-0405","sortDate":"2000-10-11","eventState":"California","eventLatitude":"37.7130380","keywords":"Event","eventResults":"http://results.active.com/pages/page.jsp?eventID\u003d1899115\u0026pubID\u003d3","contactEmail":"buzz@bwp.com","onlineMembershipAvailable":"0","dma":"San Francisco - Oakland - San Jose","trackbackurl":"http://www.active.com/running/san-ramon-ca/primos-run-for-education-2010","seourl":"http://www.active.com/running/san-ramon-ca/primos-run-for-education-2010","country":"United States","onlineRegistrationAvailable":"false","category":"Activities","market":"San Francisco - Oakland - San Jose","contactName":"Buzz Ayola# (ED_Use this one)","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate":"2010-10-12","eventZip":"94568","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"37.7130380","channel":"Running"}}'))
|
186
195
|
g.user.first_name.should eql("Buzz")
|
187
|
-
g.user.last_name.should eql("Ayola")
|
188
|
-
g.title.should eql("Primo
|
196
|
+
g.user.last_name.should eql("Ayola# (ED_Use this one)")
|
197
|
+
g.title.should eql("Primo's Run for Education")
|
189
198
|
end
|
190
199
|
it "should pull primary category from seo url" do
|
191
200
|
g = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","language":"en","title":"Seismic Challenge 3.0 | San Francisco, California 94101 \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","summary":"","meta":{"startDate":"2010-10-02","eventDate":"2010-10-02T00:00:00-07:00","location":"San Francisco Bay","tag":"event:10","state":"California","eventLongitude":"-122.42","endDate":"2010-10-03","lastModifiedDateTime":"2010-10-04 03:08:51.65","splitMediaType":"Event","locationName":"San Francisco Bay","endTime":"0:00:00","mediaType":"Event","city":"San Francisco","google-site-verification":"","estParticipants":"2000","startTime":"0:00:00","assetId":["35A99FCB-E238-4D78-9205-96179F827CB0","35a99fcb-e238-4d78-9205-96179f827cb0"],"eventId":"1883181","participationCriteria":"All","description":"","longitude":"-122.42","onlineDonationAvailable":"0","substitutionUrl":"1883181","assetName":["Seismic Challenge 3.0","Seismic Challenge 3.0"],"eventURL":"http://greaterthanone.org/events/seismic-challenge/","zip":"94101","contactPhone":"415-487-3053","sortDate":"2000-10-02","eventState":"California","eventLatitude":"37.78","keywords":"Event","contactEmail":"eventinfo@sfaf.org","onlineMembershipAvailable":"0","dma":"San Francisco - Oakland - San Jose","trackbackurl":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","seourl":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","country":"United States","onlineRegistrationAvailable":"false","category":"Activities","market":"San Francisco - Oakland - San Jose","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate":"2010-10-04","eventZip":"94101","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"37.78","channel":"Running,Cycling"}}'))
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.31
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Active
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 33
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 31
|
10
|
+
version: 0.0.31
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonathan Spooner, Brian Levine
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-15 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|