Active 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
data/.bnsignore ADDED
@@ -0,0 +1,19 @@
1
+ # The list of files that should be ignored by Mr Bones.
2
+ # Lines that start with '#' are comments.
3
+ #
4
+ # A .gitignore file can be used instead by setting it as the ignore
5
+ # file in your Rakefile:
6
+ #
7
+ # Bones {
8
+ # ignore_file '.gitignore'
9
+ # }
10
+ #
11
+ # For a project with a C extension, the following would be a good set of
12
+ # exclude patterns (uncomment them if you want to use them):
13
+ # *.[oa]
14
+ # *~
15
+ announcement.txt
16
+ coverage
17
+ doc
18
+ pkg
19
+ .DS_Store
data/bin/Active CHANGED
File without changes
@@ -0,0 +1,215 @@
1
+ require 'digest/sha1'
2
+ module Active
3
+ module Services
4
+
5
+ class ATSError < StandardError; end
6
+
7
+ class ATS < IActivity
8
+
9
+ attr_reader :metadata_loaded
10
+ # EXAMPLE Data hash
11
+ # {"destinationID"=>"", "assetId"=>"A9EF9D79-F859-4443-A9BB-91E1833DF2D5", "substitutionUrl"=>"1878023", "city"=>"Antioch", "contactName"=>"City of Antioch", "trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1878023&assetId=A9EF9D79-F859-4443-A9BB-91E1833DF2D5", "category"=>"Activities", "zip"=>"94531", "userCommentText"=>nil, "location"=>"Multi-use Room (prewett) - Prewett Family Park & Center", "latitude"=>"37.95761", :asset_id=>"A9EF9D79-F859-4443-A9BB-91E1833DF2D5", "searchWeight"=>"1", "country"=>"United States", "participationCriteria"=>"All", "dma"=>"San Francisco - Oakland - San Jose", "isSearchable"=>"true", :asset_name=>"Fitness, Pilates Mat Class (16 Yrs. &amp; Up)", :substitution_url=>"1878023", :asset_type_id=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "row"=>"1", "image1"=>"http://www.active.com/images/events/hotrace.gif", "startDate"=>"2010-09-13", "contactPhone"=>"925-779-7070", :asset_type_name=>"Active.com Event Registration", "onlineDonationAvailable"=>"0", "avgUserRating"=>nil, "market"=>"San Francisco - Oakland - San Jose", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "assetName"=>"Fitness, Pilates Mat Class (16 Yrs. & Up)", "channel"=>"Not Specified", "seourl"=>"http://www.active.com/not-specified-recware-activities/antioch-ca/fitness-pilates-mat-class-16-yrs-and-up-2010", :xmlns=>"http://api.asset.services.active.com", :url=>"http://www.active.com/page/Event_Details.htm?event_id=1878023", "mediaType"=>"Recware Activities", "startTime"=>"18:15:00", "endTime"=>"18:15:00", "contactEmail"=>"dadams@ci.antioch.ca.us", "eventResults"=>nil, "longitude"=>"-121.7936", "endDate"=>"2010-09-13", "onlineRegistrationAvailable"=>"true", "onlineMembershipAvailable"=>"0", "state"=>"California"}
12
+ # {"destinationID"=>"", "assetId"=>"D9A22F33-8A14-4175-8D5B-D11578212A98", "substitutionUrl"=>"1847738", "city"=>"Encino", "contactName"=>"Lilliane Ballesteros", "trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1847738&assetId=D9A22F33-8A14-4175-8D5B-D11578212A98", "category"=>"Activities", "zip"=>"91406", "userCommentText"=>nil, "location"=>"Balboa Park/Lake Balboa", "latitude"=>"34.19933", :asset_id=>"D9A22F33-8A14-4175-8D5B-D11578212A98", "searchWeight"=>"1", "country"=>"United States", "participationCriteria"=>"All", "dma"=>"Los Angeles", "isSearchable"=>"1", :asset_name=>"2nd Annual weSPARK 10K Run &amp; 5K Run Walk", :substitution_url=>"1847738", :asset_type_id=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "row"=>"1", "image1"=>"http://www.active.com/images/events/hotrace.gif", "startDate"=>"2010-11-14", "contactPhone"=>"818-906-3022", :asset_type_name=>"Active.com Event Registration", "onlineDonationAvailable"=>"0", "avgUserRating"=>nil, "market"=>"Los Angeles", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "assetName"=>"2nd Annual weSPARK 10K Run & 5K Run Walk", "channel"=>["Running", "Walking"], "seourl"=>"http://www.active.com/running/encino-ca/2nd-annual-wespark-10k-run-and-5k-run-walk-2010", :xmlns=>"http://api.asset.services.active.com", :url=>"http://www.active.com/page/Event_Details.htm?event_id=1847738", "mediaType"=>["Event", "Event\\10K", "Event\\5K"], "startTime"=>"8:00:00", "endTime"=>"8:00:00", "contactEmail"=>"lilliane@wespark.org", "eventResults"=>nil, "longitude"=>"-118.4924", "endDate"=>"2010-11-14", "onlineRegistrationAvailable"=>"1", "onlineMembershipAvailable"=>"0", "state"=>"California", "estParticipants"=>"1400", "eventURL"=>"http://www.wespark.org"}
13
+
14
+ def initialize(data={},preload_metadata=false)
15
+ # need to hold on to original data
16
+ @data = data
17
+ @asset_id = data[:asset_id]
18
+ @url = data[:url]
19
+ @asset_type_id = data[:asset_type_id]
20
+ @title = data[:asset_name] if data[:asset_name]
21
+ @substitution_url = data[:substitution_url]
22
+ # @metadata_loaded = false
23
+ # load_metadata if preload_metadata
24
+ end
25
+
26
+ def source
27
+ :ats
28
+ end
29
+
30
+
31
+ def title
32
+ # load_metadata unless @metadata_loaded
33
+ # if @data.has_key?("assetName")
34
+ @data["assetName"]
35
+ # else
36
+ # @title
37
+ # end
38
+ end
39
+
40
+ def url
41
+ # load_metadata unless @metadata_loaded
42
+ if @data.has_key?("seourl")
43
+ @data["seourl"]
44
+ elsif @data.has_key?("trackbackurl")
45
+ @data["trackbackurl"]
46
+ else
47
+ @url
48
+ end
49
+ end
50
+
51
+ def categories
52
+ # load_metadata unless @metadata_loaded
53
+ categories = @data["channel"]
54
+ if categories.class==String
55
+ [@data["channel"]]
56
+ else
57
+ @data["channel"]
58
+ end
59
+ end
60
+
61
+ def address
62
+ # load_metadata unless @metadata_loaded
63
+ @address = validated_address({
64
+ :name => @data["location"],
65
+ :address => @data["address"],
66
+ :city => @data["city"],
67
+ :state => @data["state"],
68
+ :zip => @data["zip"],
69
+ :lat => @data["latitude"],
70
+ :lng => @data["longitude"],
71
+ :country => @data["country"]
72
+ })
73
+ end
74
+
75
+ def start_date
76
+ # load_metadata unless @metadata_loaded
77
+ if @data.has_key?("startDate")
78
+ if @data.has_key?("startTime")
79
+ (DateTime.parse "#{@data["startDate"]} #{@data["startTime"]}")
80
+ else
81
+ (DateTime.parse @data["startDate"])
82
+ end
83
+ else
84
+ nil
85
+ end
86
+ end
87
+
88
+ def start_time
89
+ start_date
90
+ end
91
+
92
+ def end_date
93
+ # load_metadata unless @metadata_loaded
94
+ if @data.has_key?("endDate")
95
+ if @data.has_key?("endTime")
96
+ (DateTime.parse "#{@data["endDate"]} #{@data["endTime"]}")
97
+ else
98
+ (DateTime.parse @data["endDate"])
99
+ end
100
+ else
101
+ nil
102
+ end
103
+ end
104
+
105
+ def end_time
106
+ end_date
107
+ end
108
+
109
+
110
+ def category
111
+ categories.first
112
+ end
113
+
114
+ def desc
115
+ # load_metadata unless @metadata_loaded
116
+ if @data.has_key?("allText")
117
+ @data["allText"]
118
+ elsif @data.has_key?("summary")
119
+ @data["summary"]
120
+ end
121
+ end
122
+
123
+ def contact_name
124
+ # load_metadata unless @metadata_loaded
125
+ @data["contactName"] if @data.has_key?("contactName")
126
+ end
127
+
128
+ def contact_email
129
+ # load_metadata unless @metadata_loaded
130
+ @data["contactEmail"] if @data.has_key?("contactEmail")
131
+ end
132
+
133
+ def substitutionUrl
134
+ @data[:substitution_url]
135
+ end
136
+
137
+
138
+ # EXAMPLE
139
+ # lazy load the data for some_crazy_method
140
+ # def some_crazy
141
+ # return @some_crazy unless @some_crazy.nil?
142
+ # @some_crazy = @data[:some_crazy_method_from_ats].split replace twist bla bla bla
143
+ # end
144
+
145
+ def self.find_by_id(id)
146
+ begin
147
+ c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
148
+ c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
149
+ r = c.get_asset_by_id! do |soap|
150
+ soap.namespace = "http://api.asset.services.active.com"
151
+ soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
152
+ end
153
+ ats = ATS.new(r.to_hash[:get_asset_by_id_response][:out])
154
+ ats.load_metadata
155
+
156
+ return ats
157
+
158
+ rescue Savon::SOAPFault => e
159
+ raise ATSError, "Couldn't find activity with the id of #{id} error #{e.inspect}"
160
+ return
161
+ end
162
+ end
163
+
164
+ def load_metadata
165
+ metadata = ATS.get_asset_metadata(@asset_id)
166
+ @data.merge! Hash.from_xml(metadata.to_hash[:get_asset_metadata_response][:out])["importSource"]["asset"]
167
+ @metadata_loaded=true
168
+ end
169
+
170
+ private
171
+
172
+ def self.get_asset_metadata(id)
173
+ c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
174
+ c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
175
+ r = c.get_asset_metadata! do |soap|
176
+ soap.namespace = "http://api.asset.services.active.com"
177
+ soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
178
+ end
179
+ return r
180
+ end
181
+
182
+ #
183
+ # def self.get_asset_metadata(id)
184
+ # search_hash = Digest::SHA1.hexdigest("ats_m_#{id}")
185
+ # if Active.CACHE
186
+ # cached_version = Active.CACHE.get(search_hash)
187
+ # return cached_version if cached_version
188
+ # end
189
+ #
190
+ # c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
191
+ # c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
192
+ # r = c.get_asset_metadata! do |soap|
193
+ # soap.namespace = "http://api.asset.services.active.com"
194
+ # soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
195
+ # end
196
+ # ats = ATS.new(r.to_hash[:get_asset_metadata_response][:out])
197
+ # Active.CACHE.set(search_hash, ats) if Active.CACHE
198
+ # return ats
199
+ # end
200
+
201
+ def self.get_asset_by_id(id)
202
+ c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
203
+ c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
204
+ r = c.get_asset_by_id! do |soap|
205
+ soap.namespace = "http://api.asset.services.active.com"
206
+ soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
207
+ end
208
+ ats = ATS.new(r.to_hash[:get_asset_by_id_response][:out])
209
+ return ats
210
+ end
211
+
212
+
213
+ end # end ats
214
+ end
215
+ end
@@ -20,7 +20,7 @@ module Active
20
20
  end
