Active 0.0.42 → 0.1.7
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/.gitignore +6 -0
- data/.irbrc +21 -0
- data/.rspec +1 -0
- data/.rvmrc +2 -0
- data/Active.gemspec +28 -29
- data/Gemfile +4 -0
- data/History.txt +5 -2
- data/{README.txt → README.md} +4 -20
- data/Rakefile +11 -17
- data/lib/Active.rb +11 -79
- data/lib/active/activity.rb +7 -0
- data/lib/active/article.rb +7 -0
- data/lib/active/asset.rb +205 -0
- data/lib/active/errors.rb +9 -0
- data/lib/active/query.rb +225 -0
- data/lib/active/result.rb +7 -0
- data/lib/active/results.rb +6 -0
- data/lib/active/training.rb +7 -0
- data/lib/active/version.rb +3 -0
- data/lib/ext/hash_extensions.rb +8 -0
- data/spec/asset_spec.rb +47 -0
- data/spec/search_spec.rb +383 -432
- data/spec/spec_helper.rb +23 -2
- metadata +113 -116
- data/bin/Active +0 -7
- data/lib/.DS_Store +0 -0
- data/lib/services/.DS_Store +0 -0
- data/lib/services/IActivity.rb +0 -39
- data/lib/services/_ats.rb +0 -215
- data/lib/services/active_works.rb +0 -167
- data/lib/services/activity.rb +0 -512
- data/lib/services/address.rb +0 -17
- data/lib/services/ats.rb +0 -229
- data/lib/services/dto/user.rb +0 -9
- data/lib/services/gsa.rb +0 -205
- data/lib/services/reg_center.rb +0 -270
- data/lib/services/sanitize.rb +0 -108
- data/lib/services/search.rb +0 -494
- data/lib/services/validators.rb +0 -124
- data/rspec-tm +0 -1
- data/rvmrc +0 -1
- data/spec/.DS_Store +0 -0
- data/spec/Active_spec.rb +0 -28
- data/spec/activeworks_spec.rb +0 -60
- data/spec/activity_spec.rb +0 -421
- data/spec/ats_spec.rb +0 -106
- data/spec/benchmark/search_bench.rb +0 -55
- data/spec/custom_matchers_spec.rb +0 -27
- data/spec/gsa_spec.rb +0 -210
- data/spec/reg_spec.rb +0 -173
- data/spec/search_memcached_spec.rb +0 -42
- data/spec/validators_spec.rb +0 -19
- data/test/test_Active.rb +0 -0
- data/version.txt +0 -1
data/spec/ats_spec.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
# Require the spec helper relative to this file
|
2
|
-
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
|
-
require File.join(File.dirname(__FILE__), %w[custom_matchers_spec])
|
4
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services search])
|
5
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
|
6
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services ats])
|
7
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services address])
|
8
|
-
include Active::Services
|
9
|
-
|
10
|
-
describe ATS do
|
11
|
-
before(:each) do
|
12
|
-
# @valid_id = "A9EF9D79-F859-4443-A9BB-91E1833DF2D5"
|
13
|
-
@valid_id="61BB7D71-EC01-46B8-A601-38CA1C9AE893"
|
14
|
-
@reg_center_id = "D9A22F33-8A14-4175-8D5B-D11578212A98"
|
15
|
-
end
|
16
|
-
it "should set find by id" do
|
17
|
-
a = ATS.find_by_id(@valid_id)
|
18
|
-
a.asset_id.should == @valid_id
|
19
|
-
end
|
20
|
-
it "should get the asset_type_id" do
|
21
|
-
ATS.find_by_id(@valid_id).asset_type_id.should_not be_nil
|
22
|
-
end
|
23
|
-
it "should thorw an ATSError if no record is found" do
|
24
|
-
lambda { ATS.find_by_id( "666" ) }.should raise_error(ATSError)
|
25
|
-
end
|
26
|
-
it "should get the asset metadata" do
|
27
|
-
ATS.get_asset_metadata(@valid_id).should_not be_nil
|
28
|
-
end
|
29
|
-
it "should load the asset metadata into @data" do
|
30
|
-
a = ATS.find_by_id(@valid_id)
|
31
|
-
a.load_metadata
|
32
|
-
a.data["isSearchable"].should_not be_nil
|
33
|
-
end
|
34
|
-
it "should load the lazy the asset metadata" do
|
35
|
-
a = ATS.find_by_id(@valid_id)
|
36
|
-
puts a.url
|
37
|
-
a.start_date.should_not be_nil
|
38
|
-
end
|
39
|
-
# works differently in current implementation
|
40
|
-
# it "should only load metadata once" do
|
41
|
-
# a = ATS.find_by_id(@valid_id)
|
42
|
-
# puts a.url
|
43
|
-
# puts a.address
|
44
|
-
# ATS.should_receive(:load_metadata).once
|
45
|
-
# end
|
46
|
-
it "should have an address Hash" do
|
47
|
-
a = ATS.find_by_id(@valid_id)
|
48
|
-
a.address.should be_an_instance_of(HashWithIndifferentAccess)
|
49
|
-
end
|
50
|
-
it "should have address data" do
|
51
|
-
r = ATS.new({"trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1819585&assetId=61BB7D71-EC01-46B8-A601-38CA1C9AE893", "contactName"=>"DSE Runners", "city"=>"San Francisco", "substitutionUrl"=>"1819585", "assetId"=>"61BB7D71-EC01-46B8-A601-38CA1C9AE893", "destinationID"=>"", "latitude"=>"37.77029", "location"=>"Lindley Meadow near Spreckles Lake", "userCommentText"=>nil, "zip"=>"94117", "category"=>"Activities", "dma"=>"San Francisco - Oakland - San Jose", "participationCriteria"=>"Adult", "country"=>"United States", "searchWeight"=>"1", "isSearchable"=>"true", "image1"=>"http://www.active.com/images/events/hotrace.gif", "row"=>"1", "contactPhone"=>"415-978-0837", "startDate"=>"2010-09-12", "market"=>"San Francisco - Oakland - San Jose", "avgUserRating"=>nil, "onlineDonationAvailable"=>"0", "seourl"=>"http://www.active.com/running/san-francisco-ca/speedway-meadow-cross-country-4m-2010", "channel"=>["Running", "Running\\Cross Country"], "assetName"=>"Speedway Meadow Cross Country 4M", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "longitude"=>"-122.4411", "eventResults"=>nil, "contactEmail"=>"dserunclub@aol.com", "endTime"=>"9:00:00", "startTime"=>"9:00:00", "mediaType"=>"Event", "onlineMembershipAvailable"=>"0", "onlineRegistrationAvailable"=>"true", "endDate"=>"2010-09-12", "eventURL"=>"http://www.dserunners.com", "estParticipants"=>"175", "state"=>"California"})
|
52
|
-
puts r.address.inspect
|
53
|
-
r.address["name"].should eql("Lindley Meadow near Spreckles Lake")
|
54
|
-
r.address["address"].should be_nil
|
55
|
-
r.address["city"].should eql("San Francisco")
|
56
|
-
r.address["state"].should eql("California")
|
57
|
-
r.address["zip"].should eql("94117")
|
58
|
-
r.address["lat"].should eql("37.77029")
|
59
|
-
r.address["lng"].should eql("-122.4411")
|
60
|
-
r.address["country"].should eql("United States")
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should nil empty data" do
|
64
|
-
r = ATS.new({"trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1819585&assetId=61BB7D71-EC01-46B8-A601-38CA1C9AE893", "contactName"=>"DSE Runners", "city"=>"San Francisco", "substitutionUrl"=>"1819585", "assetId"=>"61BB7D71-EC01-46B8-A601-38CA1C9AE893", "destinationID"=>"", "latitude"=>"37.77029", "location"=>" ", "userCommentText"=>nil, "zip"=>"94117", "category"=>"Activities", "dma"=>"San Francisco - Oakland - San Jose", "participationCriteria"=>"Adult", "country"=>"United States", "searchWeight"=>"1", "isSearchable"=>"true", "image1"=>"http://www.active.com/images/events/hotrace.gif", "row"=>"1", "contactPhone"=>"415-978-0837", "startDate"=>"2010-09-12", "market"=>"San Francisco - Oakland - San Jose", "avgUserRating"=>nil, "onlineDonationAvailable"=>"0", "seourl"=>"http://www.active.com/running/san-francisco-ca/speedway-meadow-cross-country-4m-2010", "channel"=>["Running", "Running\\Cross Country"], "assetName"=>"Speedway Meadow Cross Country 4M", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "longitude"=>"-122.4411", "eventResults"=>nil, "contactEmail"=>"dserunclub@aol.com", "endTime"=>"9:00:00", "startTime"=>"9:00:00", "mediaType"=>"Event", "onlineMembershipAvailable"=>"0", "onlineRegistrationAvailable"=>"true", "endDate"=>"2010-09-12", "eventURL"=>"http://www.dserunners.com", "estParticipants"=>"175", "state"=>"California"})
|
65
|
-
r.address["name"].should be_nil
|
66
|
-
end
|
67
|
-
it "should nil bad zip code data" do
|
68
|
-
r = ATS.new({"trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1819585&assetId=61BB7D71-EC01-46B8-A601-38CA1C9AE893", "contactName"=>"DSE Runners", "city"=>"San Francisco", "substitutionUrl"=>"1819585", "assetId"=>"61BB7D71-EC01-46B8-A601-38CA1C9AE893", "destinationID"=>"", "latitude"=>"37.77029", "location"=>"Lindley Meadow near Spreckles Lake", "userCommentText"=>nil, "zip"=>"94117-123456", "category"=>"Activities", "dma"=>"San Francisco - Oakland - San Jose", "participationCriteria"=>"Adult", "country"=>"United States", "searchWeight"=>"1", "isSearchable"=>"true", "image1"=>"http://www.active.com/images/events/hotrace.gif", "row"=>"1", "contactPhone"=>"415-978-0837", "startDate"=>"2010-09-12", "market"=>"San Francisco - Oakland - San Jose", "avgUserRating"=>nil, "onlineDonationAvailable"=>"0", "seourl"=>"http://www.active.com/running/san-francisco-ca/speedway-meadow-cross-country-4m-2010", "channel"=>["Running", "Running\\Cross Country"], "assetName"=>"Speedway Meadow Cross Country 4M", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "longitude"=>"-122.4411", "eventResults"=>nil, "contactEmail"=>"dserunclub@aol.com", "endTime"=>"9:00:00", "startTime"=>"9:00:00", "mediaType"=>"Event", "onlineMembershipAvailable"=>"0", "onlineRegistrationAvailable"=>"true", "endDate"=>"2010-09-12", "eventURL"=>"http://www.dserunners.com", "estParticipants"=>"175", "state"=>"California"})
|
69
|
-
r.address["zip"].should be_nil
|
70
|
-
end
|
71
|
-
|
72
|
-
it "should fix state abbreviations" do
|
73
|
-
r = ATS.new({"trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1819585&assetId=61BB7D71-EC01-46B8-A601-38CA1C9AE893", "contactName"=>"DSE Runners", "city"=>"San Francisco", "substitutionUrl"=>"1819585", "assetId"=>"61BB7D71-EC01-46B8-A601-38CA1C9AE893", "destinationID"=>"", "latitude"=>"37.77029", "location"=>"Lindley Meadow near Spreckles Lake", "userCommentText"=>nil, "zip"=>"94117", "category"=>"Activities", "dma"=>"San Francisco - Oakland - San Jose", "participationCriteria"=>"Adult", "country"=>"United States", "searchWeight"=>"1", "isSearchable"=>"true", "image1"=>"http://www.active.com/images/events/hotrace.gif", "row"=>"1", "contactPhone"=>"415-978-0837", "startDate"=>"2010-09-12", "market"=>"San Francisco - Oakland - San Jose", "avgUserRating"=>nil, "onlineDonationAvailable"=>"0", "seourl"=>"http://www.active.com/running/san-francisco-ca/speedway-meadow-cross-country-4m-2010", "channel"=>["Running", "Running\\Cross Country"], "assetName"=>"Speedway Meadow Cross Country 4M", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "longitude"=>"-122.4411", "eventResults"=>nil, "contactEmail"=>"dserunclub@aol.com", "endTime"=>"9:00:00", "startTime"=>"9:00:00", "mediaType"=>"Event", "onlineMembershipAvailable"=>"0", "onlineRegistrationAvailable"=>"true", "endDate"=>"2010-09-12", "eventURL"=>"http://www.dserunners.com", "estParticipants"=>"175", "state"=>"CA"})
|
74
|
-
r.address["state"].should eql "California"
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should have a nil user email" do
|
78
|
-
r = ATS.new({"trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1819585&assetId=61BB7D71-EC01-46B8-A601-38CA1C9AE893", "contactName"=>"DSE Runners", "city"=>"San Francisco", "substitutionUrl"=>"1819585", "assetId"=>"61BB7D71-EC01-46B8-A601-38CA1C9AE893", "destinationID"=>"", "latitude"=>"37.77029", "location"=>" ", "userCommentText"=>nil, "zip"=>"94117", "category"=>"Activities", "dma"=>"San Francisco - Oakland - San Jose", "participationCriteria"=>"Adult", "country"=>"United States", "searchWeight"=>"1", "isSearchable"=>"true", "image1"=>"http://www.active.com/images/events/hotrace.gif", "row"=>"1", "contactPhone"=>"415-978-0837", "startDate"=>"2010-09-12", "market"=>"San Francisco - Oakland - San Jose", "avgUserRating"=>nil, "onlineDonationAvailable"=>"0", "seourl"=>"http://www.active.com/running/san-francisco-ca/speedway-meadow-cross-country-4m-2010", "channel"=>["Running", "Running\\Cross Country"], "assetName"=>"Speedway Meadow Cross Country 4M", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "longitude"=>"-122.4411", "eventResults"=>nil, "endTime"=>"9:00:00", "startTime"=>"9:00:00", "mediaType"=>"Event", "onlineMembershipAvailable"=>"0", "onlineRegistrationAvailable"=>"true", "endDate"=>"2010-09-12", "eventURL"=>"http://www.dserunners.com", "estParticipants"=>"175", "state"=>"California"})
|
79
|
-
r.user.email.should be_nil
|
80
|
-
end
|
81
|
-
it "should have a nil user email when the email is not valid" do
|
82
|
-
r = ATS.new({"trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1819585&assetId=61BB7D71-EC01-46B8-A601-38CA1C9AE893", "contactName"=>"DSE Runners", "city"=>"San Francisco", "substitutionUrl"=>"1819585", "assetId"=>"61BB7D71-EC01-46B8-A601-38CA1C9AE893", "destinationID"=>"", "latitude"=>"37.77029", "location"=>" ", "userCommentText"=>nil, "zip"=>"94117", "category"=>"Activities", "dma"=>"San Francisco - Oakland - San Jose", "participationCriteria"=>"Adult", "country"=>"United States", "searchWeight"=>"1", "isSearchable"=>"true", "image1"=>"http://www.active.com/images/events/hotrace.gif", "row"=>"1", "contactPhone"=>"415-978-0837", "startDate"=>"2010-09-12", "market"=>"San Francisco - Oakland - San Jose", "avgUserRating"=>nil, "onlineDonationAvailable"=>"0", "seourl"=>"http://www.active.com/running/san-francisco-ca/speedway-meadow-cross-country-4m-2010", "channel"=>["Running", "Running\\Cross Country"], "assetName"=>"Speedway Meadow Cross Country 4M", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "longitude"=>"-122.4411", "eventResults"=>nil, "contactPhone"=>"dserunclubaolcom", "endTime"=>"9:00:00", "startTime"=>"9:00:00", "mediaType"=>"Event", "onlineMembershipAvailable"=>"0", "onlineRegistrationAvailable"=>"true", "endDate"=>"2010-09-12", "eventURL"=>"http://www.dserunners.com", "estParticipants"=>"175", "state"=>"California"})
|
83
|
-
r.user.email.should be_nil
|
84
|
-
end
|
85
|
-
it "should have a valid user email" do
|
86
|
-
r = ATS.new({"trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1819585&assetId=61BB7D71-EC01-46B8-A601-38CA1C9AE893", "contactName"=>"DSE Runners", "city"=>"San Francisco", "substitutionUrl"=>"1819585", "assetId"=>"61BB7D71-EC01-46B8-A601-38CA1C9AE893", "destinationID"=>"", "latitude"=>"37.77029", "location"=>" ", "userCommentText"=>nil, "zip"=>"94117", "category"=>"Activities", "dma"=>"San Francisco - Oakland - San Jose", "participationCriteria"=>"Adult", "country"=>"United States", "searchWeight"=>"1", "isSearchable"=>"true", "image1"=>"http://www.active.com/images/events/hotrace.gif", "row"=>"1", "contactPhone"=>"415-978-0837", "startDate"=>"2010-09-12", "market"=>"San Francisco - Oakland - San Jose", "avgUserRating"=>nil, "onlineDonationAvailable"=>"0", "seourl"=>"http://www.active.com/running/san-francisco-ca/speedway-meadow-cross-country-4m-2010", "channel"=>["Running", "Running\\Cross Country"], "assetName"=>"Speedway Meadow Cross Country 4M", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "longitude"=>"-122.4411", "eventResults"=>nil, "contactEmail"=>"dserunclub@aol.com", "endTime"=>"9:00:00", "startTime"=>"9:00:00", "mediaType"=>"Event", "onlineMembershipAvailable"=>"0", "onlineRegistrationAvailable"=>"true", "endDate"=>"2010-09-12", "eventURL"=>"http://www.dserunners.com", "estParticipants"=>"175", "state"=>"California"})
|
87
|
-
r.user.email.should eql("dserunclub@aol.com")
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
it "should have a startDate Date" do
|
92
|
-
a = ATS.find_by_id(@valid_id)
|
93
|
-
puts a.start_date.class
|
94
|
-
a.start_date.should be_an_instance_of(DateTime)
|
95
|
-
end
|
96
|
-
it "should have a title String" do
|
97
|
-
a = ATS.find_by_id(@valid_id)
|
98
|
-
a.title.should be_an_instance_of(String)
|
99
|
-
end
|
100
|
-
##########
|
101
|
-
it "should have an address" do
|
102
|
-
a = ATS.new('<importSource><asset row="1" destinationID=""><isSearchable>true</isSearchable><assetTypeId>FB27C928-54DB-4ECD-B42F-482FC3C8681F</assetTypeId><substitutionUrl>vistarecreation/registrationmain.sdi?source=showAsset.sdi&activity_id=4900</substitutionUrl><assetName>Zumba Punch Card (Adult) - Oct. (5)</assetName><category>Activities</category><channel>Community Services</channel><mediaType>Class</mediaType><searchWeight>1</searchWeight><summary>People of all ages are falling in love with Zumba, one of the fastest growing dance-based fitness crazes in the country. With Zumbas easy-to-follow dance moves you receive body beautifying benefits while enjoying Latin rhythms including Salsa, Meringue, Cumbia, Reggaeton, even belly dance and hip-hop. Zumba is sure to put the fun back into your work outs!</summary><zip>92084</zip><city>Vista</city><state>California</state><country>United States of America</country><startDate>2010-10-02</startDate><onlineRegistrationAvailable>false</onlineRegistrationAvailable><tags>2348.321</tags><assetId>3ae995d9-5c16-4176-b44e-fa0577644ca4</assetId><trackbackurl>http://www.active.com/page/event_details_an.htm?type=activenet&subUrl=vistarecreation/registrationmain.sdi?source=showAsset.sdi&activity_id=4900</trackbackurl><seourl>http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010</seourl><dma>San Diego</dma><longitude>-117.2425355</longitude><latitude>33.2000368</latitude></asset></importSource>')
|
103
|
-
a.data.should_not be_nil
|
104
|
-
end
|
105
|
-
|
106
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. lib Active]))
|
2
|
-
include Active::Services
|
3
|
-
|
4
|
-
# Benchmark.bm(700) do |x|
|
5
|
-
# x.report("string:") { Search.new({:keywords => "running,swimming,yoga"}) }
|
6
|
-
# x.report("array:") { Search.new({:keywords => %w(running swimming yoga)}) }
|
7
|
-
# x.report("Array:") { Search.new({:keywords => ["running","swimming","yoga"]}) }
|
8
|
-
# end
|
9
|
-
|
10
|
-
# arr = []
|
11
|
-
# Search.search(:num_results => 100, :page => 1).results.each do |a|
|
12
|
-
# match = (a.user.email == a.ats.contact_email)
|
13
|
-
# email = "--"
|
14
|
-
# if a.primary_source
|
15
|
-
# email = a.primary_source.user.email
|
16
|
-
# end
|
17
|
-
# arr << "#{a.asset_id}"
|
18
|
-
# arr << " GSA= #{a.user.email} ATS= #{a.ats.user.email} #{a.primary_source}=> #{email} "
|
19
|
-
# end
|
20
|
-
# puts " "
|
21
|
-
# puts " "
|
22
|
-
# puts " "
|
23
|
-
# puts " "
|
24
|
-
# puts " "
|
25
|
-
# puts arr
|
26
|
-
|
27
|
-
# puts Search.search(:asset_ids => ["DD8F427F-6188-465B-8C26-71BBA22D2DB7"]).results.inspect
|
28
|
-
|
29
|
-
REG_CENTER_ASSET_TYPE_ID = "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65"
|
30
|
-
REG_CENTER_ASSET_TYPE_ID2 = "3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6"
|
31
|
-
ACTIVE_WORKS_ASSET_TYPE_ID = "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1"
|
32
|
-
|
33
|
-
local_asset_type_id = "EC6E96A5-6900-4A0E-8B83-9AA935F45A73"
|
34
|
-
# puts "Local " + Search.search({:asset_type_id => local_asset_type_id}).results.length.to_s
|
35
|
-
|
36
|
-
# loc = Search.search({:facet => "", :asset_type_id => local_asset_type_id, :start_date => Date.new(2008, 1, 1), :end_date => Date.new(2012, 11, 15) })
|
37
|
-
# loc = Search.search({:facet => "", :url => "local.active.com", :start_date => Date.new(2000, 1, 1), :end_date => Date.new(2019, 11, 15) })
|
38
|
-
# loc = Search.search({:facet => "", :url => "local.active.com"})
|
39
|
-
|
40
|
-
# puts "Local " + loc.results.length.to_s
|
41
|
-
# puts loc.results.collect { |r| "#{r.origin} #{r.title} #{r.url}" }
|
42
|
-
|
43
|
-
|
44
|
-
# puts "ActiveWorks " + Search.search({:asset_type_id => ACTIVE_WORKS_ASSET_TYPE_ID, :start_date => Date.new(2010, 1, 1), :end_date => Date.new(2011, 11, 15) }).results.length.to_s
|
45
|
-
|
46
|
-
# url = "www.active.com/running/long-branch-nj/new-jersey-marathon-and-long-branch-half-marathon-2011"
|
47
|
-
# r = Search.search({:url => url}).results # , :start_date => Date.new(2011, 1, 1), :end_date => Date.new(2012, 1, 15)
|
48
|
-
# puts url
|
49
|
-
# puts "Results: #{r.length}"
|
50
|
-
# puts r.map(&:url)
|
51
|
-
|
52
|
-
|
53
|
-
s = Search.search({:bounding_box=>{:sw=>"36.893089,-123.533684", :ne=>"38.8643,-121.208199"}, :facet=>"", :end_date=>"+", :page=>1, :num_results=>10, :sort=>"date_asc", :start_date=>"today", :split_media_type=>nil})
|
54
|
-
puts s.numberOfResults
|
55
|
-
# puts r.map(&:url)
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module CustomMatchers
|
2
|
-
|
3
|
-
class Param
|
4
|
-
def initialize(expected)
|
5
|
-
@expected = expected
|
6
|
-
end
|
7
|
-
|
8
|
-
def matches?(actual)
|
9
|
-
@actual = actual
|
10
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
11
|
-
@actual.include?(@expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
def failure_message_for_should
|
15
|
-
"expected #{@actual.inspect} to have param #{@expected.inspect}, but it didn't"
|
16
|
-
end
|
17
|
-
|
18
|
-
def failure_message_for_should_not
|
19
|
-
"expected #{@actual.inspect} not to have param #{@expected.inspect}, but it did"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def have_param(expected)
|
24
|
-
Param.new(expected)
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
data/spec/gsa_spec.rb
DELETED
@@ -1,210 +0,0 @@
|
|
1
|
-
# Require the spec helper relative to this file
|
2
|
-
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
|
-
require File.join(File.dirname(__FILE__), %w[custom_matchers_spec])
|
4
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services search])
|
5
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
|
6
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services reg_center])
|
7
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services address])
|
8
|
-
include Active::Services
|
9
|
-
# EFF92D9D-D487-4FBD-A879-38B3D3BBC8CD
|
10
|
-
describe GSA do
|
11
|
-
before(:each) do
|
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
|
-
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
|
23
|
-
it "should have asset ids" do
|
24
|
-
@a.asset_id.should_not be_nil
|
25
|
-
@a.asset_type_id.should_not be_nil
|
26
|
-
end
|
27
|
-
# TITLE
|
28
|
-
it "should have a clean title" do
|
29
|
-
@a.title.should_not be_nil
|
30
|
-
@a.title.should eql("2011 Rohto Ironman 70.3 California")
|
31
|
-
end
|
32
|
-
it "should have a clean title" do
|
33
|
-
g = GSA.new(JSON.parse('{"title":"2011 Rohto Ironman 70.3 California\u003cb\u003e...\u003c/b\u003e | Oceanside, California \u003cb\u003e...\u003c/b\u003e"}'))
|
34
|
-
g.title.should eql("2011 Rohto Ironman 70.3 California")
|
35
|
-
g = GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}'))
|
36
|
-
g.title.should eql("Calabasas Classic 2010 - 5k 10k Runs")
|
37
|
-
end
|
38
|
-
it "should have a nil title" do
|
39
|
-
GSA.new({}).title.should be_nil
|
40
|
-
end
|
41
|
-
# start date
|
42
|
-
it "should have a valid start date" do
|
43
|
-
@a.start_date.should_not be_nil
|
44
|
-
@a.start_date.should be_an_instance_of(DateTime)
|
45
|
-
end
|
46
|
-
it "should have nil is no date" do
|
47
|
-
g = GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}'))
|
48
|
-
g.start_date.should be_nil
|
49
|
-
end
|
50
|
-
# end date
|
51
|
-
it "should have a valid end date" do
|
52
|
-
@a.end_date.should_not be_nil
|
53
|
-
@a.end_date.should be_an_instance_of(DateTime)
|
54
|
-
end
|
55
|
-
it "should have nil is no date" do
|
56
|
-
g = GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}'))
|
57
|
-
g.end_date.should be_nil
|
58
|
-
end
|
59
|
-
# start time
|
60
|
-
it "should have a valid start date" do
|
61
|
-
@a.start_time.should_not be_nil
|
62
|
-
@a.start_time.should be_an_instance_of(DateTime)
|
63
|
-
end
|
64
|
-
it "should have a valid start date when data has meta.startDate" do
|
65
|
-
g = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/community-services-class/belmont-ca/modern-teen-adult-2010","language":"en","title":"Modern - Teen Adult | Belmont, CA, 94002 |","url":"http://www.active.com/community-services-class/belmont-ca/modern-teen-adult-2010","summary":"active espn. Active Home | Directory | Community | eteamz | Results | Support |\u003cbr\u003e Event Directors \u0026amp; Organizers. Active.com. New beta search! \u003cb\u003e...\u003c/b\u003e ","meta":{"summary":"Barefoot dance with emphasis on floor work, release technique, and partnering. Emotion and story line are core elements in this class. Attire is loose fitting clothing any style or color.","startDate":"2010-11-03","tag":"class:10","state":"California","splitMediaType":"Class","lastModifiedDateTime":"2010-09-08 16:32:50.49","mediaType":"Class","city":"Belmont","assetId":"b06cbfb8-ff63-488c-92c6-d060680cc208","description":"","longitude":"-122.2758","substitutionUrl":"belmontparksandrecreation/registrationmain.sdi?source\u003dshowAsset.sdi\u0026activity_id\u003d3722","tags":"1510.306","assetName":"Modern - Teen Adult","zip":"94002","sortDate":"2000-11-03","keywords":"","dma":"San Francisco - Oakland - San Jose","trackbackurl":"http://www.active.com/community-services-class/belmont-ca/modern-teen-adult-2010","seourl":"http://www.active.com/community-services-class/belmont-ca/modern-teen-adult-2010","country":"United States of America","onlineRegistrationAvailable":"true","category":"Activities","assetTypeId":"FB27C928-54DB-4ECD-B42F-482FC3C8681F","lastModifiedDate":"2010-09-08","UpdateDateTime":"8/20/2008 9:03:50 AM","latitude":"37.52021","channel":"Community Services"}}'))
|
66
|
-
g.start_time.should_not be_nil
|
67
|
-
g.start_time.should eql(DateTime.parse("Wed, 03 Nov 2010 00:00:00"))
|
68
|
-
end
|
69
|
-
it "should have nil is no date" do
|
70
|
-
g = GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}'))
|
71
|
-
g.start_time.should be_nil
|
72
|
-
end
|
73
|
-
# end time
|
74
|
-
it "should have a valid end date" do
|
75
|
-
@a.start_time.should_not be_nil
|
76
|
-
@a.start_time.should be_an_instance_of(DateTime)
|
77
|
-
end
|
78
|
-
it "should have nil is no date" do
|
79
|
-
g = GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}'))
|
80
|
-
g.start_time.should be_nil
|
81
|
-
end
|
82
|
-
it "should have an asset_id" do
|
83
|
-
GSA.new().asset_id.should be_nil
|
84
|
-
@a.asset_id.should_not be_nil
|
85
|
-
end
|
86
|
-
it "should have an asset_type_id" do
|
87
|
-
GSA.new().asset_type_id.should be_nil
|
88
|
-
@a.asset_type_id.should_not be_nil
|
89
|
-
end
|
90
|
-
# substitutionUrl
|
91
|
-
it "should have an id for substitutionUrl" do
|
92
|
-
@a.substitutionUrl.should eql("1838902")
|
93
|
-
g = GSA.new(JSON.parse('{"title":"Calabasas", "meta":{"substitutionUrl":"vistarecreation/registrationmain.sdi?source=showAsset.sdi&activity_id=4900"}}'))
|
94
|
-
g.substitutionUrl.should eql("4900")
|
95
|
-
end
|
96
|
-
# bounding_box
|
97
|
-
it "should raise an error with a bad bounding box" do
|
98
|
-
lambda {s = Search.search({ :bounding_box => { :sw => "37.695141,-123.013657"}}) }.should raise_error(RuntimeError)
|
99
|
-
end
|
100
|
-
it "should search a bounding box String" do
|
101
|
-
s = Search.search({ :bounding_box => { :sw => "37.695141,-123.013657", :ne => "37.832371,-122.356979"}})
|
102
|
-
r = s.results.first
|
103
|
-
r.address["city"].should eql("San Francisco")
|
104
|
-
end
|
105
|
-
it "should search a bounding box Hash" do
|
106
|
-
s = Search.search({ :bounding_box => { :sw => [37.695141, -123.013657], :ne => [37.832371,-122.356979] }})
|
107
|
-
r = s.results.first
|
108
|
-
r.address["city"].should eql("San Francisco")
|
109
|
-
end
|
110
|
-
# address
|
111
|
-
it "should have a full address" do
|
112
|
-
g = GSA.new(JSON.parse('{"title":"Calabasas", "meta":{"location":"Oceanside Harbor","eventLongitude":"-117.3586","locationName":"Oceanside Harbor","eventAddress":"1540 Harbor Drive North", "city":"San Diego", "eventState":"CA", "eventZip":"92121", "latitude":"-22", "longitude":"222", "country":"USA" }}'))
|
113
|
-
g.address.should_not be_nil
|
114
|
-
g.address[:name].should eql("Oceanside Harbor")
|
115
|
-
g.address[:address].should eql("1540 Harbor Drive North")
|
116
|
-
g.address[:city].should eql("San Diego")
|
117
|
-
g.address[:state].should eql("CA")
|
118
|
-
g.address[:zip].should eql("92121")
|
119
|
-
g.address[:country].should eql("USA")
|
120
|
-
g.address[:lat].should eql("-22")
|
121
|
-
g.address[:lng].should eql("222")
|
122
|
-
end
|
123
|
-
it "should have a partial address" do
|
124
|
-
g = GSA.new(JSON.parse('{"language":"en", "title":"Zumba Punch Card (Adult) - Oct. (5) | Vista, CA, 92084 |", "url":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "escapedUrl":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "meta":{"city":"Vista", "assetId":"3ae995d9-5c16-4176-b44e-fa0577644ca4", "substitutionUrl":"vistarecreation/registrationmain.sdi?source=showAsset.sdi&activity_id=4900", "trackbackurl":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "onlineRegistrationAvailable":"false", "zip":"92084", "sortDate":"2000-10-02", "category":"Activities", "latitude":"33.2000368", "dma":"San Diego", "lastModifiedDate":"2010-09-29", "tags":"2348.321", "lastModifiedDateTime":"2010-09-29 16:46:43.33", "country":"United States of America", "startDate":"2010-10-02", "assetName":"Zumba Punch Card (Adult) - Oct. (5)", "summary":"People of all ages are falling in love with Zumba, one of the fastest growing dance-based fitness crazes in the country. With Zumbas easy-to-follow dance moves you receive body beautifying benefits while enjoying Latin rhythms including Salsa, Meringue, Cumbia, Reggaeton, even belly dance and hip-hop. Zumba is ", "description":"", "seourl":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "channel":"Community Services", "splitMediaType":"Class", "mediaType":"Class", "longitude":"-117.2425355", "UpdateDateTime":"8/20/2008 9:03:50 AM", "assetTypeId":"FB27C928-54DB-4ECD-B42F-482FC3C8681F", "state":"California", "keywords":""}, "summary":""}'))
|
125
|
-
g.address[:name].should be_nil
|
126
|
-
g.address[:address].should be_nil
|
127
|
-
g.address[:city].should eql("Vista")
|
128
|
-
g.address[:state].should eql("California")
|
129
|
-
g.address[:zip].should eql("92084")
|
130
|
-
g.address[:country].should eql("United States of America")
|
131
|
-
g.address[:lat].should eql("33.2000368")
|
132
|
-
g.address[:lng].should eql("-117.2425355")
|
133
|
-
end
|
134
|
-
it "should have a address.address" do
|
135
|
-
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":"Cycling"}}'))
|
136
|
-
|
137
|
-
g.address[:address].should eql("San Francisco Bay")
|
138
|
-
g.address[:name].should eql("San Francisco Bay")
|
139
|
-
g.address[:lat].should eql("37.78")
|
140
|
-
g.address[:zip].should eql("94101")
|
141
|
-
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","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":"Cycling"}}'))
|
142
|
-
g.address[:address].should be_nil
|
143
|
-
end
|
144
|
-
it "should have an address from this hash with null name and address" do
|
145
|
-
g = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/cycling/san-francisco-ca/california-wine-country-bike-tours-in-october-2010","language":"en","title":"2010 California Wine Country Bike Tours in October | San \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/cycling/san-francisco-ca/california-wine-country-bike-tours-in-october-2010","summary":"","meta":{"startDate":"2010-10-10","eventDate":"2010-10-10T00:00:00-07:00","state":"California","endDate":"2010-10-22","eventLongitude":"-122.4200000","lastModifiedDateTime":"2010-08-26 02:15:54.36","splitMediaType":"Event","endTime":"0:00:00","mediaType":"Event","city":"San Francisco","google-site-verification":"","estParticipants":"2000","startTime":"0:00:00","assetId":["81A4A089-CAB5-4293-BFBF-87C74A1C6370","81a4a089-cab5-4293-bfbf-87c74a1c6370"],"eventId":"1889827","participationCriteria":"All","description":"","longitude":"-122.4200000","onlineDonationAvailable":"0","substitutionUrl":"1889827","assetName":["2010 California Wine Country Bike Tours in October","2010 California Wine Country Bike Tours in October"],"eventURL":"http://www.trektravel.com/contentpage.cfm?ID\u003d703","zip":"94101","contactPhone":"866-464-8735","eventLatitude":"37.7800000","eventState":"California","sortDate":"2000-10-10","keywords":"Event","onlineMembershipAvailable":"0","dma":"San Francisco - Oakland - San Jose","trackbackurl":"http://www.active.com/cycling/san-francisco-ca/california-wine-country-bike-tours-in-october-2010","seourl":"http://www.active.com/cycling/san-francisco-ca/california-wine-country-bike-tours-in-october-2010","country":"United States","onlineRegistrationAvailable":"0","category":"Activities","market":"San Francisco - Oakland - San Jose","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate":"2010-08-26","eventZip":"94101","UpdateDateTime":"8/18/2010 10:16:26 AM","latitude":"37.7800000","channel":"Cycling"}}'))
|
146
|
-
g.address[:name].should be_nil
|
147
|
-
g.address[:address].should be_nil
|
148
|
-
g.address[:city].should eql("San Francisco")
|
149
|
-
g.address[:state].should eql("California")
|
150
|
-
g.address[:zip].should eql("94101")
|
151
|
-
g.address[:country].should eql("United States")
|
152
|
-
g.address[:lat].should eql("37.7800000")
|
153
|
-
g.address[:lng].should eql("-122.4200000")
|
154
|
-
end
|
155
|
-
it "should have an address from this hash" do
|
156
|
-
g = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/running/san-francisco-ca/nike-womens-marathon-2010","language":"en","title":"Nike Women\u0026#39;s Marathon | San Francisco, California 94102 \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/running/san-francisco-ca/nike-womens-marathon-2010","summary":"","meta":{"startDate":"2010-10-17","eventDate":"2010-10-17T07:00:00-07:00","location":"Union Square","tag":["event:10","Running:10"],"state":"California","eventLongitude":"-122.4212","endDate":"2010-10-17","lastModifiedDateTime":"2010-10-01 21:04:24.977","splitMediaType":["Event","Marathon"],"locationName":"Union Square","endTime":"7:00:00","mediaType":["Event","Event\\Marathon"],"city":"San Francisco","google-site-verification":"","estParticipants":"2000","startTime":"7:00:00","assetId":["715ED4EF-E4FF-42F2-B24B-2E4255649676","715ed4ef-e4ff-42f2-b24b-2e4255649676"],"eventId":"1854168","participationCriteria":"All","description":"","longitude":"-122.4212","onlineDonationAvailable":"0","substitutionUrl":"1854168","assetName":["Nike Womens Marathon","Nike Womens Marathon"],"eventURL":"http://inside.nike.com/blogs/nikerunning_events-en_US/?tags\u003dnike_womens_marathon_2010","zip":"94102","contactPhone":"866-786-6453","eventState":"California","sortDate":"2000-10-17","eventLatitude":"37.77869","keywords":"Event","onlineMembershipAvailable":"0","dma":"San Francisco - Oakland - San Jose","trackbackurl":"http://www.active.com/running/san-francisco-ca/nike-womens-marathon-2010","seourl":"http://www.active.com/running/san-francisco-ca/nike-womens-marathon-2010","country":"United States","onlineRegistrationAvailable":"false","category":"Activities","market":"San Francisco - Oakland - San Jose","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate":"2010-10-01","eventZip":"94102","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"37.77869","channel":"Running"}}'))
|
157
|
-
g.address[:name].should eql("Union Square")
|
158
|
-
g.address[:address].should eql("Union Square")
|
159
|
-
g.address[:city].should eql("San Francisco")
|
160
|
-
g.address[:state].should eql("California")
|
161
|
-
g.address[:zip].should eql("94102")
|
162
|
-
g.address[:country].should eql("United States")
|
163
|
-
g.address[:lat].should eql("37.77869")
|
164
|
-
g.address[:lng].should eql("-122.4212")
|
165
|
-
end
|
166
|
-
# USER
|
167
|
-
it "should have a nil user email" do
|
168
|
-
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","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","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":"Cycling"}}'))
|
169
|
-
g.user.email.should be_nil
|
170
|
-
end
|
171
|
-
it "should have a nil user email" do
|
172
|
-
g = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/running/san-francisco-ca/nike-womens-marathon-2010","language":"en","title":"Nike Women\u0026#39;s Marathon | San Francisco, California 94102 \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/running/san-francisco-ca/nike-womens-marathon-2010","summary":"","meta":{"startDate":"2010-10-17","eventDate":"2010-10-17T07:00:00-07:00","location":"Union Square","tag":["event:10","Running:10"],"state":"California","eventLongitude":"-122.4212","endDate":"2010-10-17","lastModifiedDateTime":"2010-10-01 21:04:24.977","splitMediaType":["Event","Marathon"],"locationName":"Union Square","endTime":"7:00:00","mediaType":["Event","Event\\Marathon"],"city":"San Francisco","google-site-verification":"","estParticipants":"2000","startTime":"7:00:00","assetId":["715ED4EF-E4FF-42F2-B24B-2E4255649676","715ed4ef-e4ff-42f2-b24b-2e4255649676"],"eventId":"1854168","participationCriteria":"All","description":"","longitude":"-122.4212","onlineDonationAvailable":"0","substitutionUrl":"1854168","assetName":["Nike Women\'s Marathon","Nike Women\'s Marathon"],"eventURL":"http://inside.nike.com/blogs/nikerunning_events-en_US/?tags\u003dnike_womens_marathon_2010","zip":"94102","contactPhone":"866-786-6453","eventState":"California","sortDate":"2000-10-17","eventLatitude":"37.77869","keywords":"Event","onlineMembershipAvailable":"0","dma":"San Francisco - Oakland - San Jose","trackbackurl":"http://www.active.com/running/san-francisco-ca/nike-womens-marathon-2010","seourl":"http://www.active.com/running/san-francisco-ca/nike-womens-marathon-2010","country":"United States","onlineRegistrationAvailable":"false","category":"Activities","market":"San Francisco - Oakland - San Jose","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate":"2010-10-01","eventZip":"94102","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"37.77869","channel":"Running"}}'))
|
173
|
-
g.user.email.should be_nil
|
174
|
-
end
|
175
|
-
it "should have a nil user email when the email is not valid" do
|
176
|
-
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","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":"eventfaf.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":"Cycling"}}'))
|
177
|
-
g.user.email.should be_nil
|
178
|
-
end
|
179
|
-
it "should have a valid user email" do
|
180
|
-
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","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","contactName":"joe","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate":"2010-10-04","eventZip":"94101","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"37.78","channel":"Cycling"}}'))
|
181
|
-
g.user.first_name.should eql("joe")
|
182
|
-
end
|
183
|
-
it "should have a valid first and last name" do
|
184
|
-
g = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/baseball-league/santee-ca/8th-annual-fall-baseball-classic-8s16s-2010","language":"en","title":"\u003cb\u003e8th Annual Fall Baseball Classic\u003c/b\u003e (\u003cb\u003e8\u0026#39;S\u003c/b\u003e-\u003cb\u003e16\u0026#39;S\u003c/b\u003e) | Santee \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/baseball-league/santee-ca/8th-annual-fall-baseball-classic-8s16s-2010","summary":"\u003cb\u003e...\u003c/b\u003e \u003cb\u003e8th Annual Fall Baseball Classic\u003c/b\u003e (\u003cb\u003e8\u0026#39;S\u003c/b\u003e-\u003cb\u003e16\u0026#39;S\u003c/b\u003e). \u003cb\u003e...\u003c/b\u003e Similar \u003cb\u003eBaseball\u003c/b\u003e Events. \u003cb\u003eFalls\u003c/b\u003e Little\u003cbr\u003e League - 2011 Season \u003cb\u003eFall\u003c/b\u003e City, Washington Mon, Feb 28, 2011. \u003cb\u003e...\u003c/b\u003e ","meta":{"startDate":"2010-10-02","eventDate":"2010-10-02T00:00:00-07:00","location":"Santee- SportsPlex","state":"California","endDate":"2010-10-03","eventLongitude":"-116.997","locationName":"Santee- SportsPlex","splitMediaType":"League","lastModifiedDateTime":"2010-10-03 03:13:09.84","endTime":"0:00:00","mediaType":"League","google-site-verification":"","city":"Santee","estParticipants":"2000","startTime":"0:00:00","assetId":["9FA03B5C-C1F4-4A92-BDE1-533BC219CB2D","9fa03b5c-c1f4-4a92-bde1-533bc219cb2d"],"eventId":"1879121","participationCriteria":"All","description":"","longitude":"-116.997","onlineDonationAvailable":"0","substitutionUrl":"1879121","assetName":["8th Annual Fall Baseball Classic (8\'S-16\'S)","8th Annual Fall Baseball Classic (8\'S-16\'S)"],"zip":"92071","contactPhone":"951-789-2065","eventLatitude":"32.86787","eventState":"California","sortDate":"2000-10-02","keywords":"Event","eventAddress":"9951 Riverwalk Drive","contactEmail":"brandon@tripecrownsocal.com","onlineMembershipAvailable":"0","dma":"San Diego","trackbackurl":"http://www.active.com/baseball-league/santee-ca/8th-annual-fall-baseball-classic-8s16s-2010","seourl":"http://www.active.com/baseball-league/santee-ca/8th-annual-fall-baseball-classic-8s16s-2010","country":"United States","onlineRegistrationAvailable":"false","category":"Activities","market":"San Diego","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","contactName":"Brandon Burns","lastModifiedDate":"2010-10-03","eventZip":"92071","latitude":"32.86787","UpdateDateTime":"9/22/2010 11:46:24 AM","channel":"Baseball"}}'))
|
185
|
-
g.user.first_name.should eql("Brandon")
|
186
|
-
g.user.last_name.should eql("Burns")
|
187
|
-
end
|
188
|
-
it "should have a valid first and last name" do
|
189
|
-
g = GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/baseball-league/santee-ca/8th-annual-fall-baseball-classic-8s16s-2010","language":"en","title":"\u003cb\u003e8th Annual Fall Baseball Classic\u003c/b\u003e (\u003cb\u003e8\u0026#39;S\u003c/b\u003e-\u003cb\u003e16\u0026#39;S\u003c/b\u003e) | Santee \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/baseball-league/santee-ca/8th-annual-fall-baseball-classic-8s16s-2010","summary":"\u003cb\u003e...\u003c/b\u003e \u003cb\u003e8th Annual Fall Baseball Classic\u003c/b\u003e (\u003cb\u003e8\u0026#39;S\u003c/b\u003e-\u003cb\u003e16\u0026#39;S\u003c/b\u003e). \u003cb\u003e...\u003c/b\u003e Similar \u003cb\u003eBaseball\u003c/b\u003e Events. \u003cb\u003eFalls\u003c/b\u003e Little\u003cbr\u003e League - 2011 Season \u003cb\u003eFall\u003c/b\u003e City, Washington Mon, Feb 28, 2011. \u003cb\u003e...\u003c/b\u003e ","meta":{"startDate":"2010-10-02","eventDate":"2010-10-02T00:00:00-07:00","location":"Santee- SportsPlex","state":"California","endDate":"2010-10-03","eventLongitude":"-116.997","locationName":"Santee- SportsPlex","splitMediaType":"League","lastModifiedDateTime":"2010-10-03 03:13:09.84","endTime":"0:00:00","mediaType":"League","google-site-verification":"","city":"Santee","estParticipants":"2000","startTime":"0:00:00","assetId":["9FA03B5C-C1F4-4A92-BDE1-533BC219CB2D","9fa03b5c-c1f4-4a92-bde1-533bc219cb2d"],"eventId":"1879121","participationCriteria":"All","description":"","longitude":"-116.997","onlineDonationAvailable":"0","substitutionUrl":"1879121","assetName":["8th Annual Fall Baseball Classic (8\'S-16\'S)","8th Annual Fall Baseball Classic (8\'S-16\'S)"],"zip":"92071","contactPhone":"951-789-2065","eventLatitude":"32.86787","eventState":"California","sortDate":"2000-10-02","keywords":"Event","eventAddress":"9951 Riverwalk Drive","contactEmail":"brandon@tripecrownsocal.com","onlineMembershipAvailable":"0","dma":"San Diego","trackbackurl":"http://www.active.com/baseball-league/santee-ca/8th-annual-fall-baseball-classic-8s16s-2010","seourl":"http://www.active.com/baseball-league/santee-ca/8th-annual-fall-baseball-classic-8s16s-2010","country":"United States","onlineRegistrationAvailable":"false","category":"Activities","market":"San Diego","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","contactName":"City of San Diego","lastModifiedDate":"2010-10-03","eventZip":"92071","latitude":"32.86787","UpdateDateTime":"9/22/2010 11:46:24 AM","channel":"Baseball"}}'))
|
190
|
-
g.user.first_name.should eql("City")
|
191
|
-
g.user.last_name.should eql("of San Diego")
|
192
|
-
end
|
193
|
-
it "should have a valid first and last name" do
|
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"}}'))
|
195
|
-
g.user.first_name.should eql("Buzz")
|
196
|
-
g.user.last_name.should eql("Ayola# (ED_Use this one)")
|
197
|
-
g.title.should eql("Primo's Run for Education")
|
198
|
-
end
|
199
|
-
it "should pull primary category from seo url" do
|
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"}}'))
|
201
|
-
g.primary_category.should eql("Cycling")
|
202
|
-
end
|
203
|
-
|
204
|
-
end
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
data/spec/reg_spec.rb
DELETED
@@ -1,173 +0,0 @@
|
|
1
|
-
# Require the spec helper relative to this file
|
2
|
-
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
|
-
require File.join(File.dirname(__FILE__), %w[custom_matchers_spec])
|
4
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services search])
|
5
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
|
6
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services reg_center])
|
7
|
-
include Active::Services
|
8
|
-
|
9
|
-
describe RegCenter do
|
10
|
-
before(:each) do
|
11
|
-
# @valid_id = "1802851"
|
12
|
-
@valid_id = "1877942"
|
13
|
-
# @valid_id = "1889826"
|
14
|
-
# @valid_id = "1847738"
|
15
|
-
# <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><getAssetMetadataResponse xmlns="http://api.asset.services.active.com"><out xmlns="http://api.asset.services.active.com"><importSource><asset row="1" destinationID=""><isSearchable>true</isSearchable><assetId>BF304447-0052-4466-A044-68D1459C5068</assetId><assetTypeId>EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65</assetTypeId><substitutionUrl>1886328</substitutionUrl><assetName>Excellence in Writing</assetName><category>Activities</category><channel>Not Specified</channel><mediaType>Recware Activities</mediaType><searchWeight>1</searchWeight><zip>92027</zip><city>Escondido</city><state>California</state><country>United States</country><startDate>2010-09-07</startDate><startTime>15:30:00</startTime><endDate>2010-09-07</endDate><endTime>15:30:00</endTime><participationCriteria>All</participationCriteria><onlineRegistrationAvailable>true</onlineRegistrationAvailable><onlineDonationAvailable>0</onlineDonationAvailable><onlineMembershipAvailable>0</onlineMembershipAvailable><avgUserRating/><userCommentText/><image1>http://www.active.com/images/events/hotrace.gif</image1><contactEmail>recreation@escondido.org</contactEmail><contactPhone>760-839-4691</contactPhone><eventResults/><location>Grove Room - East Valley Community Center</location><contactName>Escondido Community Services Department</contactName><market>San Diego</market><trackbackurl>http://www.active.com/page/Event_Details.htm?event_id=1886328&amp;assetId=BF304447-0052-4466-A044-68D1459C5068</trackbackurl><seourl>http://www.active.com/not-specified-recware-activities/escondido-ca/excellence-in-writing-2010</seourl><dma>San Diego</dma><longitude>-117.0864</longitude><latitude>33.11921</latitude></asset></importSource></out></getAssetMetadataResponse></soap:Body></soap:Envelope>
|
16
|
-
|
17
|
-
end
|
18
|
-
it "should create a new regCenter class" do
|
19
|
-
r = RegCenter.new(Hash.from_xml('<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <event> <assetID>5c6fa2f2-0434-4d6c-953d-cab9bade4f64</assetID> <eventID>1877942</eventID> <eventName>Realistic Drawing (6-12 Yrs.)</eventName> <eventDate>2010-09-16T15:30:00-07:00</eventDate> <eventTime>3:30 PM</eventTime> <eventLocation>Arts & Crafts Room - Nick Rodriguez Community Center</eventLocation> <eventAddress>213 "F" Street</eventAddress> <eventCity>Antioch</eventCity> <eventState>California</eventState> <eventZip>94509</eventZip> <eventCountry>USA</eventCountry> <eventDescription>Do you love to draw?Learn how to make your drawings more realistic with projects that focus on observation,proportion,perspective,composition,light and shadow and texture.Media will include pencil,pen,charcoal,and pastel.A &10 materials fee is payable to the instuctor at the first class.</eventDescription> <usatSanctioned>false</usatSanctioned> <regOnline>true</regOnline> <eventCloseDate>2010-09-16T00:00:00-07:00</eventCloseDate> <currencyCode>USD</currencyCode> <eventTypeID>1</eventTypeID> <eventType>Recware Activities</eventType> <hasEventResults>false</hasEventResults> <hasMetaResults>false</hasMetaResults> <showMap>true</showMap> <longitude>-121.8058</longitude> <latitude>38.00492</latitude> <eventContactEmail>dadams@ci.antioch.ca.us</eventContactEmail> <eventContactPhone>925-779-7070</eventContactPhone> <displayCloseDate>true</displayCloseDate> <excludedFromEmailing>false</excludedFromEmailing> <category>Activities</category> <mediaTypes> <mediaType>Recware Activities</mediaType> </mediaTypes> <channels> <channel> <primaryChannel>false</primaryChannel> </channel> </channels> <eventCategories/> <eventDetails> <eventDetail> <eventDetailsName>Ages</eventDetailsName> <eventDetailsOrder>1</eventDetailsOrder> <eventDetailsValue>6 years - 12 years 11months</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Instructor</eventDetailsName> <eventDetailsOrder>2</eventDetailsOrder> <eventDetailsValue>Nancy Roberts</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Code</eventDetailsName> <eventDetailsOrder>3</eventDetailsOrder> <eventDetailsValue>1447.401</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Classification</eventDetailsName> <eventDetailsOrder>4</eventDetailsOrder> <eventDetailsValue>Art</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Schedule</eventDetailsName> <eventDetailsOrder>5</eventDetailsOrder> <eventDetailsValue>Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM</eventDetailsValue> </eventDetail> </eventDetails> <eventDonationLinks/> <eventSanctions/> <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1877942</eventDetailsPageUrl> <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1877942</eventContactUrl> </event>'))
|
20
|
-
r.title.should eql("Realistic Drawing (6-12 Yrs.)")
|
21
|
-
end
|
22
|
-
it "should have an address Hash" do
|
23
|
-
r = RegCenter.new(Hash.from_xml('<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <event> <assetID>5c6fa2f2-0434-4d6c-953d-cab9bade4f64</assetID> <eventID>1877942</eventID> <eventName>Realistic Drawing (6-12 Yrs.)</eventName> <eventDate>2010-09-16T15:30:00-07:00</eventDate> <eventTime>3:30 PM</eventTime> <eventLocation>Arts & Crafts Room - Nick Rodriguez Community Center</eventLocation> <eventAddress>213 "F" Street</eventAddress> <eventCity>Antioch</eventCity> <eventState>California</eventState> <eventZip>94509</eventZip> <eventCountry>USA</eventCountry> <eventDescription>Do you love to draw?Learn how to make your drawings more realistic with projects that focus on observation,proportion,perspective,composition,light and shadow and texture.Media will include pencil,pen,charcoal,and pastel.A &10 materials fee is payable to the instuctor at the first class.</eventDescription> <usatSanctioned>false</usatSanctioned> <regOnline>true</regOnline> <eventCloseDate>2010-09-16T00:00:00-07:00</eventCloseDate> <currencyCode>USD</currencyCode> <eventTypeID>1</eventTypeID> <eventType>Recware Activities</eventType> <hasEventResults>false</hasEventResults> <hasMetaResults>false</hasMetaResults> <showMap>true</showMap> <longitude>-121.8058</longitude> <latitude>38.00492</latitude> <eventContactEmail>dadams@ci.antioch.ca.us</eventContactEmail> <eventContactPhone>925-779-7070</eventContactPhone> <displayCloseDate>true</displayCloseDate> <excludedFromEmailing>false</excludedFromEmailing> <category>Activities</category> <mediaTypes> <mediaType>Recware Activities</mediaType> </mediaTypes> <channels> <channel> <primaryChannel>false</primaryChannel> </channel> </channels> <eventCategories/> <eventDetails> <eventDetail> <eventDetailsName>Ages</eventDetailsName> <eventDetailsOrder>1</eventDetailsOrder> <eventDetailsValue>6 years - 12 years 11months</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Instructor</eventDetailsName> <eventDetailsOrder>2</eventDetailsOrder> <eventDetailsValue>Nancy Roberts</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Code</eventDetailsName> <eventDetailsOrder>3</eventDetailsOrder> <eventDetailsValue>1447.401</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Classification</eventDetailsName> <eventDetailsOrder>4</eventDetailsOrder> <eventDetailsValue>Art</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Schedule</eventDetailsName> <eventDetailsOrder>5</eventDetailsOrder> <eventDetailsValue>Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM</eventDetailsValue> </eventDetail> </eventDetails> <eventDonationLinks/> <eventSanctions/> <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1877942</eventDetailsPageUrl> <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1877942</eventContactUrl> </event>'))
|
24
|
-
r.address.should be_an_instance_of(HashWithIndifferentAccess)
|
25
|
-
end
|
26
|
-
it "should have address data" do
|
27
|
-
r = RegCenter.new(Hash.from_xml('<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <event> <assetID>5c6fa2f2-0434-4d6c-953d-cab9bade4f64</assetID> <eventID>1877942</eventID> <eventName>Realistic Drawing (6-12 Yrs.)</eventName> <eventDate>2010-09-16T15:30:00-07:00</eventDate> <eventTime>3:30 PM</eventTime> <eventLocation>Arts & Crafts Room - Nick Rodriguez Community Center</eventLocation> <eventAddress>213 "F" Street</eventAddress> <eventCity>Antioch</eventCity> <eventState>California</eventState> <eventZip>94509</eventZip> <eventCountry>USA</eventCountry> <eventDescription>Do you love to draw?Learn how to make your drawings more realistic with projects that focus on observation,proportion,perspective,composition,light and shadow and texture.Media will include pencil,pen,charcoal,and pastel.A &10 materials fee is payable to the instuctor at the first class.</eventDescription> <usatSanctioned>false</usatSanctioned> <regOnline>true</regOnline> <eventCloseDate>2010-09-16T00:00:00-07:00</eventCloseDate> <currencyCode>USD</currencyCode> <eventTypeID>1</eventTypeID> <eventType>Recware Activities</eventType> <hasEventResults>false</hasEventResults> <hasMetaResults>false</hasMetaResults> <showMap>true</showMap> <longitude>-121.8058</longitude> <latitude>38.00492</latitude> <eventContactEmail>dadams@ci.antioch.ca.us</eventContactEmail> <eventContactPhone>925-779-7070</eventContactPhone> <displayCloseDate>true</displayCloseDate> <excludedFromEmailing>false</excludedFromEmailing> <category>Activities</category> <mediaTypes> <mediaType>Recware Activities</mediaType> </mediaTypes> <channels> <channel> <primaryChannel>false</primaryChannel> </channel> </channels> <eventCategories/> <eventDetails> <eventDetail> <eventDetailsName>Ages</eventDetailsName> <eventDetailsOrder>1</eventDetailsOrder> <eventDetailsValue>6 years - 12 years 11months</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Instructor</eventDetailsName> <eventDetailsOrder>2</eventDetailsOrder> <eventDetailsValue>Nancy Roberts</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Code</eventDetailsName> <eventDetailsOrder>3</eventDetailsOrder> <eventDetailsValue>1447.401</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Classification</eventDetailsName> <eventDetailsOrder>4</eventDetailsOrder> <eventDetailsValue>Art</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Schedule</eventDetailsName> <eventDetailsOrder>5</eventDetailsOrder> <eventDetailsValue>Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM</eventDetailsValue> </eventDetail> </eventDetails> <eventDonationLinks/> <eventSanctions/> <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1877942</eventDetailsPageUrl> <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1877942</eventContactUrl> </event>'))
|
28
|
-
r.address["name"].should eql "Arts & Crafts Room - Nick Rodriguez Community Center"
|
29
|
-
r.address["address"].should eql "213 \"F\" Street"
|
30
|
-
r.address["city"].should eql "Antioch"
|
31
|
-
r.address["state"].should eql "California"
|
32
|
-
r.address["zip"].should eql "94509"
|
33
|
-
r.address["lat"].should eql "38.00492"
|
34
|
-
r.address["lng"].should eql "-121.8058"
|
35
|
-
r.address["country"].should eql "USA"
|
36
|
-
end
|
37
|
-
it "should have an address Hash" do
|
38
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress>Almaden Blvd & Santa Clara Street</eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>California</eventState>\n <eventZip>95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactEmail>rnrsj@eliteracing.com</eventContactEmail>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
39
|
-
r.address.should be_an_instance_of(HashWithIndifferentAccess)
|
40
|
-
end
|
41
|
-
it "should have address data" do
|
42
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress>Almaden Blvd & Santa Clara Street</eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>California</eventState>\n <eventZip>95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactEmail>rnrsj@eliteracing.com</eventContactEmail>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
43
|
-
r.address["name"].should eql "Downtown"
|
44
|
-
r.address["address"].should eql "Almaden Blvd & Santa Clara Street"
|
45
|
-
r.address["city"].should eql "San Jose"
|
46
|
-
r.address["state"].should eql "California"
|
47
|
-
r.address["zip"].should eql "95192"
|
48
|
-
r.address["lat"].should eql "37.3359"
|
49
|
-
r.address["lng"].should eql "-121.8818"
|
50
|
-
r.address["country"].should eql "USA"
|
51
|
-
end
|
52
|
-
it "should nil empty address data" do
|
53
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress> </eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>California</eventState>\n <eventZip>x95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactEmail>rnrsj@eliteracing.com</eventContactEmail>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
54
|
-
r.address["address"].should be_nil
|
55
|
-
end
|
56
|
-
it "should nil bad zip code data" do
|
57
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress> </eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>California</eventState>\n <eventZip>x95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactEmail>rnrsj@eliteracing.com</eventContactEmail>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
58
|
-
r.address["zip"].should be_nil
|
59
|
-
end
|
60
|
-
it "should fix state abbreviations" do
|
61
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress> </eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>CA</eventState>\n <eventZip>x95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactEmail>rnrsj@eliteracing.com</eventContactEmail>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
62
|
-
r.address["state"].should eql "California"
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should have a nil user email" do
|
66
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress> </eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>CA</eventState>\n <eventZip>x95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
67
|
-
r.user.email.should be_nil
|
68
|
-
end
|
69
|
-
it "should have a nil user email" do
|
70
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress> </eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>CA</eventState>\n <eventZip>x95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
71
|
-
r.user.email.should be_nil
|
72
|
-
end
|
73
|
-
it "should have a nil user email when the email is not valid" do
|
74
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress> </eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>CA</eventState>\n <eventZip>x95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactEmail>rnrsjeliteracingcom</eventContactEmail>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
75
|
-
r.user.email.should be_nil
|
76
|
-
end
|
77
|
-
it "should have a valid user email" do
|
78
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress> </eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>California</eventState>\n <eventZip>x95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactEmail>rnrsj@eliteracing.com</eventContactEmail>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
79
|
-
r.user.email.should eql("rnrsj@eliteracing.com")
|
80
|
-
end
|
81
|
-
|
82
|
-
# it "should get asset metadata" do
|
83
|
-
# a = RegCenter.get_asset_metadata(@valid_id)
|
84
|
-
# a.should be_valid
|
85
|
-
# end
|
86
|
-
|
87
|
-
it "should set find by id" do
|
88
|
-
a = RegCenter.find_by_id(@valid_id)
|
89
|
-
a.data.should_not be_nil
|
90
|
-
a.title.should eql("Realistic Drawing (6-12 Yrs.)")
|
91
|
-
end
|
92
|
-
it "should set the asset_type_id" do
|
93
|
-
RegCenter.find_by_id(@valid_id).asset_type_id.should_not be_nil
|
94
|
-
end
|
95
|
-
it "should thorw an RegCenterError if no record is found" do
|
96
|
-
lambda { RegCenter.find_by_id( "666" ) }.should raise_error(RegCenterError)
|
97
|
-
end
|
98
|
-
it "should get the API metadata" do
|
99
|
-
a = RegCenter.find_by_id(@valid_id)
|
100
|
-
a.data["event"].should_not be_nil
|
101
|
-
end
|
102
|
-
it "should have a desc String" do
|
103
|
-
a = RegCenter.find_by_id(@valid_id)
|
104
|
-
a.desc.should be_an_instance_of(String)
|
105
|
-
end
|
106
|
-
it "should cleanup title" do
|
107
|
-
a = RegCenter.find_by_id(@valid_id)
|
108
|
-
a.title.should_not include("\r")
|
109
|
-
end
|
110
|
-
# it "should have a primary category" do
|
111
|
-
# a = RegCenter.find_by_id(@valid_id)
|
112
|
-
# puts a.primary_category
|
113
|
-
# a.primary_category.should_not be_nil
|
114
|
-
# end
|
115
|
-
it "should have a title String" do
|
116
|
-
a = RegCenter.find_by_id(@valid_id)
|
117
|
-
a.title.should be_an_instance_of(String)
|
118
|
-
end
|
119
|
-
it "should have a categories array" do
|
120
|
-
a = RegCenter.find_by_id(@valid_id)
|
121
|
-
puts a.categories.inspect
|
122
|
-
a.categories.should be_an_instance_of(Array)
|
123
|
-
end
|
124
|
-
# it "should have a category" do
|
125
|
-
# a = RegCenter.find_by_id(@valid_id)
|
126
|
-
# a.category.should be_an_instance_of(String)
|
127
|
-
# end
|
128
|
-
it "should have a start_date DateTime" do
|
129
|
-
a = RegCenter.find_by_id(@valid_id)
|
130
|
-
puts a.start_date
|
131
|
-
a.start_date.should be_an_instance_of(DateTime)
|
132
|
-
end
|
133
|
-
it "should have a start_time DateTime" do
|
134
|
-
a = RegCenter.find_by_id(@valid_id)
|
135
|
-
a.start_time.should be_an_instance_of(DateTime)
|
136
|
-
end
|
137
|
-
|
138
|
-
it "should have a valid eventURL" do
|
139
|
-
r = RegCenter.new(Hash.from_xml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<event>\n <assetID>7e39ceb4-cebb-471f-ace3-21f697ae9e55</assetID>\n <eventID>1802851</eventID>\n <eventName>Rock 'n' Roll San Jose Half Marathon</eventName>\n <eventDate>2010-10-03T08:00:00-07:00</eventDate>\n <eventTime>08:00 am</eventTime>\n <eventLocation>Downtown</eventLocation>\n <eventAddress>Almaden Blvd & Santa Clara Street</eventAddress>\n <eventCity>San Jose</eventCity>\n <eventState>California</eventState>\n <eventZip>95192</eventZip>\n <eventCountry>USA</eventCountry>\n <briefDescription>Registration Fees:* \t \n<p> \n1/2 Marathon \n<p> \n * $85.00 \342\200\223 October 2009- July 31, 2010<br> \n * $100.00 \342\200\223 August 1, 2010- September 26<br> \n * $120.00 \342\200\223 Expo Price<br> \n<p> \n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION</briefDescription>\n <usatSanctioned>false</usatSanctioned>\n <regOnline>false</regOnline>\n <currencyCode>USD</currencyCode>\n <eventTypeID>7</eventTypeID>\n <eventType>Event, Race</eventType>\n <hasEventResults>false</hasEventResults>\n <hasMetaResults>true</hasMetaResults>\n <showMap>true</showMap>\n <longitude>-121.8818</longitude>\n <latitude>37.3359</latitude>\n <eventContactEmail>rnrsj@eliteracing.com</eventContactEmail>\n <eventContactPhone>800-311-1255</eventContactPhone>\n <displayCloseDate>true</displayCloseDate>\n <excludedFromEmailing>false</excludedFromEmailing>\n <metaEventName>Rock 'n' Roll Half Marathon</metaEventName>\n <metaEventID>98616</metaEventID>\n <category>Activities</category>\n <mediaTypes>\n <mediaType>Event</mediaType>\n <mediaType>Event\\Half Marathon</mediaType>\n <mediaType>=difficulty:Advanced</mediaType>\n <mediaType>=difficulty:Beginner</mediaType>\n <mediaType>=difficulty:Intermediate</mediaType>\n </mediaTypes>\n <metaEvents>\n <event>\n <assetID>a401eaf3-6087-4dd2-822c-635a7ae45e74</assetID>\n <eventID>1614834</eventID>\n <eventName>Rock 'n' Roll Half Marathon - San Jose</eventName>\n <eventDate>2009-10-04T08:00:00-07:00</eventDate>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1614834</eventDetailsPageUrl>\n </event>\n </metaEvents>\n <channels>\n <channel>\n <channelName>Running</channelName>\n <primaryChannel>true</primaryChannel>\n </channel>\n </channels>\n <eventCategories/>\n <eventDetails>\n <eventDetail>\n <eventDetailsName>Online Registration Closes</eventDetailsName>\n <eventDetailsOrder>1</eventDetailsOrder>\n <eventDetailsValue>Sunday, September 26, 2010</eventDetailsValue>\n </eventDetail>\n </eventDetails>\n <eventDonationLinks/>\n <eventSanctions/>\n <eventUrl>http://san-jose.competitor.com</eventUrl>\n <resultsUrl>http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851</resultsUrl>\n <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1802851</eventDetailsPageUrl>\n <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1802851</eventContactUrl>\n <eventImageUrl>http://www.active.com/images/upimages/1802851.jpg</eventImageUrl>\n</event>\n"))
|
140
|
-
r.event_url.should eql("http://san-jose.competitor.com")
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should have a valid content" do
|
144
|
-
r = RegCenter.new(Hash.from_xml('<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <event> <assetID>5c6fa2f2-0434-4d6c-953d-cab9bade4f64</assetID> <eventID>1877942</eventID> <eventName>Realistic Drawing (6-12 Yrs.)</eventName> <eventDate>2010-09-16T15:30:00-07:00</eventDate> <eventTime>3:30 PM</eventTime> <eventLocation>Arts & Crafts Room - Nick Rodriguez Community Center</eventLocation> <eventAddress>213 "F" Street</eventAddress> <eventCity>Antioch</eventCity> <eventState>California</eventState> <eventZip>94509</eventZip> <eventCountry>USA</eventCountry> <eventDescription>Do you love to draw?Learn how to make your drawings more realistic with projects that focus on observation,proportion,perspective,composition,light and shadow and texture.Media will include pencil,pen,charcoal,and pastel.A &10 materials fee is payable to the instuctor at the first class.</eventDescription> <usatSanctioned>false</usatSanctioned> <regOnline>true</regOnline> <eventCloseDate>2010-09-16T00:00:00-07:00</eventCloseDate> <currencyCode>USD</currencyCode> <eventTypeID>1</eventTypeID> <eventType>Recware Activities</eventType> <hasEventResults>false</hasEventResults> <hasMetaResults>false</hasMetaResults> <showMap>true</showMap> <longitude>-121.8058</longitude> <latitude>38.00492</latitude> <eventContactEmail>dadams@ci.antioch.ca.us</eventContactEmail> <eventContactPhone>925-779-7070</eventContactPhone> <displayCloseDate>true</displayCloseDate> <excludedFromEmailing>false</excludedFromEmailing> <category>Activities</category> <mediaTypes> <mediaType>Recware Activities</mediaType> </mediaTypes> <channels> <channel> <primaryChannel>false</primaryChannel> </channel> </channels> <eventCategories/> <eventDetails> <eventDetail> <eventDetailsName>Ages</eventDetailsName> <eventDetailsOrder>1</eventDetailsOrder> <eventDetailsValue>6 years - 12 years 11months</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Instructor</eventDetailsName> <eventDetailsOrder>2</eventDetailsOrder> <eventDetailsValue>Nancy Roberts</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Code</eventDetailsName> <eventDetailsOrder>3</eventDetailsOrder> <eventDetailsValue>1447.401</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Classification</eventDetailsName> <eventDetailsOrder>4</eventDetailsOrder> <eventDetailsValue>Art</eventDetailsValue> </eventDetail> <eventDetail> <eventDetailsName>Schedule</eventDetailsName> <eventDetailsOrder>5</eventDetailsOrder> <eventDetailsValue>Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM</eventDetailsValue> </eventDetail> </eventDetails> <eventDonationLinks/> <eventSanctions/> <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1877942</eventDetailsPageUrl> <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1877942</eventContactUrl> </event>'))
|
145
|
-
r.content.should be_an_instance_of(Array)
|
146
|
-
r.content[0][:title].should eql("Ages")
|
147
|
-
r.content[1][:title].should eql("Instructor")
|
148
|
-
r.content[2][:title].should eql("Code")
|
149
|
-
r.content[3][:title].should eql("Classification")
|
150
|
-
r.content[4][:title].should eql("Schedule")
|
151
|
-
|
152
|
-
r.content[0][:content].should eql("6 years - 12 years 11months")
|
153
|
-
r.content[1][:content].should eql("Nancy Roberts")
|
154
|
-
r.content[2][:content].should eql("1447.401")
|
155
|
-
r.content[3][:content].should eql("Art")
|
156
|
-
r.content[4][:content].should eql("Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM")
|
157
|
-
end
|
158
|
-
|
159
|
-
it "should handle not having extra content" do
|
160
|
-
r = RegCenter.new(Hash.from_xml('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><event> <assetID>396e12ba-d496-4d3c-ad76-4ac581ac7628</assetID> <eventID>1893115</eventID> <eventName>San Francisco Halloween Run & Walk for Schools</eventName> <eventDate>2010-10-31T08:30:00-07:00</eventDate> <eventTime>Mile starts 8:30 AM, 5K starts 9 AM</eventTime> <eventLocation>John F. Kennedy Drive at Middle Drive in Golden Gate Park.</eventLocation> <eventCity>San Francisco</eventCity> <eventState>California</eventState> <eventZip>94117</eventZip> <eventCountry>USA</eventCountry> <briefDescription>Both the 5K and mile are USATF Certified distances that visit some of Golden Gate Park’s best views. <b>The Jefferson Mile is the 2010 RRCA California State Championship Mile. It Starts 8:30 AM</b>. <b>The 5K is flat and fast with a couple of easy hills and Starts 9 AM on JFK, East of the Conservatory of Flowers. Certified Maps at PeopleEvents.org</b></briefDescription> <eventDescription>Awards 3 deep in all divisions 8 & under to 80+ Prizes for winners, top pledge collector and random drawing. We feature online Finish Videos and post downloadable Finish Line Photos.</eventDescription> <usatSanctioned>false</usatSanctioned> <regOnline>true</regOnline> <eventCloseDate>2010-10-30T11:59:00-07:00</eventCloseDate> <eventFees>5K or Mile: $25 includes T-shirt until 10/19, $30 after<p>Combo (Mile & 5K): $30 until 10/19, $35 after<p>Kids 12 & under w/t-shirt: $15 until 10/19</eventFees> <currencyCode>USD</currencyCode> <eventTypeID>7</eventTypeID> <eventType>Event, Race</eventType> <hasEventResults>false</hasEventResults> <hasMetaResults>false</hasMetaResults> <showMap>false</showMap> <longitude>-122.4438929</longitude> <latitude>37.7717185</latitude> <eventContactEmail>Bill_Dake@peopleevents.org</eventContactEmail> <eventContactPhone>650 291-8531</eventContactPhone> <displayCloseDate>true</displayCloseDate> <excludedFromEmailing>false</excludedFromEmailing> <category>Activities</category> <mediaTypes> <mediaType>Event</mediaType> <mediaType>Event\1 mile</mediaType> <mediaType>Event\5K</mediaType> </mediaTypes> <channels> <channel> <channelName>Running</channelName> <primaryChannel>true</primaryChannel> </channel> </channels> <eventCategories/> <eventDetails> <eventDetail> <eventDetailsName>Event Flyer</eventDetailsName> <eventDetailsOrder>1</eventDetailsOrder> <eventDetailsValue><a href=http://www.eteamz.com/activeactive1/files/0913halloweenentryv5-new.pdf> Click Here to View Event Flyer</a></eventDetailsValue> </eventDetail> </eventDetails> <eventDonationLinks> <eventDonationLink> <eventDonationLinkID>158285</eventDonationLinkID> <eventDonationLinkTitle>SF Halloween Run & Walk for Schools</eventDonationLinkTitle> <eventDonationLinkUrl>http://www.active.com/donate/sfrunwalkforschools</eventDonationLinkUrl> </eventDonationLink> </eventDonationLinks> <eventSanctions/> <eventUrl>http://www.PeopleEvents.org</eventUrl> <eventDetailsPageUrl>http://www.active.com/page/Event_Details.htm?event_id=1893115</eventDetailsPageUrl> <eventContactUrl>http://www.active.com/event_contact.cfm?event_id=1893115</eventContactUrl> <eventImageUrl>http://www.active.com/images/upimages/halloween10_blk.jpg</eventImageUrl></event>'))
|
161
|
-
r.content.should be_an_instance_of(Array)
|
162
|
-
r.content[0][:title].should eql("Event Flyer")
|
163
|
-
r.content[0][:content].should eql("<a href=http://www.eteamz.com/activeactive1/files/0913halloweenentryv5-new.pdf> Click Here to View Event Flyer</a>")
|
164
|
-
end
|
165
|
-
|
166
|
-
it "should have an event_image_url" do
|
167
|
-
r = RegCenter.find_by_id("1917437")
|
168
|
-
r.event_image_url.should eql("http://www.active.com/images/upimages/2642.gif")
|
169
|
-
end
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
end
|