Active 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Active.gemspec +6 -6
- data/bin/Active +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/Active.rb +1 -1
- data/lib/services/activity.rb +39 -22
- data/lib/services/search.rb +222 -14
- data/spec/activity_spec.rb +5 -14
- data/spec/search_spec.rb +28 -6
- data/version.txt +1 -1
- metadata +6 -13
- data/Active-0.0.0.gem +0 -0
- data/Active-0.0.1.gem +0 -0
data/Active.gemspec
CHANGED
@@ -2,22 +2,22 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{Active}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Jonathan Spooner, Brian Levine"]
|
9
|
-
s.date = %q{2010-
|
9
|
+
s.date = %q{2010-09-01}
|
10
10
|
s.default_executable = %q{Active}
|
11
11
|
s.description = %q{Search api for Active Network}
|
12
12
|
s.email = %q{jspooner [at] gmail.com}
|
13
13
|
s.executables = ["Active"]
|
14
|
-
s.extra_rdoc_files = ["History.txt", "README.txt", "bin/Active", "version.txt"]
|
15
|
-
s.files = [".bnsignore", "Active
|
14
|
+
s.extra_rdoc_files = ["History.txt", "README.txt", "bin/Active", "lib/.DS_Store", "version.txt"]
|
15
|
+
s.files = [".bnsignore", "Active.gemspec", "History.txt", "README.txt", "Rakefile", "bin/Active", "lib/.DS_Store", "lib/Active.rb", "lib/services/activity.rb", "lib/services/search.rb", "spec/.DS_Store", "spec/Active_spec.rb", "spec/activity_spec.rb", "spec/search_spec.rb", "spec/spec_helper.rb", "test/test_Active.rb", "version.txt"]
|
16
16
|
s.homepage = %q{http://developer.active.com/docs/Activecom_Search_API_Reference}
|
17
17
|
s.rdoc_options = ["--main", "README.txt"]
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
s.rubyforge_project = %q{Active}
|
20
|
-
s.rubygems_version = %q{1.3.
|
20
|
+
s.rubygems_version = %q{1.3.6}
|
21
21
|
s.summary = %q{Search api for Active Network}
|
22
22
|
s.test_files = ["test/test_Active.rb"]
|
23
23
|
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
26
|
s.specification_version = 3
|
27
27
|
|
28
|
-
if Gem::Version.new(Gem::
|
28
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
29
|
s.add_development_dependency(%q<bones>, [">= 3.4.7"])
|
30
30
|
else
|
31
31
|
s.add_dependency(%q<bones>, [">= 3.4.7"])
|
data/bin/Active
CHANGED
File without changes
|
data/lib/.DS_Store
ADDED
Binary file
|
data/lib/Active.rb
CHANGED
data/lib/services/activity.rb
CHANGED
@@ -1,34 +1,51 @@
|
|
1
1
|
module Active
|
2
2
|
module Services
|
3
3
|
class Activity
|
4
|
-
attr_accessor :title, :address, :start_date, :start_time, :end_time, :end_date, :category, :desc
|
4
|
+
attr_accessor :title, :url, :category, :address, :start_date, :start_time, :end_time, :end_date, :category, :desc,
|
5
|
+
:asset_id, :data
|
5
6
|
def initialize data
|
6
|
-
data
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@
|
13
|
-
@
|
14
|
-
|
15
|
-
|
7
|
+
@data = HashWithIndifferentAccess.new(data)
|
8
|
+
self.title = @data[:title]
|
9
|
+
@url = @data[:url]
|
10
|
+
|
11
|
+
unless @data[:meta].nil?
|
12
|
+
self.asset_id = @data[:meta][:assetId]
|
13
|
+
@start_date = Date.parse(@data[:meta][:startDate])
|
14
|
+
@end_date = Date.parse(@data[:meta][:endDate]) if @data[:meta][:endDate]
|
15
|
+
self.category = @data[:meta][:channel] ||= ""
|
16
|
+
|
17
|
+
@desc = @data[:meta][:description] ||= ""
|
18
|
+
@start_time = @data[:meta][:startTime] ||= ""
|
19
|
+
@end_time = @data[:meta][:endTime] ||= ""
|
16
20
|
@address = {
|
17
|
-
:name => data[:meta][:
|
18
|
-
|
19
|
-
:city => data[:meta][:city],
|
20
|
-
:state => data[:meta][:state],
|
21
|
-
:zip => data[:meta][:zip],
|
22
|
-
:lat => data[:meta][:latitude],
|
23
|
-
:lng => data[:meta][:longitude],
|
24
|
-
:country => data[:meta][:country]
|
21
|
+
:name => @data[:meta][:locationName],
|
22
|
+
:address => @data[:meta][:location],
|
23
|
+
:city => @data[:meta][:city],
|
24
|
+
:state => @data[:meta][:state],
|
25
|
+
:zip => @data[:meta][:zip],
|
26
|
+
:lat => @data[:meta][:latitude],
|
27
|
+
:lng => @data[:meta][:longitude],
|
28
|
+
:country => @data[:meta][:country]
|
29
|
+
|
30
|
+
# dma?
|
31
|
+
|
25
32
|
}
|
26
33
|
end
|
27
|
-
@onlineDonationAvailable = data[:meta][:onlineDonationAvailable]
|
28
|
-
@onlineRegistrationAvailable = data[:meta][:onlineRegistrationAvailable]
|
29
|
-
@onlineMembershipAvailable = data[:meta][:onlineMembershipAvailable]
|
34
|
+
@onlineDonationAvailable = @data[:meta][:onlineDonationAvailable]
|
35
|
+
@onlineRegistrationAvailable = @data[:meta][:onlineRegistrationAvailable]
|
36
|
+
@onlineMembershipAvailable = @data[:meta][:onlineMembershipAvailable]
|
30
37
|
|
31
38
|
end
|
39
|
+
|
40
|
+
# ahhh... just use the first channel if it's an array.
|
41
|
+
def category=(value)
|
42
|
+
@category = (value.class == Array) ? value[0] : value
|
43
|
+
end
|
44
|
+
|
45
|
+
def asset_id=(value)
|
46
|
+
@asset_id = (value.class==Array) ? value[0] : value
|
47
|
+
end
|
48
|
+
|
32
49
|
end
|
33
50
|
end
|
34
51
|
end
|
data/lib/services/search.rb
CHANGED
@@ -25,23 +25,234 @@ module Active
|
|
25
25
|
"activities"
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
29
28
|
|
30
|
-
|
31
29
|
class Search
|
32
30
|
# attr_accessor :location, :category, :channels, :daterange, :keywords, :radius, :limit, :sort, :page, :offset,
|
33
31
|
# :asset_type_id, :api_key, :num_results, :view, :facet, :sort
|
34
32
|
#
|
35
33
|
SEARCH_URL = "http://search.active.com"
|
36
34
|
DEFAULT_TIMEOUT = 5
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
35
|
+
|
36
|
+
def self.CHANNELS
|
37
|
+
{
|
38
|
+
:corporate => "corporate",
|
39
|
+
:nochannel => "nochannel",
|
40
|
+
:action_sports => "action_sports",
|
41
|
+
:auto_racing => "auto_racing",
|
42
|
+
:baseball => "baseball",
|
43
|
+
:little_league_baseball => "baseball%5Clittle_league_baseball",
|
44
|
+
:tee_ball => "baseball%5Ctee_ball",
|
45
|
+
:littleleague => "baseball%5Clittleleague",
|
46
|
+
:basketball => "basketball",
|
47
|
+
:bmx => "bmx",
|
48
|
+
:cheerleading => "cheerleading",
|
49
|
+
:cycling => "cycling",
|
50
|
+
:tourofca => "cycling%5Ctourofca",
|
51
|
+
:gift_guide => "cycling%5Cgift_guide",
|
52
|
+
:dirt_bike_racing => "dirt_bike_racing",
|
53
|
+
:field_hockey => "field_hockey",
|
54
|
+
:football => "football",
|
55
|
+
:flag_football => "football%5Cflag_football",
|
56
|
+
:football_au => "football%5Cfootball_au",
|
57
|
+
:pop_warner => "football%5Cpop_warner",
|
58
|
+
:golf => "golf",
|
59
|
+
:ice_hockey => "ice_hockey",
|
60
|
+
:lacrosse => "lacrosse",
|
61
|
+
:motocross => "motocross",
|
62
|
+
:motorcycle_racing => "motorcycle_racing",
|
63
|
+
:mountain_biking => "mountain_biking",
|
64
|
+
:outdoors => "outdoors",
|
65
|
+
:canoeing => "outdoors%5Ccanoeing",
|
66
|
+
:climbing => "outdoors%5Cclimbing",
|
67
|
+
:hiking => "outdoors%5Chiking",
|
68
|
+
:kayaking => "outdoors%5Ckayaking",
|
69
|
+
:orienteering => "outdoors%5Corienteering",
|
70
|
+
:outrigging => "outdoors%5Coutrigging",
|
71
|
+
:rafting => "outdoors%5Crafting",
|
72
|
+
:gift_guide => "outdoors%5Cgift_guide",
|
73
|
+
:running => "running",
|
74
|
+
:cross_country => "running%5Ccross_country",
|
75
|
+
:track_and_field => "running%5Ctrack_and_field",
|
76
|
+
:trail_running => "running%5Ctrail_running",
|
77
|
+
:gift_guide => "running%5Cgift_guide",
|
78
|
+
:jinglebell => "running%5Cjinglebell",
|
79
|
+
:spiritofthemarathon => "running%5Cspiritofthemarathon",
|
80
|
+
:stpatricksday => "running%5Cstpatricksday",
|
81
|
+
:marathonmania => "running%5Cmarathonmania",
|
82
|
+
:newbierunners => "running%5Cnewbierunners",
|
83
|
+
:sailing => "sailing",
|
84
|
+
:skateboarding => "skateboarding",
|
85
|
+
:skiing => "skiing",
|
86
|
+
:skydiving => "skydiving",
|
87
|
+
:snowboarding => "snowboarding",
|
88
|
+
:snowshoeing => "snowshoeing",
|
89
|
+
:soccer => "soccer",
|
90
|
+
:softball => "softball",
|
91
|
+
:dixie => "softball%5Cdixie",
|
92
|
+
:fastpitch => "softball%5Cfastpitch",
|
93
|
+
:slowpitch => "softball%5Cslowpitch",
|
94
|
+
:little_league => "softball%5Clittle_league",
|
95
|
+
:surfing => "surfing",
|
96
|
+
:swimming => "swimming",
|
97
|
+
:diving => "swimming%5Cdiving",
|
98
|
+
:open_water_swimming => "swimming%5Copen_water_swimming",
|
99
|
+
:masters => "swimming%5Cmasters",
|
100
|
+
:tennis => "tennis",
|
101
|
+
:usta => "tennis%5Custa",
|
102
|
+
:college => "tennis%5Ccollege",
|
103
|
+
:triathlon => "triathlon",
|
104
|
+
:ironblog => "triathlon%5Cironblog",
|
105
|
+
:gift_guide => "triathlon%5Cgift_guide",
|
106
|
+
:volleyball => "volleyball",
|
107
|
+
:walking => "walking",
|
108
|
+
:wake_kite_boarding => "wake%2Fkite_boarding",
|
109
|
+
:water_skiing => "water_skiing",
|
110
|
+
:wind_surfing => "wind_surfing",
|
111
|
+
:water_sports => "water_sports",
|
112
|
+
:more_sports => "more_sports",
|
113
|
+
:adventure_racing => "more_sports%5Cadventure_racing",
|
114
|
+
:archery => "more_sports%5Carchery",
|
115
|
+
:badminton => "more_sports%5Cbadminton",
|
116
|
+
:billiards => "more_sports%5Cbilliards",
|
117
|
+
:bowling => "more_sports%5Cbowling",
|
118
|
+
:cricket => "more_sports%5Ccricket",
|
119
|
+
:croquet => "more_sports%5Ccroquet",
|
120
|
+
:curling => "more_sports%5Ccurling",
|
121
|
+
:dance => "more_sports%5Cdance",
|
122
|
+
:disc_sports => "more_sports%5Cdisc_sports",
|
123
|
+
:dodgeball => "more_sports%5Cdodgeball",
|
124
|
+
:duathlon => "more_sports%5Cduathlon",
|
125
|
+
:equestrian => "more_sports%5Cequestrian",
|
126
|
+
:fencing => "more_sports%5Cfencing",
|
127
|
+
:figure_skating => "more_sports%5Cfigure_skating",
|
128
|
+
:fishing => "more_sports%5Cfishing",
|
129
|
+
:gymnastics => "more_sports%5Cgymnastics",
|
130
|
+
:inline_hockey => "more_sports%5Cinline_hockey",
|
131
|
+
:kickball => "more_sports%5Ckickball",
|
132
|
+
:martial_arts => "more_sports%5Cmartial_arts",
|
133
|
+
:paintball => "more_sports%5Cpaintball",
|
134
|
+
:polo => "more_sports%5Cpolo",
|
135
|
+
:racquetball => "more_sports%5Cracquetball",
|
136
|
+
:rowing => "more_sports%5Crowing",
|
137
|
+
:rugby => "more_sports%5Crugby",
|
138
|
+
:scuba_diving => "more_sports%5Cscuba_diving",
|
139
|
+
:skating => "more_sports%5Cskating",
|
140
|
+
:squash => "more_sports%5Csquash",
|
141
|
+
:ultimate_frisbee => "more_sports%5Cultimate_frisbee",
|
142
|
+
:water_polo => "more_sports%5Cwater_polo",
|
143
|
+
:wrestling => "wrestling",
|
144
|
+
:nutrition => "nutrition",
|
145
|
+
:fitness => "fitness",
|
146
|
+
:body_building => "fitness%5Cbody_building",
|
147
|
+
:boxing => "fitness%5Cboxing",
|
148
|
+
:weight_lifting => "fitness%5Cweight_lifting",
|
149
|
+
:wellness => "fitness%5Cwellness",
|
150
|
+
:gymnastics_centers => "fitness%5Cgymnastics_centers",
|
151
|
+
:martial_arts_centers => "fitness%5Cmartial_arts_centers",
|
152
|
+
:massage => "fitness%5Cmassage",
|
153
|
+
:chiropractors => "fitness%5Cchiropractors",
|
154
|
+
:therapy => "fitness%5Ctherapy",
|
155
|
+
:travel => "travel",
|
156
|
+
:marinas => "travel%5Cmarinas",
|
157
|
+
:campgrounds_and_rv_parks => "travel%5Ccampgrounds_and_rv_parks",
|
158
|
+
:state_muni_hunting_and_fishing_licensing => "travel%5Cstate_muni_hunting_and_fishing_licensing",
|
159
|
+
:boat_licensing_departments => "travel%5Cboat_licensing_departments",
|
160
|
+
:lodges_bandbs_country_inns_hostels => "travel%5Clodges_bandbs_country_inns_hostels",
|
161
|
+
:hotels_resorts_motels => "travel%5Chotels_resorts_motels",
|
162
|
+
:condo_rental_time_share => "travel%5Ccondo_rental_time_share",
|
163
|
+
:charters_tours => "travel%5Ccharters_tours",
|
164
|
+
:cruises => "travel%5Ccruises",
|
165
|
+
:gear => "gear",
|
166
|
+
:sony_gps => "gear%5Csony_gps",
|
167
|
+
:mind_and_body => "mind_and_body",
|
168
|
+
:meditation => "mind_and_body%5Cmeditation",
|
169
|
+
:pilates => "mind_and_body%5Cpilates",
|
170
|
+
:yoga => "mind_and_body%5Cyoga",
|
171
|
+
:women => "women",
|
172
|
+
:gift_guide => "women%5Cgift_guide",
|
173
|
+
:fit_pregnancy => "women%5Cfit_pregnancy",
|
174
|
+
:lifestyle_vehicles => "lifestyle_vehicles",
|
175
|
+
:community_services => "community_services",
|
176
|
+
:parks_and_recs => "community_services%5Cparks_and_recs",
|
177
|
+
:private_gated_community_rec => "community_services%5Cprivate_gated_community_rec",
|
178
|
+
:summer_and_day_camps => "community_services%5Csummer_and_day_camps",
|
179
|
+
:military_recreation => "community_services%5Cmilitary_recreation",
|
180
|
+
:libraries => "community_services%5Clibraries",
|
181
|
+
:business_training_professional_and_personal_development => "community_services%5Cbusiness_training_professional_and_personal_development",
|
182
|
+
:art_music_voice_dance_acting => "community_services%5Cart_music_voice_dance_acting",
|
183
|
+
:flea_markets_swap_meets => "community_services%5Cflea_markets_swap_meets",
|
184
|
+
:non_profit_services => "non_profit_services",
|
185
|
+
:ymca_jcc_boys_and_girls_clubs => "non_profit_services%5Cymca_jcc_boys_and_girls_clubs",
|
186
|
+
:boy_scouts_girls_scouts => "non_profit_services%5Cboy_scouts_girls_scouts",
|
187
|
+
:religious => "non_profit_services%5Creligious",
|
188
|
+
:giving_and_fundraising => "giving_and_fundraising",
|
189
|
+
:health_and_disease => "giving_and_fundraising%5Chealth_and_disease",
|
190
|
+
:political => "giving_and_fundraising%5Cpolitical",
|
191
|
+
:environment => "giving_and_fundraising%5Cenvironment",
|
192
|
+
:faith => "giving_and_fundraising%5Cfaith",
|
193
|
+
:animals => "giving_and_fundraising%5Canimals",
|
194
|
+
:educational_support => "giving_and_fundraising%5Ceducational_support",
|
195
|
+
:international => "giving_and_fundraising%5Cinternational",
|
196
|
+
:other => "giving_and_fundraising%5Cother",
|
197
|
+
:attractions => "attractions",
|
198
|
+
:aquatic_parks => "attractions%5Caquatic_parks",
|
199
|
+
:amusement_parks => "attractions%5Camusement_parks",
|
200
|
+
:zoos => "attractions%5Czoos",
|
201
|
+
:aquariums => "attractions%5Caquariums",
|
202
|
+
:science_and_nature_centers => "attractions%5Cscience_and_nature_centers",
|
203
|
+
:museums => "attractions%5Cmuseums",
|
204
|
+
:general_admission_concerts_and_events => "attractions%5Cgeneral_admission_concerts_and_events",
|
205
|
+
:ski_resorts => "attractions%5Cski_resorts",
|
206
|
+
:carnivals => "attractions%5Ccarnivals",
|
207
|
+
:miniature_golf => "attractions%5Cminiature_golf",
|
208
|
+
:education => "education",
|
209
|
+
:universities => "education%5Cuniversities",
|
210
|
+
:community_junior_colleges => "education%5Ccommunity_junior_colleges",
|
211
|
+
:public_school_boards => "education%5Cpublic_school_boards",
|
212
|
+
:continuing_education_departments => "education%5Ccontinuing_education_departments",
|
213
|
+
:high_schools => "education%5Chigh_schools",
|
214
|
+
:private_schools => "education%5Cprivate_schools",
|
215
|
+
:pre_schools => "education%5Cpre_schools",
|
216
|
+
:youth_academic_extracurricular => "education%5Cyouth_academic_extracurricular",
|
217
|
+
:government => "government",
|
218
|
+
:city_hall => "government%5Ccity_hall",
|
219
|
+
:parking => "government%5Cparking",
|
220
|
+
:animal_licensing => "government%5Canimal_licensing",
|
221
|
+
:municipal_business_licensing => "government%5Cmunicipal_business_licensing",
|
222
|
+
:traffic_ticketing => "government%5Ctraffic_ticketing",
|
223
|
+
:utility_billing => "government%5Cutility_billing",
|
224
|
+
:building_permits => "government%5Cbuilding_permits",
|
225
|
+
:taxes => "government%5Ctaxes",
|
226
|
+
:state_dmvs => "government%5Cstate_dmvs",
|
227
|
+
:federal_government => "government%5Cfederal_government",
|
228
|
+
:business_and_commerce => "business_and_commerce",
|
229
|
+
:corporations => "business_and_commerce%5Ccorporations",
|
230
|
+
:conferences_and_conventions => "business_and_commerce%5Cconferences_and_conventions",
|
231
|
+
:affinity_groups => "business_and_commerce%5Caffinity_groups",
|
232
|
+
:counseling_therapy => "business_and_commerce%5Ccounseling_therapy",
|
233
|
+
:pet_care => "business_and_commerce%5Cpet_care",
|
234
|
+
:beauty_and_personal_care => "business_and_commerce%5Cbeauty_and_personal_care",
|
235
|
+
:restaurants => "business_and_commerce%5Crestaurants",
|
236
|
+
:high_school => "high_school",
|
237
|
+
:hs_activities => "high_school%5Chs_activities",
|
238
|
+
:hs_varsity_sports_club_sports => "high_school%5Chs_varsity_sports_club_sports",
|
239
|
+
:continuing_education => "high_school%5Ccontinuing_education",
|
240
|
+
:scouts => "scouts",
|
241
|
+
:bsa => "scouts%5Cbsa",
|
242
|
+
:gsus4h => "scouts%5Cgsus4h",
|
243
|
+
:'4h' => "scouts%5C4h",
|
244
|
+
:campfire => "scouts%5Ccampfire",
|
245
|
+
:sea_scouts => "scouts%5Csea_scouts",
|
246
|
+
:fccla => "scouts%5Cfccla",
|
247
|
+
:reunions => "reunions",
|
248
|
+
:teams => "teams",
|
249
|
+
:gift_guide => "teams%5Cgift_guide",
|
250
|
+
:golf_tennis => "golf_tennis",
|
251
|
+
:gift_guide => "golf_tennis%5Cgift_guide"
|
252
|
+
}
|
253
|
+
end
|
254
|
+
|
255
|
+
|
45
256
|
# http://developer.active.com/docs/Activecom_Search_API_Reference
|
46
257
|
#
|
47
258
|
def self.search(data=nil)
|
@@ -88,8 +299,6 @@ module Active
|
|
88
299
|
options[:keywords].each { |k| k.strip! }
|
89
300
|
end
|
90
301
|
|
91
|
-
channels_str = ""
|
92
|
-
|
93
302
|
if options[:channels] != nil
|
94
303
|
channels_a = options[:channels].collect { |channel|
|
95
304
|
"meta:channel=#{URI.escape(URI.escape(channel, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")),Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")).gsub(/\-/,"%252D")}"
|
@@ -120,8 +329,7 @@ module Active
|
|
120
329
|
url
|
121
330
|
end
|
122
331
|
|
123
|
-
|
124
|
-
|
332
|
+
|
125
333
|
|
126
334
|
end
|
127
335
|
end
|
data/spec/activity_spec.rb
CHANGED
@@ -16,6 +16,7 @@ describe Activity do
|
|
16
16
|
:trackbackurl => "http://www.active.com/running/lake-buena-vista-fl/walt-disney-world-marathon-2011",
|
17
17
|
:substitutionUrl => "1820830",
|
18
18
|
:assetId => ['3584C7D6-14FD-4FD1-BD07-C2A9B2925B6C','3584c7d6-14fd-4fd1-bd07-c2a9b2925b6c'],
|
19
|
+
:channel => ['action_sports','running'],
|
19
20
|
:city => "Lake Buena Vista",
|
20
21
|
:latitude => "28.39494",
|
21
22
|
:category => "Activities",
|
@@ -35,7 +36,6 @@ describe Activity do
|
|
35
36
|
:contactPhone => "407-938-3398",
|
36
37
|
:startDate => "2011-01-09",
|
37
38
|
:onlineDonationAvailable => "true",
|
38
|
-
:channel => "Running",
|
39
39
|
:assetTypeId => "3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6",
|
40
40
|
:UpdateDateTime => "8/18/2010 10:16:26 AM",
|
41
41
|
:contactEmail => 'wdw.sports.marathon.endurance@disneysports.com',
|
@@ -58,6 +58,10 @@ describe Activity do
|
|
58
58
|
|
59
59
|
it "should be a valid activity" do
|
60
60
|
a = Activity.new(@valid_attributes)
|
61
|
+
a.url.should eql("http://www.active.com/running/lake-buena-vista-fl/walt-disney-world-marathon-2011")
|
62
|
+
a.category.should eql("action_sports")
|
63
|
+
a.asset_id.should eql("3584C7D6-14FD-4FD1-BD07-C2A9B2925B6C")
|
64
|
+
|
61
65
|
a.title.should_not be_nil
|
62
66
|
a.start_date.should_not be_nil
|
63
67
|
a.end_date.should_not be_nil
|
@@ -85,17 +89,4 @@ describe Activity do
|
|
85
89
|
end
|
86
90
|
|
87
91
|
|
88
|
-
|
89
92
|
end
|
90
|
-
# :tag:
|
91
|
-
# :- event:10
|
92
|
-
# :- Running:10
|
93
|
-
# :splitMediaType:
|
94
|
-
# :- Event
|
95
|
-
# :- Marathon
|
96
|
-
# :assetName:
|
97
|
-
# :- "2011 Walt Disney World\xAE Marathon"
|
98
|
-
# :- "2011 Walt Disney World\xAE Marathon"
|
99
|
-
# mediaType:
|
100
|
-
# - Event
|
101
|
-
# - Event\Marathon
|
data/spec/search_spec.rb
CHANGED
@@ -7,6 +7,12 @@ require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
|
|
7
7
|
# No need to type Britify:: before each call
|
8
8
|
include Active::Services
|
9
9
|
|
10
|
+
describe "Set up" do
|
11
|
+
it "should set the api key"
|
12
|
+
it "should not all search.active.com by default"
|
13
|
+
it "should call search.active.com when told to"
|
14
|
+
end
|
15
|
+
|
10
16
|
describe "Search URL Construction" do
|
11
17
|
|
12
18
|
it "should construct a valid url with location" do
|
@@ -17,6 +23,11 @@ describe "Search URL Construction" do
|
|
17
23
|
uri.query.include?("l=#{CGI.escape("San Diego, CA, US")}").should be_true
|
18
24
|
end
|
19
25
|
|
26
|
+
it "should construct a valid url from a zip code" do
|
27
|
+
uri = URI.parse(Search.construct_url( {:zip => "92121"} ))
|
28
|
+
uri.query.include?("l=#{CGI.escape("92121")}").should be_true
|
29
|
+
end
|
30
|
+
|
20
31
|
it "should construct a valid url with CSV keywords" do
|
21
32
|
uri = URI.parse( Search.construct_url( {:keywords => "running, tri"} ) )
|
22
33
|
uri.query.include?("k=running+tri").should be_true
|
@@ -69,11 +80,10 @@ describe Search do
|
|
69
80
|
FakeWeb.clean_registry
|
70
81
|
end
|
71
82
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
83
|
+
it "should have some channels" do
|
84
|
+
Search.CHANNELS.should_not be_nil
|
85
|
+
end
|
86
|
+
|
77
87
|
it "should raise and error during a 404" do
|
78
88
|
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..+",
|
79
89
|
:body => "Nothing to be found 'round here", :status => ["404", "Not Found"])
|
@@ -148,11 +158,23 @@ describe "Call Live Data" do
|
|
148
158
|
results.each do |a|
|
149
159
|
puts "-#{a.category}-"
|
150
160
|
a.category.should satisfy { |d|
|
151
|
-
d
|
161
|
+
d.include?('Running' )
|
152
162
|
}
|
153
163
|
end
|
154
164
|
|
155
165
|
|
156
166
|
end
|
157
167
|
|
168
|
+
it "should find activities that have been recently added"
|
169
|
+
|
170
|
+
it "should find upcoming events"
|
171
|
+
|
172
|
+
it "should find popular events"
|
173
|
+
|
174
|
+
it "should order by RELEVANCE"
|
175
|
+
|
176
|
+
it "should order by date DATE_ASC"
|
177
|
+
|
178
|
+
it "should order by date DATE_DESC"
|
179
|
+
|
158
180
|
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Active
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 27
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Jonathan Spooner, Brian Levine
|
@@ -15,18 +14,16 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-09-01 00:00:00 -07:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: bones
|
23
22
|
prerelease: false
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
25
|
- - ">="
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 25
|
30
27
|
segments:
|
31
28
|
- 3
|
32
29
|
- 4
|
@@ -44,16 +41,16 @@ extra_rdoc_files:
|
|
44
41
|
- History.txt
|
45
42
|
- README.txt
|
46
43
|
- bin/Active
|
44
|
+
- lib/.DS_Store
|
47
45
|
- version.txt
|
48
46
|
files:
|
49
47
|
- .bnsignore
|
50
|
-
- Active-0.0.0.gem
|
51
|
-
- Active-0.0.1.gem
|
52
48
|
- Active.gemspec
|
53
49
|
- History.txt
|
54
50
|
- README.txt
|
55
51
|
- Rakefile
|
56
52
|
- bin/Active
|
53
|
+
- lib/.DS_Store
|
57
54
|
- lib/Active.rb
|
58
55
|
- lib/services/activity.rb
|
59
56
|
- lib/services/search.rb
|
@@ -75,27 +72,23 @@ rdoc_options:
|
|
75
72
|
require_paths:
|
76
73
|
- lib
|
77
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
75
|
requirements:
|
80
76
|
- - ">="
|
81
77
|
- !ruby/object:Gem::Version
|
82
|
-
hash: 3
|
83
78
|
segments:
|
84
79
|
- 0
|
85
80
|
version: "0"
|
86
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
82
|
requirements:
|
89
83
|
- - ">="
|
90
84
|
- !ruby/object:Gem::Version
|
91
|
-
hash: 3
|
92
85
|
segments:
|
93
86
|
- 0
|
94
87
|
version: "0"
|
95
88
|
requirements: []
|
96
89
|
|
97
90
|
rubyforge_project: Active
|
98
|
-
rubygems_version: 1.3.
|
91
|
+
rubygems_version: 1.3.6
|
99
92
|
signing_key:
|
100
93
|
specification_version: 3
|
101
94
|
summary: Search api for Active Network
|
data/Active-0.0.0.gem
DELETED
Binary file
|
data/Active-0.0.1.gem
DELETED
Binary file
|