21
21
 
22
22
  def source
23
- :primary
23
+ :active_works
24
24
  end
25
25
 
26
26
  def asset_id
@@ -81,6 +81,18 @@ module Active
81
81
  def end_time
82
82
  end_date
83
83
  end
84
+
85
+ def contact_name
86
+ nil
87
+ end
88
+
89
+ def contact_email
90
+ nil
91
+ end
92
+
93
+ def user
94
+ User.new
95
+ end
84
96
 
85
97
 
86
98
  def category
@@ -138,7 +150,7 @@ module Active
138
150
  # end
139
151
 
140
152
  def get_app_api
141
- puts "loading active works api"
153
+ # puts "loading active works api"
142
154
  begin
143
155
  doc = Nokogiri::XML(open("http://apij.active.com/activeworks/event/#{@data[:id]}"))
144
156
  @data.merge! Hash.from_xml doc.to_s
@@ -44,22 +44,36 @@ module Active
44
44
  end
45
45
  end
46
46
 
47
- def load_datasources
48
- return if @datasources_loaded==true
49
-
50
- @ats = ATS.find_by_id(@asset_id,true) if @ats==nil
51
- @ats.load_metadata
52
- @gsa = Search.search({:asset_id=>@asset_id, :start_date=>"01/01/2000"}).results.first if @gsa==nil
53
-
54
- if @primary==nil
55
- if @ats.asset_type_id==REG_CENTER_ASSET_TYPE_ID || @ats.asset_type_id==REG_CENTER_ASSET_TYPE_ID2
56
- @primary= RegCenter.find_by_id(@ats.substitutionUrl)
57
- elsif @ats.asset_type_id==ACTIVE_WORKS_ASSET_TYPE_ID
58
- @primary= ActiveWorks.find_by_id(@ats.substitutionUrl)
59
- end
47
+ def ats
48
+ return @ats if @ats
49
+ return @ats = ATS.find_by_id(@gsa.asset_id)
50
+ end
51
+
52
+ def primary_source
53
+ return @primary_source if @primary_source
54
+ if @gsa.asset_type_id == REG_CENTER_ASSET_TYPE_ID || @gsa.asset_type_id == REG_CENTER_ASSET_TYPE_ID2
55
+ return @primary_source = RegCenter.find_by_id(@gsa.substitutionUrl)
56
+ elsif @gsa.asset_type_id == ACTIVE_WORKS_ASSET_TYPE_ID
57
+ return @primary_source = ActiveWorks.find_by_id(@gsa.substitutionUrl)
60
58
  end
