Active 0.0.6 → 0.0.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/bin/Active +0 -0
- data/lib/services/activity.rb +8 -13
- data/lib/services/search.rb +166 -101
- data/spec/activity_spec.rb +6 -2
- data/spec/benchmark/search_bench.rb +9 -0
- data/spec/custom_matchers_spec.rb +27 -0
- data/spec/search_spec.rb +133 -85
- data/version.txt +1 -1
- metadata +13 -6
- data/lib/.DS_Store +0 -0
data/bin/Active
CHANGED
File without changes
|
data/lib/services/activity.rb
CHANGED
@@ -1,38 +1,33 @@
|
|
1
1
|
module Active
|
2
2
|
module Services
|
3
3
|
class Activity
|
4
|
-
attr_accessor :title, :url, :
|
5
|
-
:asset_id, :asset_type_id, :data
|
4
|
+
attr_accessor :title, :url, :categories, :address, :start_date, :start_time, :end_time, :end_date, :category, :desc,
|
5
|
+
:asset_id, :asset_type_id, :data
|
6
|
+
|
6
7
|
def initialize data
|
7
8
|
@data = HashWithIndifferentAccess.new(data)
|
8
9
|
self.title = @data[:title]
|
9
10
|
@url = @data[:url]
|
10
|
-
@pageSize = @data[:pageSize]
|
11
|
-
@searchTime = @data[:searchTime]
|
12
|
-
@numberOfResults = @data[:numberOfResults]
|
13
11
|
|
14
12
|
unless @data[:meta].nil?
|
15
13
|
self.asset_id = @data[:meta][:assetId]
|
16
14
|
self.asset_type_id = @data[:meta][:assetTypeId]
|
17
15
|
@start_date = Date.parse(@data[:meta][:startDate])
|
18
16
|
@end_date = Date.parse(@data[:meta][:endDate]) if @data[:meta][:endDate]
|
19
|
-
self.
|
17
|
+
self.categories = @data[:meta][:channel]
|
20
18
|
|
21
19
|
@desc = @data[:meta][:description] ||= ""
|
22
20
|
@start_time = @data[:meta][:startTime] ||= ""
|
23
21
|
@end_time = @data[:meta][:endTime] ||= ""
|
24
22
|
@address = {
|
25
23
|
:name => @data[:meta][:locationName],
|
26
|
-
:address
|
24
|
+
:address => @data[:meta][:location],
|
27
25
|
:city => @data[:meta][:city],
|
28
26
|
:state => @data[:meta][:state],
|
29
27
|
:zip => @data[:meta][:zip],
|
30
28
|
:lat => @data[:meta][:latitude],
|
31
29
|
:lng => @data[:meta][:longitude],
|
32
30
|
:country => @data[:meta][:country]
|
33
|
-
|
34
|
-
# dma?
|
35
|
-
|
36
31
|
}
|
37
32
|
end
|
38
33
|
@onlineDonationAvailable = @data[:meta][:onlineDonationAvailable]
|
@@ -49,9 +44,9 @@ module Active
|
|
49
44
|
end
|
50
45
|
|
51
46
|
# TODO add many channels
|
52
|
-
def
|
53
|
-
|
54
|
-
end
|
47
|
+
# def categories=(value)
|
48
|
+
# @category = (value.class == Array) ? value : value
|
49
|
+
# end
|
55
50
|
|
56
51
|
def asset_id=(value)
|
57
52
|
@asset_id = (value.class==Array) ? value[0] : value
|
data/lib/services/search.rb
CHANGED
@@ -29,12 +29,174 @@ module Active
|
|
29
29
|
end
|
30
30
|
|
31
31
|
class Search
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
attr_accessor :api_key, :start_date, :end_date, :location, :channels, :keywords, :search, :radius, :limit, :sort, :page, :offset,
|
33
|
+
:view, :facet, :sort, :num_results
|
34
|
+
|
35
|
+
attr_reader :results, :endIndex, :pageSize, :searchTime, :numberOfResults, :end_point, :meta
|
36
|
+
|
35
37
|
SEARCH_URL = "http://search.active.com"
|
36
38
|
DEFAULT_TIMEOUT = 5
|
39
|
+
|
40
|
+
def initialize(data={})
|
41
|
+
self.api_key = data[:api_key] || ""
|
42
|
+
self.location = data[:location] || ""
|
43
|
+
self.channels = data[:channels] || []
|
44
|
+
self.keywords = data[:keywords] || []
|
45
|
+
self.radius = data[:radius] || "50"
|
46
|
+
self.limit = data[:limit] || "10"
|
47
|
+
self.sort = data[:sort] || Sort.DATE_ASC
|
48
|
+
self.page = data[:page] || "1"
|
49
|
+
self.offset = data[:offset] || "0"
|
50
|
+
self.view = data[:view] || "json"
|
51
|
+
self.facet = data[:facet] || Facet.ACTIVITIES
|
52
|
+
self.num_results = data[:num_results] || "10"
|
53
|
+
self.search = data[:search] || ""
|
54
|
+
self.start_date = data[:start_date] || "today"
|
55
|
+
self.end_date = data[:end_date] || "+"
|
56
|
+
|
57
|
+
# Search.construct_url
|
58
|
+
end
|
59
|
+
|
60
|
+
def location=(value)
|
61
|
+
@location = CGI.escape(value)
|
62
|
+
end
|
63
|
+
|
64
|
+
def keywords=(value)
|
65
|
+
if value.class == String
|
66
|
+
@keywords = value.split(",").each { |k| k.strip! }
|
67
|
+
else
|
68
|
+
@keywords = value
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def channels=(value)
|
73
|
+
if value.class == String
|
74
|
+
@channels = value.split(",").each { |k| k.strip! }
|
75
|
+
else
|
76
|
+
@channels = value
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def end_point
|
81
|
+
meta_data = ""
|
82
|
+
channel_keys = []
|
83
|
+
@channels.each do |c|
|
84
|
+
c.to_sym
|
85
|
+
if Categories.CHANNELS.include?(c)
|
86
|
+
channel_keys << Categories.CHANNELS[c]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
meta_data = channel_keys.collect { |channel| "meta:channel=#{Search.double_encode_channel(channel)}" }.join("+OR+")
|
90
|
+
puts meta_data
|
91
|
+
|
92
|
+
|
93
|
+
# meta_data = self.channels.join("+OR+")
|
94
|
+
|
95
|
+
meta_data += "+AND+" unless meta_data == ""
|
96
|
+
if @start_date.class == Date
|
97
|
+
@start_date = URI.escape(@start_date.strftime("%m/%d/%Y")).gsub(/\//,"%2F")
|
98
|
+
end
|
99
|
+
if @end_date.class == Date
|
100
|
+
@end_date = URI.escape(@end_date.strftime("%m/%d/%Y")).gsub(/\//,"%2F")
|
101
|
+
end
|
102
|
+
meta_data += "meta:startDate:daterange:#{@start_date}..#{@end_date}"
|
37
103
|
|
104
|
+
url = "#{SEARCH_URL}/search?api_key=#{@api_key}&num=#{@num_results}&page=#{@page}&l=#{@location}&f=#{@facet}&v=#{@view}&r=#{@radius}&s=#{@sort}&k=#{@keywords.join("+")}&m=#{meta_data}"
|
105
|
+
end
|
106
|
+
|
107
|
+
def search
|
108
|
+
searchurl = URI.parse(end_point)
|
109
|
+
req = Net::HTTP::Get.new(searchurl.path)
|
110
|
+
http = Net::HTTP.new(searchurl.host, searchurl.port)
|
111
|
+
http.read_timeout = DEFAULT_TIMEOUT
|
112
|
+
|
113
|
+
puts "#{searchurl.path}?#{searchurl.query}"
|
114
|
+
|
115
|
+
res = http.start { |http|
|
116
|
+
http.get("#{searchurl.path}?#{searchurl.query}")
|
117
|
+
}
|
118
|
+
|
119
|
+
if (200..307).include?(res.code.to_i)
|
120
|
+
parsed_json = JSON.parse(res.body)
|
121
|
+
@endIndex = parsed_json["endIndex"]
|
122
|
+
@pageSize = parsed_json["pageSize"]
|
123
|
+
@searchTime = parsed_json["searchTime"]
|
124
|
+
@numberOfResults = parsed_json["numberOfResults"]
|
125
|
+
@results = parsed_json['_results'].collect { |a| Activity.new(a) }
|
126
|
+
else
|
127
|
+
raise RuntimeError, "Active Search responded with a #{res.code} for your query."
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# examples
|
132
|
+
#
|
133
|
+
# Search.new({:location => "San Diego"})
|
134
|
+
#
|
135
|
+
# Keywords can be set like this
|
136
|
+
# Search.new({:keywords => "Dog,Cat,Cow"})
|
137
|
+
# Search.new({:keywords => %w(Dog Cat Cow)})
|
138
|
+
# Search.new({:keywords => ["Dog","Cat","Cow"]})
|
139
|
+
#
|
140
|
+
# http://developer.active.com/docs/Activecom_Search_API_Reference
|
141
|
+
# returns an array of results and query info
|
142
|
+
def self.search(data=nil)
|
143
|
+
search = Search.new(data)
|
144
|
+
search.search
|
145
|
+
return search
|
146
|
+
end
|
147
|
+
|
148
|
+
def self.construct_url(arg_options={})
|
149
|
+
return arg_options[:url] if arg_options.keys.index(:url) #todo use has_key? #a search url was specified - bypass parsing the options (trending)
|
150
|
+
# self.merge!(arg_options)
|
151
|
+
|
152
|
+
# options[:location] = CGI.escape(options[:location]) if options[:location]
|
153
|
+
|
154
|
+
# if options[:keywords].class == String
|
155
|
+
# options[:keywords] = options[:keywords].split(",")
|
156
|
+
# options[:keywords].each { |k| k.strip! }
|
157
|
+
# end
|
158
|
+
|
159
|
+
# if options[:channels] != nil
|
160
|
+
# channel_keys = []
|
161
|
+
# options[:channels].each do |c|
|
162
|
+
# c.to_sym
|
163
|
+
# if self.CHANNELS.include?(c)
|
164
|
+
# channel_keys << self.CHANNELS[c]
|
165
|
+
# end
|
166
|
+
# end
|
167
|
+
# channels_a = channel_keys.collect { |channel| "meta:channel=#{Search.double_encode_channel(channel)}" }
|
168
|
+
# end
|
169
|
+
|
170
|
+
meta_data = ""
|
171
|
+
meta_data = channels_a.join("+OR+") if channels_a
|
172
|
+
|
173
|
+
meta_data += "+AND+" unless meta_data == ""
|
174
|
+
if options[:start_date].class == Date
|
175
|
+
options[:start_date] = URI.escape(options[:start_date].strftime("%m/%d/%Y")).gsub(/\//,"%2F")
|
176
|
+
end
|
177
|
+
|
178
|
+
if options[:end_date].class == Date
|
179
|
+
options[:end_date] = URI.escape(options[:end_date].strftime("%m/%d/%Y")).gsub(/\//,"%2F")
|
180
|
+
end
|
181
|
+
meta_data += "meta:startDate:daterange:#{options[:start_date]}..#{options[:end_date]}"
|
182
|
+
|
183
|
+
url = "#{SEARCH_URL}/search?api_key=#{options[:api_key]}&num=#{options[:num_results]}&page=#{options[:page]}&l=#{options[:location]}&f=#{options[:facet]}&v=#{options[:view]}&r=#{options[:radius]}&s=#{options[:sort]}&k=#{options[:keywords].join("+")}&m=#{meta_data}"
|
184
|
+
puts url
|
185
|
+
url
|
186
|
+
self.end_point = url
|
187
|
+
end
|
188
|
+
|
189
|
+
private
|
190
|
+
def self.double_encode_channel str
|
191
|
+
str = URI.escape(str, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
192
|
+
str = URI.escape(str, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
193
|
+
str.gsub!(/\-/,"%252D")
|
194
|
+
str
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
class Categories
|
38
200
|
def self.CHANNELS
|
39
201
|
{
|
40
202
|
:active_lifestyle => '',
|
@@ -160,104 +322,7 @@ module Active
|
|
160
322
|
:wrestling => 'Wrestling'
|
161
323
|
}
|
162
324
|
end
|
163
|
-
|
164
|
-
|
165
|
-
# http://developer.active.com/docs/Activecom_Search_API_Reference
|
166
|
-
#
|
167
|
-
def self.search(data=nil)
|
168
|
-
searchurl = URI.parse(construct_url(data))
|
169
|
-
req = Net::HTTP::Get.new(searchurl.path)
|
170
|
-
http = Net::HTTP.new(searchurl.host, searchurl.port)
|
171
|
-
http.read_timeout = DEFAULT_TIMEOUT
|
172
|
-
|
173
|
-
res = http.start { |http|
|
174
|
-
http.get("#{searchurl.path}?#{searchurl.query}")
|
175
|
-
}
|
176
|
-
|
177
|
-
# if res.code == '200' or res.code == '307'
|
178
|
-
if (200..307).include?(res.code.to_i)
|
179
|
-
parsed_json = JSON.parse(res.body)
|
180
|
-
return parsed_json["numberOfResults"] if data.has_key?(:show_number_of_results)
|
181
|
-
query_addl_info= {:endIndex=>parsed_json["endIndex"], :pageSize=>parsed_json["pageSize"], :searchTime=>parsed_json["searchTime"], :numberOfResults=>parsed_json["numberOfResults"]}
|
182
|
-
parsed_json['_results'].collect { |a| Activity.new(a.merge query_addl_info) }
|
183
|
-
else
|
184
|
-
raise RuntimeError, "Active Search responded with a #{res.code} for your query."
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
def self.construct_url(arg_options={})
|
189
|
-
options = {
|
190
|
-
:api_key => "",
|
191
|
-
:view => "json",
|
192
|
-
:facet => Facet.ACTIVITIES,
|
193
|
-
:sort => Sort.DATE_ASC,
|
194
|
-
:radius => "50",
|
195
|
-
:meta => "",
|
196
|
-
:num_results => "10",
|
197
|
-
:page => "1",
|
198
|
-
:location => "",
|
199
|
-
:search => "",
|
200
|
-
:keywords => [],
|
201
|
-
:channels => nil,
|
202
|
-
:start_date => "today",
|
203
|
-
:end_date => "+"
|
204
|
-
}
|
205
|
-
options.merge!(arg_options)
|
206
|
-
|
207
|
-
return arg_options[:url] if arg_options.keys.index(:url) #a search url was specified - bypass parsing the options (trending)
|
208
|
-
|
209
|
-
options[:location] = CGI.escape(options[:location]) if options[:location]
|
210
|
-
|
211
|
-
if options[:keywords].class == String
|
212
|
-
options[:keywords] = options[:keywords].split(",")
|
213
|
-
options[:keywords].each { |k| k.strip! }
|
214
|
-
end
|
215
|
-
if options[:channels] != nil
|
216
|
-
|
217
|
-
channel_keys = []
|
218
|
-
options[:channels].each do |c|
|
219
|
-
c.to_sym
|
220
|
-
if self.CHANNELS.include?(c)
|
221
|
-
channel_keys << self.CHANNELS[c]
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
channels_a = channel_keys.collect { |channel| "meta:channel=#{Search.double_encode_channel(channel)}" }
|
226
|
-
end
|
227
|
-
|
228
|
-
meta_data = ""
|
229
|
-
meta_data = channels_a.join("+OR+") if channels_a
|
230
|
-
|
231
|
-
meta_data += "+AND+" unless meta_data == ""
|
232
|
-
if options[:start_date].class == Date
|
233
|
-
options[:start_date] = URI.escape(options[:start_date].strftime("%m/%d/%Y")).gsub(/\//,"%2F")
|
234
|
-
end
|
235
|
-
|
236
|
-
if options[:end_date].class == Date
|
237
|
-
options[:end_date] = URI.escape(options[:end_date].strftime("%m/%d/%Y")).gsub(/\//,"%2F")
|
238
|
-
end
|
239
|
-
meta_data += "meta:startDate:daterange:#{options[:start_date]}..#{options[:end_date]}"
|
240
|
-
|
241
|
-
# if @asset_type_id!=nil
|
242
|
-
# @meta = @meta + "+AND+" if @meta!=""
|
243
|
-
# @meta = @meta + "inmeta:assetTypeId=#{@asset_type_id}"
|
244
|
-
# end
|
245
|
-
#
|
246
|
-
url = "#{SEARCH_URL}/search?api_key=#{options[:api_key]}&num=#{options[:num_results]}&page=#{options[:page]}&l=#{options[:location]}&f=#{options[:facet]}&v=#{options[:view]}&r=#{options[:radius]}&s=#{options[:sort]}&k=#{options[:keywords].join("+")}&m=#{meta_data}"
|
247
|
-
puts "//////"
|
248
|
-
puts url
|
249
|
-
puts "//////"
|
250
|
-
url
|
251
|
-
end
|
252
|
-
|
253
|
-
private
|
254
|
-
def self.double_encode_channel str
|
255
|
-
str = URI.escape(str, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
256
|
-
str = URI.escape(str, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
257
|
-
str.gsub!(/\-/,"%252D")
|
258
|
-
str
|
259
|
-
end
|
260
|
-
|
261
325
|
end
|
326
|
+
|
262
327
|
end
|
263
328
|
end
|
data/spec/activity_spec.rb
CHANGED
@@ -63,8 +63,12 @@ describe Activity do
|
|
63
63
|
|
64
64
|
it "should strip out unicode from the title"
|
65
65
|
|
66
|
-
it "should use the first group if title contains pipes."
|
67
|
-
|
66
|
+
it "should use the first group if title contains pipes."
|
67
|
+
|
68
|
+
it "should have 2 channels" do
|
69
|
+
a = Activity.new(@valid_attributes)
|
70
|
+
a.categories.should be_an_instance_of(Array)
|
71
|
+
a.should have(2).categories
|
68
72
|
end
|
69
73
|
|
70
74
|
it "should be a valid activity" do
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. lib Active]))
|
3
|
+
include Active::Services
|
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
|
@@ -0,0 +1,27 @@
|
|
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/search_spec.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require 'fake_web'
|
2
2
|
# Require the spec helper relative to this file
|
3
3
|
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
4
|
+
require File.join(File.dirname(__FILE__), %w[custom_matchers_spec])
|
4
5
|
require File.join(File.dirname(__FILE__), %w[ .. lib services search])
|
5
6
|
require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
|
6
|
-
|
7
|
-
# No need to type Britify:: before each call
|
8
7
|
include Active::Services
|
9
8
|
|
10
9
|
describe "Set up" do
|
@@ -13,104 +12,134 @@ describe "Set up" do
|
|
13
12
|
it "should call search.active.com when told to"
|
14
13
|
end
|
15
14
|
|
16
|
-
describe "Handle http server codes" do
|
17
|
-
after(:each) do
|
18
|
-
FakeWeb.clean_registry
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should follow a 302" do
|
22
|
-
FakeWeb.register_uri(:get, "http://search.active.com/search?api_key=&num=10&page=1&l=San+Diego%2C+CA%2C+US&f=activities&v=json&r=10&s=date_asc&k=&m=meta:startDate:daterange:today..+",
|
23
|
-
:body => '{"endIndex":5,"numberOfResults":2,"pageSize":5,"searchTime":0.600205,"_results":[{"escapedUrl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","language": "en","title": "Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","summary": "\u003cb\u003e...\u003c/b\u003e Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs. Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e Recent Reviews Calabasas\u003cbr\u003e Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs reviews. Get Directions. Start Address. End Address \u003cb\u003e...\u003c/b\u003e ","meta": {"startDate": "2010-11-14","eventDate": "2010-11-14T08:00:00-08:00","location": "Calabasas Park Centre","tag": ["event:10", "Green:10", "Running:10"],"state": "California","eventLongitude": "-118.6789","endDate": "2010-11-14","locationName": "Calabasas Park Centre","splitMediaType": ["Event", "1 mile", "10K", "5K"],"endTime": "8:00:00","mediaType": ["Event", "Event\\1 mile", "Event\\10K", "Event\\5K"],"google-site-verification": "","city": "Calabasas","startTime": "8:00:00","assetId": ["11B01475-8C65-4F9C-A4AC-2A3FA55FE8CD", "11b01475-8c65-4f9c-a4ac-2a3fa55fe8cd"],"eventId": "1810531","participationCriteria": "All","description": "","longitude": "-118.6789","onlineDonationAvailable": "false","substitutionUrl": "1810531","assetName": ["Calabasas Classic 2010 - 5k 10k Runs", "Calabasas Classic 2010 - 5k 10k Runs"],"zip": "91302","contactPhone": "818-715-0428","sortDate": "2000-11-14","eventState": "California","eventLatitude": "34.12794","keywords": "Event","eventAddress": "23975 Park Sorrento","contactEmail": "rot10kd@yahoo.com","onlineMembershipAvailable": "false","trackbackurl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://www.active.com/images/events/hotrace.gif","assetTypeId": "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate": "2010-03-04 07:30:26.307","eventZip": "91302","latitude": "34.12794","UpdateDateTime": "8/18/2010 10:16:26 AM","channel": ["Running", "Walking"]}},
|
24
|
-
{"escapedUrl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","language": "en","title": "Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10/17, 11/21) \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","summary": "\u003cb\u003e...\u003c/b\u003e Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10/17, 11/21). Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e\u003cbr\u003e Reviews of Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10. \u003cb\u003e...\u003c/b\u003e ","meta": {"summary": "\u003cp style\u003dtext-align:left\u003e\u003cfont style\u003dfont-family:UniversEmbedded;font-size:12;color:#000000; LETTERSPACING\u003d0 KERNING\u003d0\u003eRace or walk on a flat, fast, and fun course! The entire event is along the Puget Sound. Do all 3 events in the series and watch your time and fitness improve! Oatmeal post-race. 10% proceeds sh","startDate": "2010-09-19","eventDate": "2010-09-19","location": "Alki Beach Park, Seattle","tag": ["event:10", "Running:10"],"state": "Washington","endDate": "2010-11-22","locationName": "1702 Alki Ave. SW","splitMediaType": ["5K", "difficulty:Beginner", "difficulty:Advanced", "Event", "difficulty:Intermediate", "10K"],"lastModifiedDateTime": "2010-08-19 23:35:50.117","endTime": "07:59:59","mediaType": ["5K", "difficulty:Beginner", "difficulty:Advanced", "Event", "difficulty:Intermediate", "10K"],"google-site-verification": "","city": "Seattle","startTime": "07:00:00","assetId": ["39e8177e-dd0e-42a2-8a2b-24055e5325f3", "39e8177e-dd0e-42a2-8a2b-24055e5325f3"],"eventId": "E-000NGFS9","participationCriteria": "Kids,Family","description": "","longitude": "-122.3912","substitutionUrl": "E-000NGFS9","assetName": ["Fitness For Vitality 5k/10k 3-Race Series (9/19, 10/17, 11/21)", "Fitness For Vitality 5k/10k 3-Race Series (9/19, 10/17, 11/21)"],"zip": "98136","contactPhone": "n/a","eventState": "WA","sortDate": "2000-09-19","keywords": "Event","eventAddress": "1702 Alki Ave. SW","contactEmail": "n/a","dma": "Seattle - Tacoma","trackbackurl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","seourl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://photos-images.active.com/file/3/1/optimized/9015e50d-3a2e-4ce4-9ddc-80b05b973b01.jpg","allText": "\u003cp style\u003dtext-align:left\u003e\u003cfont style\u003dfont-family:UniversEmbedded;font-size:12;color:#000000; LETTERSPACING\u003d0 KERNING\u003d0\u003eRace or walk on a flat, fast, and fun course! The entire event is along the Puget Sound. Do all 3 events in the series and watch your time and fitness improve! Oatmeal post-race. 10% proceeds sh","address": "1702 Alki Ave. SW","assetTypeId": "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1","lastModifiedDate": "2010-08-19","eventZip": "98136","latitude": "47.53782","UpdateDateTime": "8/18/2010 10:16:08 AM","channel": "Running"}},
|
25
|
-
{"escapedUrl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","language": "en","title": "Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","summary": "\u003cb\u003e...\u003c/b\u003e Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs. Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e Recent Reviews Calabasas\u003cbr\u003e Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs reviews. Get Directions. Start Address. End Address \u003cb\u003e...\u003c/b\u003e ","meta": {"startDate": "2010-11-14","eventDate": "2010-11-14T08:00:00-08:00","location": "Calabasas Park Centre","tag": ["event:10", "Green:10", "Running:10"],"state": "California","eventLongitude": "-118.6789","endDate": "2010-11-14","locationName": "Calabasas Park Centre","splitMediaType": ["Event", "1 mile", "10K", "5K"],"endTime": "8:00:00","mediaType": ["Event", "Event\\1 mile", "Event\\10K", "Event\\5K"],"google-site-verification": "","city": "Calabasas","startTime": "8:00:00","assetId": ["11B01475-8C65-4F9C-A4AC-2A3FA55FE8CD", "11b01475-8c65-4f9c-a4ac-2a3fa55fe8cd"],"eventId": "1810531","participationCriteria": "All","description": "","longitude": "-118.6789","onlineDonationAvailable": "false","substitutionUrl": "1810531","assetName": ["Calabasas Classic 2010 - 5k 10k Runs", "Calabasas Classic 2010 - 5k 10k Runs"],"zip": "91302","contactPhone": "818-715-0428","sortDate": "2000-11-14","eventState": "California","eventLatitude": "34.12794","keywords": "Event","eventAddress": "23975 Park Sorrento","contactEmail": "rot10kd@yahoo.com","onlineMembershipAvailable": "false","trackbackurl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://www.active.com/images/events/hotrace.gif","assetTypeId": "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate": "2010-03-04 07:30:26.307","eventZip": "91302","latitude": "34.12794","UpdateDateTime": "8/18/2010 10:16:26 AM","channel": ["Running", "Walking"]}}]}',
|
26
|
-
:status => ["302", "Found"])
|
27
|
-
results = Search.search( {:location => "San Diego, CA, US"} )
|
28
|
-
results.should have(3).items
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
15
|
describe "Search URL Construction" do
|
34
|
-
|
35
|
-
it "should
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
uri.query.include?("l=#{CGI.escape("San Diego, CA, US")}").should be_true
|
16
|
+
include CustomMatchers
|
17
|
+
it "should escape the location" do
|
18
|
+
s = Search.new()
|
19
|
+
s.location.should eql("")
|
20
|
+
s = Search.new({:location => "San Diego"})
|
21
|
+
s.location.should eql("San+Diego")
|
41
22
|
end
|
42
23
|
|
43
|
-
it "should
|
44
|
-
|
45
|
-
|
24
|
+
it "should have an array of keywords" do
|
25
|
+
s = Search.new()
|
26
|
+
s.should have(0).keywords
|
27
|
+
s = Search.new({:keywords => "Dog,Cat,Cow"})
|
28
|
+
s.should have(3).keywords
|
29
|
+
s = Search.new({:keywords => %w(Dog Cat Cow)})
|
30
|
+
s.should have(3).keywords
|
31
|
+
s = Search.new({:keywords => ["Dog","Cat","Cow"]})
|
32
|
+
s.should have(3).keywords
|
46
33
|
end
|
47
|
-
|
48
|
-
it "should
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
34
|
+
|
35
|
+
it "should have an array of channels" do
|
36
|
+
s = Search.new()
|
37
|
+
s.should have(0).channels
|
38
|
+
s = Search.new({:channels => "running,swimming,yoga"})
|
39
|
+
s.should have(3).channels
|
40
|
+
s = Search.new({:channels => %w(running swimming yoga)})
|
41
|
+
s.should have(3).channels
|
42
|
+
s = Search.new({:channels => ["running","swimming","yoga"]})
|
43
|
+
s.should have(3).channels
|
56
44
|
end
|
57
45
|
|
58
46
|
it "should have defaults set" do
|
59
|
-
|
47
|
+
s = Search.new()
|
48
|
+
uri = URI.parse( s.end_point )
|
60
49
|
uri.query.include?("f=#{Facet.ACTIVITIES}").should be_true
|
61
50
|
uri.query.include?("s=#{Sort.DATE_ASC}").should be_true
|
62
51
|
uri.query.include?("r=50").should be_true
|
63
52
|
uri.query.include?("v=json").should be_true
|
64
53
|
uri.query.include?("page=1").should be_true
|
65
|
-
uri.query.
|
66
|
-
uri.query.
|
54
|
+
uri.query.should have_param("num=10")
|
55
|
+
uri.query.should have_param("daterange:today..+")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should construct a valid url with location" do
|
59
|
+
s = Search.new( {:location => "San Diego, CA, US"} )
|
60
|
+
uri = URI.parse(s.end_point)
|
61
|
+
uri.scheme.should eql("http")
|
62
|
+
uri.host.should eql("search.active.com")
|
63
|
+
uri.query.should have_param("l=#{CGI.escape("San Diego, CA, US")}")
|
64
|
+
end
|
65
|
+
|
66
|
+
# it "should construct a valid url from a zip code" do
|
67
|
+
# s = Search.new( {:zip => "92121"} )
|
68
|
+
# uri = URI.parse(s.end_point)
|
69
|
+
# uri.query.should have_param("l=#{CGI.escape("92121")}")
|
70
|
+
# end
|
71
|
+
|
72
|
+
it "should construct a valid url with CSV keywords" do
|
73
|
+
s = Search.new( {:keywords => "running, tri"} )
|
74
|
+
uri = URI.parse( s.end_point )
|
75
|
+
uri.query.should have_param("k=running+tri")
|
76
|
+
s = Search.new( {:keywords => ["running","tri","cycling"]} )
|
77
|
+
uri = URI.parse( s.end_point )
|
78
|
+
uri.query.should have_param("k=running+tri+cycling")
|
67
79
|
end
|
68
80
|
|
69
81
|
it "should construct a valid url with channels array" do
|
70
|
-
|
71
|
-
uri.
|
82
|
+
s = Search.new( {:channels => [:running, :tri,:cycling, :yoga]} )
|
83
|
+
uri = URI.parse( s.end_point )
|
84
|
+
uri.query.should have_param("m=meta:channel=Running+OR+meta:channel=Cycling+OR+meta:channel=Mind%2520%2526%2520Body%255CYoga")
|
72
85
|
end
|
73
86
|
|
74
87
|
it "should send valid channel info" do
|
75
|
-
uri = URI.parse( Search.
|
88
|
+
uri = URI.parse( Search.new({:channels => [:running,:triathlon]}).end_point )
|
76
89
|
uri.query.include?("meta:channel=Running+OR+meta:channel=Triathlon").should be_true
|
77
90
|
end
|
78
91
|
|
79
92
|
it "should send the correct channel value for everything in Search.CHANNELS" do
|
80
|
-
|
81
|
-
uri
|
93
|
+
Categories.CHANNELS.each do |key,value|
|
94
|
+
uri = URI.parse( Search.new({:channels => [key]}).end_point )
|
82
95
|
value = URI.escape(value, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
83
96
|
value = URI.escape(value, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
84
97
|
value.gsub!(/\-/,"%252D")
|
85
|
-
uri.query.
|
98
|
+
uri.query.should have_param("meta:channel=#{value}")
|
86
99
|
end
|
87
100
|
end
|
88
101
|
|
89
102
|
it "should send a valid start and end date" do
|
90
|
-
uri = URI.parse( Search.
|
91
|
-
uri.query.
|
103
|
+
uri = URI.parse( Search.new().end_point )
|
104
|
+
uri.query.should have_param("daterange:today..+")
|
92
105
|
end
|
93
106
|
|
94
107
|
it "should send a valid start and end date" do
|
95
|
-
uri = URI.parse( Search.
|
108
|
+
uri = URI.parse( Search.new({:start_date => Date.new(2010, 11, 1), :end_date => Date.new(2010, 11, 15)}).end_point )
|
96
109
|
uri.query.include?("meta:startDate:daterange:11%2F01%2F2010..11%2F15%2F2010").should be_true
|
97
110
|
end
|
98
111
|
|
99
112
|
it "should be valid with date range and channels" do
|
100
|
-
uri = URI.parse( Search.
|
113
|
+
uri = URI.parse( Search.new({:channels => [:running, :triathlon],
|
101
114
|
:start_date => Date.new(2010, 11, 1),
|
102
|
-
:end_date => Date.new(2010, 11, 15)}) )
|
103
|
-
uri.query.
|
104
|
-
uri.query.
|
115
|
+
:end_date => Date.new(2010, 11, 15)}).end_point )
|
116
|
+
uri.query.should have_param("meta:channel=Running+OR+meta:channel=Triathlon")
|
117
|
+
uri.query.should have_param("daterange:11%2F01%2F2010..11%2F15%2F2010")
|
105
118
|
end
|
106
119
|
|
107
120
|
it "should pass the search radius" do
|
108
|
-
uri = URI.parse( Search.
|
109
|
-
uri.query.
|
121
|
+
uri = URI.parse( Search.new({:radius => '666'}).end_point )
|
122
|
+
uri.query.should have_param("r=666")
|
110
123
|
end
|
111
124
|
|
112
125
|
end
|
113
126
|
|
127
|
+
describe "Handle http server codes" do
|
128
|
+
after(:each) do
|
129
|
+
FakeWeb.clean_registry
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should follow a 302" do
|
133
|
+
FakeWeb.register_uri(:get, "http://search.active.com/search?api_key=&num=10&page=1&l=San+Diego%2C+CA%2C+US&f=activities&v=json&r=50&s=date_asc&k=&m=meta:startDate:daterange:today..+",
|
134
|
+
:body => '{"endIndex":3,"numberOfResults":3,"pageSize":3,"searchTime":0.600205,"_results":[{"escapedUrl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","language": "en","title": "Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","summary": "\u003cb\u003e...\u003c/b\u003e Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs. Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e Recent Reviews Calabasas\u003cbr\u003e Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs reviews. Get Directions. Start Address. End Address \u003cb\u003e...\u003c/b\u003e ","meta": {"startDate": "2010-11-14","eventDate": "2010-11-14T08:00:00-08:00","location": "Calabasas Park Centre","tag": ["event:10", "Green:10", "Running:10"],"state": "California","eventLongitude": "-118.6789","endDate": "2010-11-14","locationName": "Calabasas Park Centre","splitMediaType": ["Event", "1 mile", "10K", "5K"],"endTime": "8:00:00","mediaType": ["Event", "Event\\1 mile", "Event\\10K", "Event\\5K"],"google-site-verification": "","city": "Calabasas","startTime": "8:00:00","assetId": ["11B01475-8C65-4F9C-A4AC-2A3FA55FE8CD", "11b01475-8c65-4f9c-a4ac-2a3fa55fe8cd"],"eventId": "1810531","participationCriteria": "All","description": "","longitude": "-118.6789","onlineDonationAvailable": "false","substitutionUrl": "1810531","assetName": ["Calabasas Classic 2010 - 5k 10k Runs", "Calabasas Classic 2010 - 5k 10k Runs"],"zip": "91302","contactPhone": "818-715-0428","sortDate": "2000-11-14","eventState": "California","eventLatitude": "34.12794","keywords": "Event","eventAddress": "23975 Park Sorrento","contactEmail": "rot10kd@yahoo.com","onlineMembershipAvailable": "false","trackbackurl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://www.active.com/images/events/hotrace.gif","assetTypeId": "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate": "2010-03-04 07:30:26.307","eventZip": "91302","latitude": "34.12794","UpdateDateTime": "8/18/2010 10:16:26 AM","channel": ["Running", "Walking"]}},
|
135
|
+
{"escapedUrl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","language": "en","title": "Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10/17, 11/21) \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","summary": "\u003cb\u003e...\u003c/b\u003e Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10/17, 11/21). Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e\u003cbr\u003e Reviews of Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10. \u003cb\u003e...\u003c/b\u003e ","meta": {"summary": "\u003cp style\u003dtext-align:left\u003e\u003cfont style\u003dfont-family:UniversEmbedded;font-size:12;color:#000000; LETTERSPACING\u003d0 KERNING\u003d0\u003eRace or walk on a flat, fast, and fun course! The entire event is along the Puget Sound. Do all 3 events in the series and watch your time and fitness improve! Oatmeal post-race. 10% proceeds sh","startDate": "2010-09-19","eventDate": "2010-09-19","location": "Alki Beach Park, Seattle","tag": ["event:10", "Running:10"],"state": "Washington","endDate": "2010-11-22","locationName": "1702 Alki Ave. SW","splitMediaType": ["5K", "difficulty:Beginner", "difficulty:Advanced", "Event", "difficulty:Intermediate", "10K"],"lastModifiedDateTime": "2010-08-19 23:35:50.117","endTime": "07:59:59","mediaType": ["5K", "difficulty:Beginner", "difficulty:Advanced", "Event", "difficulty:Intermediate", "10K"],"google-site-verification": "","city": "Seattle","startTime": "07:00:00","assetId": ["39e8177e-dd0e-42a2-8a2b-24055e5325f3", "39e8177e-dd0e-42a2-8a2b-24055e5325f3"],"eventId": "E-000NGFS9","participationCriteria": "Kids,Family","description": "","longitude": "-122.3912","substitutionUrl": "E-000NGFS9","assetName": ["Fitness For Vitality 5k/10k 3-Race Series (9/19, 10/17, 11/21)", "Fitness For Vitality 5k/10k 3-Race Series (9/19, 10/17, 11/21)"],"zip": "98136","contactPhone": "n/a","eventState": "WA","sortDate": "2000-09-19","keywords": "Event","eventAddress": "1702 Alki Ave. SW","contactEmail": "n/a","dma": "Seattle - Tacoma","trackbackurl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","seourl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://photos-images.active.com/file/3/1/optimized/9015e50d-3a2e-4ce4-9ddc-80b05b973b01.jpg","allText": "\u003cp style\u003dtext-align:left\u003e\u003cfont style\u003dfont-family:UniversEmbedded;font-size:12;color:#000000; LETTERSPACING\u003d0 KERNING\u003d0\u003eRace or walk on a flat, fast, and fun course! The entire event is along the Puget Sound. Do all 3 events in the series and watch your time and fitness improve! Oatmeal post-race. 10% proceeds sh","address": "1702 Alki Ave. SW","assetTypeId": "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1","lastModifiedDate": "2010-08-19","eventZip": "98136","latitude": "47.53782","UpdateDateTime": "8/18/2010 10:16:08 AM","channel": "Running"}},
|
136
|
+
{"escapedUrl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","language": "en","title": "Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","summary": "\u003cb\u003e...\u003c/b\u003e Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs. Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e Recent Reviews Calabasas\u003cbr\u003e Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs reviews. Get Directions. Start Address. End Address \u003cb\u003e...\u003c/b\u003e ","meta": {"startDate": "2010-11-14","eventDate": "2010-11-14T08:00:00-08:00","location": "Calabasas Park Centre","tag": ["event:10", "Green:10", "Running:10"],"state": "California","eventLongitude": "-118.6789","endDate": "2010-11-14","locationName": "Calabasas Park Centre","splitMediaType": ["Event", "1 mile", "10K", "5K"],"endTime": "8:00:00","mediaType": ["Event", "Event\\1 mile", "Event\\10K", "Event\\5K"],"google-site-verification": "","city": "Calabasas","startTime": "8:00:00","assetId": ["11B01475-8C65-4F9C-A4AC-2A3FA55FE8CD", "11b01475-8c65-4f9c-a4ac-2a3fa55fe8cd"],"eventId": "1810531","participationCriteria": "All","description": "","longitude": "-118.6789","onlineDonationAvailable": "false","substitutionUrl": "1810531","assetName": ["Calabasas Classic 2010 - 5k 10k Runs", "Calabasas Classic 2010 - 5k 10k Runs"],"zip": "91302","contactPhone": "818-715-0428","sortDate": "2000-11-14","eventState": "California","eventLatitude": "34.12794","keywords": "Event","eventAddress": "23975 Park Sorrento","contactEmail": "rot10kd@yahoo.com","onlineMembershipAvailable": "false","trackbackurl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://www.active.com/images/events/hotrace.gif","assetTypeId": "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate": "2010-03-04 07:30:26.307","eventZip": "91302","latitude": "34.12794","UpdateDateTime": "8/18/2010 10:16:26 AM","channel": ["Running", "Walking"]}}]}',
|
137
|
+
:status => ["302", "Found"])
|
138
|
+
s = Search.search( {:location => "San Diego, CA, US"} )
|
139
|
+
s.should have(3).results
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
114
143
|
|
115
144
|
describe Search do
|
116
145
|
after(:each) do
|
@@ -118,24 +147,40 @@ describe Search do
|
|
118
147
|
end
|
119
148
|
|
120
149
|
it "should have some channels" do
|
121
|
-
|
150
|
+
Categories.CHANNELS.should_not be_nil
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should describe pagination info on search object" do
|
154
|
+
FakeWeb.register_uri(:get, "http://search.active.com/search?api_key=&num=10&page=1&l=San+Diego%2C+CA%2C+US&f=activities&v=json&r=50&s=date_asc&k=&m=meta:startDate:daterange:today..+",
|
155
|
+
:body => '{"endIndex":3,"numberOfResults":3,"pageSize":5,"searchTime":0.600205,"_results":[{"escapedUrl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","language": "en","title": "Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","summary": "\u003cb\u003e...\u003c/b\u003e Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs. Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e Recent Reviews Calabasas\u003cbr\u003e Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs reviews. Get Directions. Start Address. End Address \u003cb\u003e...\u003c/b\u003e ","meta": {"startDate": "2010-11-14","eventDate": "2010-11-14T08:00:00-08:00","location": "Calabasas Park Centre","tag": ["event:10", "Green:10", "Running:10"],"state": "California","eventLongitude": "-118.6789","endDate": "2010-11-14","locationName": "Calabasas Park Centre","splitMediaType": ["Event", "1 mile", "10K", "5K"],"endTime": "8:00:00","mediaType": ["Event", "Event\\1 mile", "Event\\10K", "Event\\5K"],"google-site-verification": "","city": "Calabasas","startTime": "8:00:00","assetId": ["11B01475-8C65-4F9C-A4AC-2A3FA55FE8CD", "11b01475-8c65-4f9c-a4ac-2a3fa55fe8cd"],"eventId": "1810531","participationCriteria": "All","description": "","longitude": "-118.6789","onlineDonationAvailable": "false","substitutionUrl": "1810531","assetName": ["Calabasas Classic 2010 - 5k 10k Runs", "Calabasas Classic 2010 - 5k 10k Runs"],"zip": "91302","contactPhone": "818-715-0428","sortDate": "2000-11-14","eventState": "California","eventLatitude": "34.12794","keywords": "Event","eventAddress": "23975 Park Sorrento","contactEmail": "rot10kd@yahoo.com","onlineMembershipAvailable": "false","trackbackurl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://www.active.com/images/events/hotrace.gif","assetTypeId": "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate": "2010-03-04 07:30:26.307","eventZip": "91302","latitude": "34.12794","UpdateDateTime": "8/18/2010 10:16:26 AM","channel": ["Running", "Walking"]}},
|
156
|
+
{"escapedUrl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","language": "en","title": "Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10/17, 11/21) \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","summary": "\u003cb\u003e...\u003c/b\u003e Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10/17, 11/21). Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e\u003cbr\u003e Reviews of Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10. \u003cb\u003e...\u003c/b\u003e ","meta": {"summary": "\u003cp style\u003dtext-align:left\u003e\u003cfont style\u003dfont-family:UniversEmbedded;font-size:12;color:#000000; LETTERSPACING\u003d0 KERNING\u003d0\u003eRace or walk on a flat, fast, and fun course! The entire event is along the Puget Sound. Do all 3 events in the series and watch your time and fitness improve! Oatmeal post-race. 10% proceeds sh","startDate": "2010-09-19","eventDate": "2010-09-19","location": "Alki Beach Park, Seattle","tag": ["event:10", "Running:10"],"state": "Washington","endDate": "2010-11-22","locationName": "1702 Alki Ave. SW","splitMediaType": ["5K", "difficulty:Beginner", "difficulty:Advanced", "Event", "difficulty:Intermediate", "10K"],"lastModifiedDateTime": "2010-08-19 23:35:50.117","endTime": "07:59:59","mediaType": ["5K", "difficulty:Beginner", "difficulty:Advanced", "Event", "difficulty:Intermediate", "10K"],"google-site-verification": "","city": "Seattle","startTime": "07:00:00","assetId": ["39e8177e-dd0e-42a2-8a2b-24055e5325f3", "39e8177e-dd0e-42a2-8a2b-24055e5325f3"],"eventId": "E-000NGFS9","participationCriteria": "Kids,Family","description": "","longitude": "-122.3912","substitutionUrl": "E-000NGFS9","assetName": ["Fitness For Vitality 5k/10k 3-Race Series (9/19, 10/17, 11/21)", "Fitness For Vitality 5k/10k 3-Race Series (9/19, 10/17, 11/21)"],"zip": "98136","contactPhone": "n/a","eventState": "WA","sortDate": "2000-09-19","keywords": "Event","eventAddress": "1702 Alki Ave. SW","contactEmail": "n/a","dma": "Seattle - Tacoma","trackbackurl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","seourl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://photos-images.active.com/file/3/1/optimized/9015e50d-3a2e-4ce4-9ddc-80b05b973b01.jpg","allText": "\u003cp style\u003dtext-align:left\u003e\u003cfont style\u003dfont-family:UniversEmbedded;font-size:12;color:#000000; LETTERSPACING\u003d0 KERNING\u003d0\u003eRace or walk on a flat, fast, and fun course! The entire event is along the Puget Sound. Do all 3 events in the series and watch your time and fitness improve! Oatmeal post-race. 10% proceeds sh","address": "1702 Alki Ave. SW","assetTypeId": "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1","lastModifiedDate": "2010-08-19","eventZip": "98136","latitude": "47.53782","UpdateDateTime": "8/18/2010 10:16:08 AM","channel": "Running"}},
|
157
|
+
{"escapedUrl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","language": "en","title": "Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","summary": "\u003cb\u003e...\u003c/b\u003e Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs. Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e Recent Reviews Calabasas\u003cbr\u003e Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs reviews. Get Directions. Start Address. End Address \u003cb\u003e...\u003c/b\u003e ","meta": {"startDate": "2010-11-14","eventDate": "2010-11-14T08:00:00-08:00","location": "Calabasas Park Centre","tag": ["event:10", "Green:10", "Running:10"],"state": "California","eventLongitude": "-118.6789","endDate": "2010-11-14","locationName": "Calabasas Park Centre","splitMediaType": ["Event", "1 mile", "10K", "5K"],"endTime": "8:00:00","mediaType": ["Event", "Event\\1 mile", "Event\\10K", "Event\\5K"],"google-site-verification": "","city": "Calabasas","startTime": "8:00:00","assetId": ["11B01475-8C65-4F9C-A4AC-2A3FA55FE8CD", "11b01475-8c65-4f9c-a4ac-2a3fa55fe8cd"],"eventId": "1810531","participationCriteria": "All","description": "","longitude": "-118.6789","onlineDonationAvailable": "false","substitutionUrl": "1810531","assetName": ["Calabasas Classic 2010 - 5k 10k Runs", "Calabasas Classic 2010 - 5k 10k Runs"],"zip": "91302","contactPhone": "818-715-0428","sortDate": "2000-11-14","eventState": "California","eventLatitude": "34.12794","keywords": "Event","eventAddress": "23975 Park Sorrento","contactEmail": "rot10kd@yahoo.com","onlineMembershipAvailable": "false","trackbackurl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://www.active.com/images/events/hotrace.gif","assetTypeId": "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate": "2010-03-04 07:30:26.307","eventZip": "91302","latitude": "34.12794","UpdateDateTime": "8/18/2010 10:16:26 AM","channel": ["Running", "Walking"]}}]}',
|
158
|
+
:status => ["200", "Found"])
|
159
|
+
s = Search.search( {:location => "San Diego, CA, US"} )
|
160
|
+
s.should be_a_kind_of(Search)
|
161
|
+
s.should have(3).results
|
162
|
+
s.endIndex.should == 3
|
163
|
+
s.numberOfResults.should == 3
|
164
|
+
s.pageSize.should == 5
|
165
|
+
s.searchTime.should == 0.600205
|
122
166
|
end
|
123
167
|
|
124
168
|
it "should raise and error during a 404" do
|
125
|
-
FakeWeb.register_uri(:get, "http://search.active.com/search?api_key=&num=10&page=1&l=San+Diego%2C+CA%2C+US&f=activities&v=json&r=
|
169
|
+
FakeWeb.register_uri(:get, "http://search.active.com/search?api_key=&num=10&page=1&l=San+Diego%2C+CA%2C+US&f=activities&v=json&r=50&s=date_asc&k=&m=meta:startDate:daterange:today..+",
|
126
170
|
:body => "Nothing to be found 'round here", :status => ["404", "Not Found"])
|
127
171
|
lambda { Search.search( {:location => "San Diego, CA, US"} ) }.should raise_error(RuntimeError)
|
128
172
|
end
|
129
173
|
|
130
174
|
it "should search by location (san diego)" do
|
131
|
-
FakeWeb.register_uri(:get, "http://search.active.com/search?api_key=&num=10&page=1&l=San+Diego%2C+CA%2C+US&f=activities&v=json&r=
|
132
|
-
:body => '{"endIndex":
|
175
|
+
FakeWeb.register_uri(:get, "http://search.active.com/search?api_key=&num=10&page=1&l=San+Diego%2C+CA%2C+US&f=activities&v=json&r=50&s=date_asc&k=&m=meta:startDate:daterange:today..+",
|
176
|
+
:body => '{"endIndex":3,"numberOfResults":3,"pageSize":5,"searchTime":0.600205,"_results":[{"escapedUrl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","language": "en","title": "Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","summary": "\u003cb\u003e...\u003c/b\u003e Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs. Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e Recent Reviews Calabasas\u003cbr\u003e Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs reviews. Get Directions. Start Address. End Address \u003cb\u003e...\u003c/b\u003e ","meta": {"startDate": "2010-11-14","eventDate": "2010-11-14T08:00:00-08:00","location": "Calabasas Park Centre","tag": ["event:10", "Green:10", "Running:10"],"state": "California","eventLongitude": "-118.6789","endDate": "2010-11-14","locationName": "Calabasas Park Centre","splitMediaType": ["Event", "1 mile", "10K", "5K"],"endTime": "8:00:00","mediaType": ["Event", "Event\\1 mile", "Event\\10K", "Event\\5K"],"google-site-verification": "","city": "Calabasas","startTime": "8:00:00","assetId": ["11B01475-8C65-4F9C-A4AC-2A3FA55FE8CD", "11b01475-8c65-4f9c-a4ac-2a3fa55fe8cd"],"eventId": "1810531","participationCriteria": "All","description": "","longitude": "-118.6789","onlineDonationAvailable": "false","substitutionUrl": "1810531","assetName": ["Calabasas Classic 2010 - 5k 10k Runs", "Calabasas Classic 2010 - 5k 10k Runs"],"zip": "91302","contactPhone": "818-715-0428","sortDate": "2000-11-14","eventState": "California","eventLatitude": "34.12794","keywords": "Event","eventAddress": "23975 Park Sorrento","contactEmail": "rot10kd@yahoo.com","onlineMembershipAvailable": "false","trackbackurl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://www.active.com/images/events/hotrace.gif","assetTypeId": "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate": "2010-03-04 07:30:26.307","eventZip": "91302","latitude": "34.12794","UpdateDateTime": "8/18/2010 10:16:26 AM","channel": ["Running", "Walking"]}},
|
133
177
|
{"escapedUrl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","language": "en","title": "Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10/17, 11/21) \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","summary": "\u003cb\u003e...\u003c/b\u003e Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10/17, 11/21). Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e\u003cbr\u003e Reviews of Fitness For Vitality 5k/\u003cb\u003e10k\u003c/b\u003e 3-Race Series (9/19, 10. \u003cb\u003e...\u003c/b\u003e ","meta": {"summary": "\u003cp style\u003dtext-align:left\u003e\u003cfont style\u003dfont-family:UniversEmbedded;font-size:12;color:#000000; LETTERSPACING\u003d0 KERNING\u003d0\u003eRace or walk on a flat, fast, and fun course! The entire event is along the Puget Sound. Do all 3 events in the series and watch your time and fitness improve! Oatmeal post-race. 10% proceeds sh","startDate": "2010-09-19","eventDate": "2010-09-19","location": "Alki Beach Park, Seattle","tag": ["event:10", "Running:10"],"state": "Washington","endDate": "2010-11-22","locationName": "1702 Alki Ave. SW","splitMediaType": ["5K", "difficulty:Beginner", "difficulty:Advanced", "Event", "difficulty:Intermediate", "10K"],"lastModifiedDateTime": "2010-08-19 23:35:50.117","endTime": "07:59:59","mediaType": ["5K", "difficulty:Beginner", "difficulty:Advanced", "Event", "difficulty:Intermediate", "10K"],"google-site-verification": "","city": "Seattle","startTime": "07:00:00","assetId": ["39e8177e-dd0e-42a2-8a2b-24055e5325f3", "39e8177e-dd0e-42a2-8a2b-24055e5325f3"],"eventId": "E-000NGFS9","participationCriteria": "Kids,Family","description": "","longitude": "-122.3912","substitutionUrl": "E-000NGFS9","assetName": ["Fitness For Vitality 5k/10k 3-Race Series (9/19, 10/17, 11/21)", "Fitness For Vitality 5k/10k 3-Race Series (9/19, 10/17, 11/21)"],"zip": "98136","contactPhone": "n/a","eventState": "WA","sortDate": "2000-09-19","keywords": "Event","eventAddress": "1702 Alki Ave. SW","contactEmail": "n/a","dma": "Seattle - Tacoma","trackbackurl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","seourl": "http://www.active.com/10k-race/seattle-wa/fitness-for-vitality-5k10k-3race-series-919-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://photos-images.active.com/file/3/1/optimized/9015e50d-3a2e-4ce4-9ddc-80b05b973b01.jpg","allText": "\u003cp style\u003dtext-align:left\u003e\u003cfont style\u003dfont-family:UniversEmbedded;font-size:12;color:#000000; LETTERSPACING\u003d0 KERNING\u003d0\u003eRace or walk on a flat, fast, and fun course! The entire event is along the Puget Sound. Do all 3 events in the series and watch your time and fitness improve! Oatmeal post-race. 10% proceeds sh","address": "1702 Alki Ave. SW","assetTypeId": "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1","lastModifiedDate": "2010-08-19","eventZip": "98136","latitude": "47.53782","UpdateDateTime": "8/18/2010 10:16:08 AM","channel": "Running"}},
|
134
178
|
{"escapedUrl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","language": "en","title": "Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e","url": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","summary": "\u003cb\u003e...\u003c/b\u003e Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs. Based on 0 reviews. \u003cb\u003e...\u003c/b\u003e Recent Reviews Calabasas\u003cbr\u003e Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs reviews. Get Directions. Start Address. End Address \u003cb\u003e...\u003c/b\u003e ","meta": {"startDate": "2010-11-14","eventDate": "2010-11-14T08:00:00-08:00","location": "Calabasas Park Centre","tag": ["event:10", "Green:10", "Running:10"],"state": "California","eventLongitude": "-118.6789","endDate": "2010-11-14","locationName": "Calabasas Park Centre","splitMediaType": ["Event", "1 mile", "10K", "5K"],"endTime": "8:00:00","mediaType": ["Event", "Event\\1 mile", "Event\\10K", "Event\\5K"],"google-site-verification": "","city": "Calabasas","startTime": "8:00:00","assetId": ["11B01475-8C65-4F9C-A4AC-2A3FA55FE8CD", "11b01475-8c65-4f9c-a4ac-2a3fa55fe8cd"],"eventId": "1810531","participationCriteria": "All","description": "","longitude": "-118.6789","onlineDonationAvailable": "false","substitutionUrl": "1810531","assetName": ["Calabasas Classic 2010 - 5k 10k Runs", "Calabasas Classic 2010 - 5k 10k Runs"],"zip": "91302","contactPhone": "818-715-0428","sortDate": "2000-11-14","eventState": "California","eventLatitude": "34.12794","keywords": "Event","eventAddress": "23975 Park Sorrento","contactEmail": "rot10kd@yahoo.com","onlineMembershipAvailable": "false","trackbackurl": "http://www.active.com/running/calabasas-ca/calabasas-classic-5k-10k-runs-2010","country": "United States","onlineRegistrationAvailable": "true","category": "Activities","image1": "http://www.active.com/images/events/hotrace.gif","assetTypeId": "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate": "2010-03-04 07:30:26.307","eventZip": "91302","latitude": "34.12794","UpdateDateTime": "8/18/2010 10:16:26 AM","channel": ["Running", "Walking"]}}]}',
|
135
179
|
:status => ["200", "Found"])
|
136
|
-
|
137
|
-
|
138
|
-
|
180
|
+
s = Search.search( {:location => "San Diego, CA, US"} )
|
181
|
+
s.should be_a_kind_of(Search)
|
182
|
+
s.should have(3).results
|
183
|
+
s.results.each do |a|
|
139
184
|
a.should be_an_instance_of(Activity)
|
140
185
|
a.title.should_not be_nil
|
141
186
|
a.start_date.should_not be_nil
|
@@ -160,9 +205,9 @@ end
|
|
160
205
|
describe "Call Live Data" do
|
161
206
|
|
162
207
|
it "should find only events in the future" do
|
163
|
-
|
164
|
-
|
165
|
-
results.each do |a|
|
208
|
+
s = Search.search( { :keywords => ["running"] } )
|
209
|
+
s.should have(10).results
|
210
|
+
s.results.each do |a|
|
166
211
|
a.start_date.should satisfy { |d|
|
167
212
|
d >= Date.today
|
168
213
|
}
|
@@ -170,9 +215,9 @@ describe "Call Live Data" do
|
|
170
215
|
end
|
171
216
|
|
172
217
|
it "should find only events with in a range" do
|
173
|
-
|
174
|
-
|
175
|
-
results.each do |a|
|
218
|
+
s = Search.search( {:start_date => Date.new(2010,1,1), :end_date => Date.new(2010,2,1)} )
|
219
|
+
s.should have(10).results
|
220
|
+
s.results.each do |a|
|
176
221
|
a.start_date.should satisfy { |d|
|
177
222
|
d >= Date.new(2010,1,1) and d <= Date.new(2010,2,1)
|
178
223
|
}
|
@@ -180,9 +225,9 @@ describe "Call Live Data" do
|
|
180
225
|
end
|
181
226
|
|
182
227
|
it "should find events after the start date" do
|
183
|
-
|
184
|
-
|
185
|
-
results.each do |a|
|
228
|
+
s = Search.search( {:start_date => Date.new(2010,1,1), :num_results => 50} )
|
229
|
+
s.should have(50).results
|
230
|
+
s.results.each do |a|
|
186
231
|
a.start_date.should satisfy { |d|
|
187
232
|
d >= Date.new(2010,1,1)
|
188
233
|
}
|
@@ -191,21 +236,21 @@ describe "Call Live Data" do
|
|
191
236
|
|
192
237
|
# our model should be updated to handle multiple categories
|
193
238
|
# I'm sure running is with in all of these events but we're only storing 1.
|
194
|
-
it "should find only running activities" do
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
end
|
239
|
+
# it "should find only running activities" do
|
240
|
+
# s = Search.search( {:channels => [:running],
|
241
|
+
# :start_date => Date.new(2010,1,1), :num_results => 20} )
|
242
|
+
# s.should have(20).results
|
243
|
+
# s.results.each do |a|
|
244
|
+
# puts "-#{a.category}-"
|
245
|
+
# a.category.should satisfy { |d|
|
246
|
+
# d.include?('Running' )
|
247
|
+
# }
|
248
|
+
# end
|
249
|
+
# end
|
205
250
|
|
206
251
|
it "should find yoga activities by channel" do
|
207
|
-
|
208
|
-
|
252
|
+
s = Search.search( {:channels => [:yoga]} )
|
253
|
+
s.should have(10).results
|
209
254
|
end
|
210
255
|
|
211
256
|
it "should find activities that have been recently added"
|
@@ -225,3 +270,6 @@ describe "Call Live Data" do
|
|
225
270
|
it "should order by date DATE_DESC"
|
226
271
|
|
227
272
|
end
|
273
|
+
|
274
|
+
|
275
|
+
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
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: 17
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
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-09-
|
18
|
+
date: 2010-09-11 00:00:00 -07:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: bones
|
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: 25
|
27
30
|
segments:
|
28
31
|
- 3
|
29
32
|
- 4
|
@@ -41,7 +44,6 @@ extra_rdoc_files:
|
|
41
44
|
- History.txt
|
42
45
|
- README.txt
|
43
46
|
- bin/Active
|
44
|
-
- lib/.DS_Store
|
45
47
|
- version.txt
|
46
48
|
files:
|
47
49
|
- .bnsignore
|
@@ -50,13 +52,14 @@ files:
|
|
50
52
|
- README.txt
|
51
53
|
- Rakefile
|
52
54
|
- bin/Active
|
53
|
-
- lib/.DS_Store
|
54
55
|
- lib/Active.rb
|
55
56
|
- lib/services/activity.rb
|
56
57
|
- lib/services/search.rb
|
57
58
|
- spec/.DS_Store
|
58
59
|
- spec/Active_spec.rb
|
59
60
|
- spec/activity_spec.rb
|
61
|
+
- spec/benchmark/search_bench.rb
|
62
|
+
- spec/custom_matchers_spec.rb
|
60
63
|
- spec/search_spec.rb
|
61
64
|
- spec/spec_helper.rb
|
62
65
|
- test/test_Active.rb
|
@@ -72,23 +75,27 @@ rdoc_options:
|
|
72
75
|
require_paths:
|
73
76
|
- lib
|
74
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
75
79
|
requirements:
|
76
80
|
- - ">="
|
77
81
|
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
78
83
|
segments:
|
79
84
|
- 0
|
80
85
|
version: "0"
|
81
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
82
88
|
requirements:
|
83
89
|
- - ">="
|
84
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
85
92
|
segments:
|
86
93
|
- 0
|
87
94
|
version: "0"
|
88
95
|
requirements: []
|
89
96
|
|
90
97
|
rubyforge_project: Active
|
91
|
-
rubygems_version: 1.3.
|
98
|
+
rubygems_version: 1.3.7
|
92
99
|
signing_key:
|
93
100
|
specification_version: 3
|
94
101
|
summary: Search api for Active Network
|
data/lib/.DS_Store
DELETED
Binary file
|