61
- @datasources_loaded=true
62
59
  end
60
+
61
+ # def load_datasources
62
+ # return if @datasources_loaded==true
63
+ #
64
+ # @ats = ATS.find_by_id(@asset_id,true) if @ats==nil
65
+ # @ats.load_metadata
66
+ # @gsa = Search.search({:asset_id=>@asset_id, :start_date=>"01/01/2000"}).results.first if @gsa==nil
67
+ #
68
+ # if @primary==nil
69
+ # if @ats.asset_type_id==REG_CENTER_ASSET_TYPE_ID || @ats.asset_type_id==REG_CENTER_ASSET_TYPE_ID2
70
+ # @primary= RegCenter.find_by_id(@ats.substitutionUrl)
71
+ # elsif @ats.asset_type_id==ACTIVE_WORKS_ASSET_TYPE_ID
72
+ # @primary= ActiveWorks.find_by_id(@ats.substitutionUrl)
73
+ # end
74
+ # end
75
+ # @datasources_loaded=true
76
+ # end
63
77
 
64
78
  def title
65
79
  return @gsa.title unless @gsa.nil?
@@ -118,37 +132,38 @@ module Active
118
132
  return categories.first
119
133
  end
120
134
 
121
- def load_master
122
- # @ats = ATS.find_by_id(@gsa.asset_id)
123
- # throw StandardError.new "ATS type=#{@gsa.asset_type_id} id=#{@gsa.substitutionUrl}"
124
- # if @gsa.asset_type_id == REG_CENTER_ASSET_TYPE_ID || @gsa.asset_type_id == REG_CENTER_ASSET_TYPE_ID2
125
- # throw StandardError.new "REG"
126
- # elsif @gsa.asset_type_id == ACTIVE_WORKS_ASSET_TYPE_ID
127
- # throw StandardError.new "WORKS"
128
- # else
129
- # throw StandardError.new @gsa.asset_type_id
130
- # return false
131
- # end
132
- # if @ats.asset_type_id==REG_CENTER_ASSET_TYPE_ID || @ats.asset_type_id==REG_CENTER_ASSET_TYPE_ID2
133
- # @primary= RegCenter.find_by_id(@ats.substitutionUrl)
134
- # elsif @ats.asset_type_id==ACTIVE_WORKS_ASSET_TYPE_ID
135
- # @primary= ActiveWorks.find_by_id(@ats.substitutionUrl)
136
- # end
137
-
138
- end
135
+ # def load_master
136
+ # # @ats = ATS.find_by_id(@gsa.asset_id)
137
+ # # throw StandardError.new "ATS type=#{@gsa.asset_type_id} id=#{@gsa.substitutionUrl}"
138
+ # # if @gsa.asset_type_id == REG_CENTER_ASSET_TYPE_ID || @gsa.asset_type_id == REG_CENTER_ASSET_TYPE_ID2
139
+ # # throw StandardError.new "REG"
140
+ # # elsif @gsa.asset_type_id == ACTIVE_WORKS_ASSET_TYPE_ID
141
+ # # throw StandardError.new "WORKS"
142
+ # # else
143
+ # # throw StandardError.new @gsa.asset_type_id
144
+ # # return false
145
+ # # end
146
+ # # if @ats.asset_type_id==REG_CENTER_ASSET_TYPE_ID || @ats.asset_type_id==REG_CENTER_ASSET_TYPE_ID2
147
+ # # @primary= RegCenter.find_by_id(@ats.substitutionUrl)
148
+ # # elsif @ats.asset_type_id==ACTIVE_WORKS_ASSET_TYPE_ID
149
+ # # @primary= ActiveWorks.find_by_id(@ats.substitutionUrl)
150
+ # # end
151
+ #
152
+ # end
139
153
 
140
154
  # returns the best address possible from the data returned by the GSA
141
155
  def address
156
+ @gsa.address
142
157
  # returned_address = validated_address({})
143
158
  # returned_address = @primary.address unless (@primary.nil? || @primary.address.nil?)
144
159
  # load_datasources
145
160
  # returned_address = @ats.address unless @ats.nil?
146
- returned_address = @gsa.address
147
- if @gsa.address[:address] != nil #and returned_address.city and returned_address.state and returned_address.country
148
- return returned_address
149
- else
150
- return @gsa.address if load_master
151
- end
161
+ # returned_address = @gsa.address
162
+ # if @gsa.address[:address] != nil #and returned_address.city and returned_address.state and returned_address.country
163
+ # return returned_address
164
+ # else
165
+ # return nil
166
+ # end
152
167
  # returned_address = @address if @address
153
168
  #
154
169
  # #ensure lat/lng
@@ -166,7 +181,7 @@ module Active
166
181
  # end
167
182
  # end
168
183
  #
169
- return returned_address
184
+ # return returned_address
170
185
  end
171
186
  # returns the best address possible by loading other data sources
172
187
  # 2. if the primary data source is unknow (ex asset_type_id is unknow ) we will return the GSA address.
@@ -202,9 +217,20 @@ module Active
202
217
  end
203
218
 
204
219
  def user
205
- @gsa.user
220
+ return @gsa.user
206
221
  end
207
222
 
223
+ def _user
224
+ u = User.new
225
+ # If GSA doesn't have the email ATS should
226
+ u.email = @gsa.user.email || ats.user.email || primary_source.user.email || nil
227
+ # First name is only in ATS but GSA has a username that is kept in first_name
228
+ u.first_name = ats.user.first_name || @gsa.user.first_name || nil
229
+ # Last name is only found in ATS
230
+ u.last_name = ats.user.last_name || nil
231
+ u
232
+ end
233
+
208
234
  def start_date
209
235
  return @gsa.start_date unless @gsa.nil?
210
236
  return nil
data/lib/services/ats.rb CHANGED
@@ -31,7 +31,7 @@ module Active
31
31
  def title
32
32
  # load_metadata unless @metadata_loaded
33
33
  # if @data.has_key?("assetName")
34
- @data["assetName"]
34
+ @data["assetName"]
35
35
  # else
36
36
  # @title
37
37
  # end
@@ -60,7 +60,7 @@ module Active
60
60
 
61
61
  def address
62
62
  # load_metadata unless @metadata_loaded
63
- @address = Hash.new({
63
+ @address = validated_address({
64
64
  :name => @data["location"],
65
65
  :address => @data["address"],
66
66
  :city => @data["city"],
@@ -119,7 +119,7 @@ module Active
119
119
  @data["summary"]
120
120
  end
121
121
  end
122
-
122
+
123
123
  def contact_name
124
124
  # load_metadata unless @metadata_loaded
125
125
  @data["contactName"] if @data.has_key?("contactName")
@@ -129,11 +129,23 @@ module Active
129
129
  # load_metadata unless @metadata_loaded
130
130
  @data["contactEmail"] if @data.has_key?("contactEmail")
131
131
  end
132
-
132
+ def contact_phone
133
+ @data["contactPhone"] if @data.has_key?("contactPhone")
134
+ end
135
+
133
136
  def substitutionUrl
134
137
  @data[:substitution_url]
135
138
  end
136
139
 
140
+ def user
141
+ email = contact_email
142
+ u = User.new
143
+ u.email = email if Validators.email(email)
144
+ u.first_name = contact_name
145
+ u.phone = contact_phone
146
+ u
147
+ end
148
+
137
149
 
138
150
  # EXAMPLE
139
151
  # lazy load the data for some_crazy_method
@@ -144,62 +156,63 @@ module Active
144
156
 
145
157
  def self.find_by_id(id)
146
158
  begin
147
-
148
- # return self.get_asset_by_id(id)
149
- search_hash = Digest::SHA1.hexdigest("ats_m_#{id}")
150
- if Active.CACHE
151
- cached_version = Active.CACHE.get(search_hash)
152
- return cached_version if cached_version
153
- end
154
-
155
159
  c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
156
160
  c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
157
- r = c.get_asset_metadata! do |soap|
161
+ r = c.get_asset_by_id! do |soap|
158
162
  soap.namespace = "http://api.asset.services.active.com"
159
163
  soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
160
164
  end
161
- ats = ATS.new(r.to_hash[:get_asset_metadata_response][:out])
162
- Active.CACHE.set(search_hash, ats) if Active.CACHE
163
- return ats
164
-
165
+ ats = ATS.new(r.to_hash[:get_asset_by_id_response][:out])
166
+ ats.load_metadata
167
+
168
+ return ats
169
+
165
170
  rescue Savon::SOAPFault => e
166
171
  raise ATSError, "Couldn't find activity with the id of #{id} error #{e.inspect}"
167
172
  return
168
173
  end
169
174
  end
170
175
 
171
- # def load_metadata
172
- # metadata = ATS.get_asset_metadata(@asset_id)
173
- # @data.merge! Hash.from_xml(metadata.to_hash[:get_asset_metadata_response][:out])["importSource"]["asset"]
174
- # @metadata_loaded=true
175
- # end
176
+ def load_metadata
177
+ metadata = ATS.get_asset_metadata(@asset_id)
178
+ @data.merge! Hash.from_xml(metadata.to_hash[:get_asset_metadata_response][:out])["importSource"]["asset"]
179
+ @metadata_loaded=true
180
+ end
176
181
 
177
182
  private
183
+
178
184
  def self.get_asset_metadata(id)
179
- search_hash = Digest::SHA1.hexdigest("ats_m_#{id}")
180
- if Active.CACHE
181
- cached_version = Active.CACHE.get(search_hash)
182
- return cached_version if cached_version
183
- end
184
-
185
185
  c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
186
186
  c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
187
187
  r = c.get_asset_metadata! do |soap|
188
188
  soap.namespace = "http://api.asset.services.active.com"
189
189
  soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
190
190
  end
191
- ats = ATS.new(r.to_hash[:get_asset_metadata_response][:out])
192
- Active.CACHE.set(search_hash, ats) if Active.CACHE
193
- return ats
194
- end
191
+ # puts "==========="
192
+ # puts r.to_hash[:get_asset_metadata_response][:out].inspect
193
+ return r
194
+ end
195
+
196
+ #
197
+ # def self.get_asset_metadata(id)
198
+ # search_hash = Digest::SHA1.hexdigest("ats_m_#{id}")
199
+ # if Active.CACHE
200
+ # cached_version = Active.CACHE.get(search_hash)
201
+ # return cached_version if cached_version
202
+ # end
203
+ #
204
+ # c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
205
+ # c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
206
+ # r = c.get_asset_metadata! do |soap|
207
+ # soap.namespace = "http://api.asset.services.active.com"
208
+ # soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
209
+ # end
210
+ # ats = ATS.new(r.to_hash[:get_asset_metadata_response][:out])
211
+ # Active.CACHE.set(search_hash, ats) if Active.CACHE
212
+ # return ats
213
+ # end
195
214
 
196
215
  def self.get_asset_by_id(id)
197
- search_hash = Digest::SHA1.hexdigest("ats_#{id}")
198
- if Active.CACHE
199
- cached_version = Active.CACHE.get(search_hash)
200
- return cached_version if cached_version
201
- end
202
-
203
216
  c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
204
217
  c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
205
218
  r = c.get_asset_by_id! do |soap|
@@ -207,10 +220,9 @@ module Active
207
220
  soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
208
221
  end
209
222
  ats = ATS.new(r.to_hash[:get_asset_by_id_response][:out])
210
- Active.CACHE.set(search_hash, ats) if Active.CACHE
211
223
  return ats
212
224
  end
213
-
225
+
214
226
 
215
227
  end # end ats
216
228
  end
@@ -2,12 +2,7 @@ module Active
2
2
  module Services
3
3
 
4
4
  class User
5
- def email=(value)
6
- @email = value
7
- end
8
- def email
9
- @email
10
- end
5
+ attr_accessor :first_name, :last_name, :email, :phone
11
6
  end
12
7
 
13
8
  end
data/lib/services/gsa.rb CHANGED
@@ -101,22 +101,16 @@ module Active
101
101
  def category
102
102
  primary_category
103
103
  end
104
-
105
- def contact_name
106
- if @data["meta"].has_key?("contactName") && !@data["meta"]["contactName"].blank?
107
- @data["meta"]["contactName"]
108
- end
109
- end
110
104
 
111
105
  def last_modified
112
106
  @data["meta"]["lastModifiedDateTime"] if @data["meta"].has_key?("lastModifiedDateTime")
113
107
  end
114
108
 
115
- def contact_email
116
- if @data["meta"].has_key?("contactEmail") && !@data["meta"]["contactEmail"].blank?
117
- @data["meta"]["contactEmail"]
118
- end
119
- end
109
+ # def contact_email
110
+ # if @data["meta"].has_key?("contactEmail") && !@data["meta"]["contactEmail"].blank?
111
+ # @data["meta"]["contactEmail"]
112
+ # end
113
+ # end
120
114
 
121
115
  def desc
122
116
  if @data["meta"].has_key?("allText") && !@data["meta"]["allText"].blank?
@@ -131,9 +125,11 @@ module Active
131
125
  end
132
126
 
133
127
  def user
134
- email = @data["meta"]["contactEmail"] || nil
135
- u = User.new
136
- u.email = email if Validators.email(email)
128
+ email = @data["meta"]["contactEmail"] || nil
129
+ u = User.new
130
+ u.email = email if Validators.email(email)
131
+ u.first_name, u.last_name = parse_contact_name(@data["meta"]["contactName"])
132
+ u.phone = @data["meta"]["contactPhone"] || nil
137
133
  u
138
134
  end
139
135
 
@@ -149,13 +145,16 @@ module Active
149
145
  end
150
146
  end
151
147
  end
152
- # TODO
153
- def activeworks_id
154
- 0
155
- end
156
- def regcenter_id
157
- 0
158
- end
148
+
149
+ private
150
+ # parse_contact_name("Jonathan Spooner")
151
+ # return ["Jonathan","Spooner"]
152
+ # return ["Jonathan",nil]
153
+ # return [nil,nil]
154
+ def parse_contact_name(value)
155
+ return nil,nil if value.nil?
156
+ return value.split(" ")
157
+ end
159
158
 
160
159
 
161
160
  end
@@ -21,7 +21,7 @@ module Active
21
21
  end
22
22
 
23
23
  def source
24
- :primary
24
+ :reg_center
25
25
  end
26
26
 
27
27
  def title
@@ -81,18 +81,16 @@ module Active
81
81
  end
82
82
 
83
83
  def address
84
- if @data.has_key?("event") && @data["event"].has_key?("eventAddress") && !@data["event"]["eventAddress"].blank?
85
- @address = validated_address({
86
- :name => @data["event"]["eventLocation"],
87
- :address => @data["event"]["eventAddress"],
88
- :city => @data["event"]["eventCity"],
89
- :state => @data["event"]["eventState"],
90
- :zip => @data["event"]["eventZip"],
91
- :lat => @data["event"]["latitude"],
92
- :lng => @data["event"]["longitude"],
93
- :country => @data["event"]["eventCountry"]
94
- } )
95
- end
84
+ @address = validated_address({
85
+ :name => @data["event"]["eventLocation"],
86
+ :address => @data["event"]["eventAddress"],
87
+ :city => @data["event"]["eventCity"],
88
+ :state => @data["event"]["eventState"],
89
+ :zip => @data["event"]["eventZip"],
90
+ :lat => @data["event"]["latitude"],
91
+ :lng => @data["event"]["longitude"],
92
+ :country => @data["event"]["eventCountry"]
93
+ } )
96
94
  end
97
95
 
98
96
  def start_date
@@ -114,6 +112,15 @@ module Active
114
112
  def category
115
113
  primary_category
116
114
  end
115
+
116
+ def user
117
+ email = contact_email
118
+ u = User.new
119
+ u.email = email if Validators.email(email)
120
+ # u.first_name = @data["meta"]["contactName"] || nil
121
+ # u.phone = @data["meta"]["contactPhone"] || nil
122
+ u
123
+ end
117
124
 
118
125
  def desc
119
126
  if @data.has_key?("event") && @data["event"].has_key?("briefDescription")
@@ -152,9 +159,8 @@ module Active
152
159
  # return @some_crazy unless @some_crazy.nil?
153
160
  # @some_crazy = @data[:some_crazy_method_from_ats].split replace twist bla bla bla
154
161
  # end
155
-
156
- def self.find_by_id(id) #local id
157
-
162
+ # local id
163
+ def self.find_by_id(id)
158
164
  begin
159
165
  doc = Nokogiri::XML(open("http://apij.active.com/regcenter/event/#{id}"))
160
166
  puts "////////<br/>"
@@ -163,10 +169,9 @@ module Active
163
169
  reg = RegCenter.new(Hash.from_xml(doc.to_s))
164
170
  rescue Exception => e
165
171
  raise RegCenterError, "Couldn't find Reg Center activity with the id of #{id} - #{e.inspect}"
166
- return
172
+ return nil
167
173
  end
168
-
169
- return reg
174
+ reg
170
175
  end
171
176
 
172
177
  private
@@ -3,7 +3,8 @@ module Active
3
3
  class Validators
4
4
 
5
5
  def self.email arg
6
- if (arg =~ /^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/) == nil
6
+ if (arg =~ /((\w|-)+(\.\w+)?)+@\w+\.\w+/) == nil
7
+ # if (arg =~ /^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/) == nil
7
8
  return false
8
9
  else
9
10
  return true
@@ -96,6 +97,7 @@ module Active
96
97
  end
97
98
 
98
99
  def self.valid_state(name)
100
+ return nil if name.nil?
99
101
  STATES.find do |i|
100
102
  if i[0].upcase==name.strip.upcase
101
103
  return i[0]
@@ -14,6 +14,10 @@ describe ActiveWorks do
14
14
  a = ActiveWorks.find_by_id(@valid_id)
15
15
  a.data["id"].should == @valid_id
16
16
  end
17
+ it "should have a nil user email" do
18
+ a = ActiveWorks.find_by_id(@valid_id)
19
+ a.user.email.should be_nil
20
+ end
17
21
  it "should set the asset_type_id" do
18
22
  ActiveWorks.find_by_id(@valid_id).asset_type_id.should_not be_nil
19
23
  end
data/spec/ats_spec.rb CHANGED
@@ -18,7 +18,7 @@ describe ATS do
18
18
  a.asset_id.should == @valid_id
19
19
  end
20
20
  it "should get the asset_type_id" do
21
- ATS.find_by_id(@valid_id).asset_id_type.should_not be_nil
21
+ ATS.find_by_id(@valid_id).asset_type_id.should_not be_nil
22
22
  end
23
23
  it "should thorw an ATSError if no record is found" do
24
24
  lambda { ATS.find_by_id( "666" ) }.should raise_error(ATSError)
@@ -36,19 +36,62 @@ describe ATS do
36
36
  puts a.url
37
37
  a.start_date.should_not be_nil
38
38
  end
39
- it "should only load metadata once" do
40
- a = ATS.find_by_id(@valid_id)
41
- puts a.url
42
- puts a.address
43
- ATS.should_receive(:load_metadata).once
44
- 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
45
46
  it "should have an address Hash" do
46
47
  a = ATS.find_by_id(@valid_id)
47
48
  a.address.should be_an_instance_of(HashWithIndifferentAccess)
48
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
+
49
91
  it "should have a startDate Date" do
50
92
  a = ATS.find_by_id(@valid_id)
51
- a.start_date.should be_an_instance_of(Date)
93
+ puts a.start_date.class
94
+ a.start_date.should be_an_instance_of(DateTime)
52
95
  end
53
96
  it "should have a title String" do
54
97
  a = ATS.find_by_id(@valid_id)
@@ -2,8 +2,24 @@ require 'rubygems'
2
2
  require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. lib Active]))
3
3
  include Active::Services
4
4
 
5
- Benchmark.bm(700) do |x|
6
- x.report("string:") { Search.new({:keywords => "running,swimming,yoga"}) }
7
- x.report("array:") { Search.new({:keywords => %w(running swimming yoga)}) }
8
- x.report("Array:") { Search.new({:keywords => ["running","swimming","yoga"]}) }
9
- end
5
+ # Benchmark.bm(700) do |x|
6
+ # x.report("string:") { Search.new({:keywords => "running,swimming,yoga"}) }
7
+ # x.report("array:") { Search.new({:keywords => %w(running swimming yoga)}) }
8
+ # x.report("Array:") { Search.new({:keywords => ["running","swimming","yoga"]}) }
9
+ # end
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
data/spec/gsa_spec.rb CHANGED
@@ -168,8 +168,13 @@ describe GSA do
168
168
  g.user.email.should be_nil
169
169
  end
170
170
  it "should have a valid user email" do
171
- 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"}}'))
172
- g.user.email.should eql("eventinfo@sfaf.org")
171
+ 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"}}'))
172
+ g.user.first_name.should eql("joe")
173
+ end
174
+ it "should have a valid first and last name" do
175
+ 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"}}'))
176
+ g.user.first_name.should eql("Brandon")
177
+ g.user.last_name.should eql("Burns")
173
178
  end
174
179
  end
175
180
 
data/spec/reg_spec.rb CHANGED
@@ -19,6 +19,67 @@ describe RegCenter do
19
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 &amp; 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 &amp;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
20
  r.title.should eql("Realistic Drawing (6-12 Yrs.)")
21
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 &amp; 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 &amp;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 &amp; 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 &amp;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 &amp; 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&#13;\n&lt;p&gt;&#13;\n1/2 Marathon&#13;\n&lt;p&gt;&#13;\n * $85.00 \342\200\223 October 2009- July 31, 2010&lt;br&gt;&#13;\n * $100.00 \342\200\223 August 1, 2010- September 26&lt;br&gt;&#13;\n * $120.00 \342\200\223 Expo Price&lt;br&gt;&#13;\n&lt;p&gt;&#13;\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&amp;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 &amp; 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&#13;\n&lt;p&gt;&#13;\n1/2 Marathon&#13;\n&lt;p&gt;&#13;\n * $85.00 \342\200\223 October 2009- July 31, 2010&lt;br&gt;&#13;\n * $100.00 \342\200\223 August 1, 2010- September 26&lt;br&gt;&#13;\n * $120.00 \342\200\223 Expo Price&lt;br&gt;&#13;\n&lt;p&gt;&#13;\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&amp;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&#13;\n&lt;p&gt;&#13;\n1/2 Marathon&#13;\n&lt;p&gt;&#13;\n * $85.00 \342\200\223 October 2009- July 31, 2010&lt;br&gt;&#13;\n * $100.00 \342\200\223 August 1, 2010- September 26&lt;br&gt;&#13;\n * $120.00 \342\200\223 Expo Price&lt;br&gt;&#13;\n&lt;p&gt;&#13;\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&amp;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&#13;\n&lt;p&gt;&#13;\n1/2 Marathon&#13;\n&lt;p&gt;&#13;\n * $85.00 \342\200\223 October 2009- July 31, 2010&lt;br&gt;&#13;\n * $100.00 \342\200\223 August 1, 2010- September 26&lt;br&gt;&#13;\n * $120.00 \342\200\223 Expo Price&lt;br&gt;&#13;\n&lt;p&gt;&#13;\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&amp;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&#13;\n&lt;p&gt;&#13;\n1/2 Marathon&#13;\n&lt;p&gt;&#13;\n * $85.00 \342\200\223 October 2009- July 31, 2010&lt;br&gt;&#13;\n * $100.00 \342\200\223 August 1, 2010- September 26&lt;br&gt;&#13;\n * $120.00 \342\200\223 Expo Price&lt;br&gt;&#13;\n&lt;p&gt;&#13;\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&amp;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&#13;\n&lt;p&gt;&#13;\n1/2 Marathon&#13;\n&lt;p&gt;&#13;\n * $85.00 \342\200\223 October 2009- July 31, 2010&lt;br&gt;&#13;\n * $100.00 \342\200\223 August 1, 2010- September 26&lt;br&gt;&#13;\n * $120.00 \342\200\223 Expo Price&lt;br&gt;&#13;\n&lt;p&gt;&#13;\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&amp;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&#13;\n&lt;p&gt;&#13;\n1/2 Marathon&#13;\n&lt;p&gt;&#13;\n * $85.00 \342\200\223 October 2009- July 31, 2010&lt;br&gt;&#13;\n * $100.00 \342\200\223 August 1, 2010- September 26&lt;br&gt;&#13;\n * $120.00 \342\200\223 Expo Price&lt;br&gt;&#13;\n&lt;p&gt;&#13;\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&amp;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&#13;\n&lt;p&gt;&#13;\n1/2 Marathon&#13;\n&lt;p&gt;&#13;\n * $85.00 \342\200\223 October 2009- July 31, 2010&lt;br&gt;&#13;\n * $100.00 \342\200\223 August 1, 2010- September 26&lt;br&gt;&#13;\n * $120.00 \342\200\223 Expo Price&lt;br&gt;&#13;\n&lt;p&gt;&#13;\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&amp;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&#13;\n&lt;p&gt;&#13;\n1/2 Marathon&#13;\n&lt;p&gt;&#13;\n * $85.00 \342\200\223 October 2009- July 31, 2010&lt;br&gt;&#13;\n * $100.00 \342\200\223 August 1, 2010- September 26&lt;br&gt;&#13;\n * $120.00 \342\200\223 Expo Price&lt;br&gt;&#13;\n&lt;p&gt;&#13;\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&amp;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
+
22
83
  it "should set find by id" do
23
84
  a = RegCenter.find_by_id(@valid_id)
24
85
  a.data.should_not be_nil
@@ -34,10 +95,6 @@ describe RegCenter do
34
95
  a = RegCenter.find_by_id(@valid_id)
35
96
  a.data["event"].should_not be_nil
36
97
  end
37
- it "should have an address Hash" do
38
- a = RegCenter.find_by_id(@valid_id)
39
- a.address.should be_an_instance_of(HashWithIndifferentAccess)
40
- end
41
98
  it "should have a desc String" do
42
99
  a = RegCenter.find_by_id(@valid_id)
43
100
  a.desc.should be_an_instance_of(String)
@@ -10,6 +10,7 @@ include Active::Services
10
10
  describe Validators do
11
11
 
12
12
  it "should find a valid email address" do
13
+ Validators.email("Jeremy.Sheppard@co.kent.de.u").should be_true
13
14
  Validators.email("diney.bom-fim_23db@google.com").should be_true
14
15
  Validators.email("jspooner@gmail.com").should be_true
15
16
  Validators.email("jspooner@ga").should be_false
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.0.22
1
+ 0.0.23
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Active
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 49
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 22
9
- version: 0.0.22
9
+ - 23
10
+ version: 0.0.23
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jonathan Spooner, Brian Levine
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-10-06 00:00:00 -07:00
18
+ date: 2010-10-07 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: savon
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 17
27
30
  segments:
28
31
  - 0
29
32
  - 7
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: dalli
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 43
41
46
  segments:
42
47
  - 0
43
48
  - 9
@@ -49,9 +54,11 @@ dependencies:
49
54
  name: bones
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ">="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 25
55
62
  segments:
56
63
  - 3
57
64
  - 4
@@ -69,20 +76,18 @@ extra_rdoc_files:
69
76
  - History.txt
70
77
  - README.txt
71
78
  - bin/Active
72
- - lib/.DS_Store
73
- - lib/services/.DS_Store
74
79
  - lib/services/search.txt
75
80
  - version.txt
76
81
  files:
82
+ - .bnsignore
77
83
  - Active.gemspec
78
84
  - History.txt
79
85
  - README.txt
80
86
  - Rakefile
81
87
  - bin/Active
82
- - lib/.DS_Store
83
88
  - lib/Active.rb
84
- - lib/services/.DS_Store
85
89
  - lib/services/IActivity.rb
90
+ - lib/services/_ats.rb
86
91
  - lib/services/active_works.rb
87
92
  - lib/services/activity.rb
88
93
  - lib/services/address.rb
@@ -120,23 +125,27 @@ rdoc_options:
120
125
  require_paths:
121
126
  - lib
122
127
  required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
123
129
  requirements:
124
130
  - - ">="
125
131
  - !ruby/object:Gem::Version
132
+ hash: 3
126
133
  segments:
127
134
  - 0
128
135
  version: "0"
129
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
130
138
  requirements:
131
139
  - - ">="
132
140
  - !ruby/object:Gem::Version
141
+ hash: 3
133
142
  segments:
134
143
  - 0
135
144
  version: "0"
136
145
  requirements: []
137
146
 
138
147
  rubyforge_project: Active
139
- rubygems_version: 1.3.6
148
+ rubygems_version: 1.3.7
140
149
  signing_key:
141
150
  specification_version: 3
142
151
  summary: Search api for Active Network
data/lib/.DS_Store DELETED
Binary file
Binary file