Active 0.0.34 → 0.0.35

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.
@@ -9,6 +9,7 @@ module Active
9
9
  REG_CENTER_ASSET_TYPE_ID = "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65"
10
10
  REG_CENTER_ASSET_TYPE_ID2 = "3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6"
11
11
  ACTIVE_WORKS_ASSET_TYPE_ID = "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1"
12
+ LOCAL_ASSET_TYPE_ID = "EC6E96A5-6900-4A0E-8B83-9AA935F45A73"
12
13
 
13
14
  attr_accessor :primary, :gsa, :ats
14
15
  attr_reader :datasources_loaded
@@ -47,6 +48,8 @@ module Active
47
48
  return "RegCenter id= #{@gsa.asset_id} type= #{@gsa.asset_type_id}"
48
49
  elsif @gsa.asset_type_id == ACTIVE_WORKS_ASSET_TYPE_ID
49
50
  return "ActiveWorks id= #{@gsa.asset_id} type= #{@gsa.asset_type_id}"
51
+ elsif @gsa.asset_type_id == LOCAL_ASSET_TYPE_ID
52
+ return "Local id= #{@gsa.asset_id} type= #{@gsa.asset_type_id}"
50
53
  else
51
54
  return "Undefined id= #{@gsa.asset_id} type= #{@gsa.asset_type_id}"
52
55
  end
data/lib/services/gsa.rb CHANGED
@@ -16,7 +16,6 @@ module Active
16
16
  def initialize(json={})
17
17
  # need to hold on to original data
18
18
  @data = HashWithIndifferentAccess.new(json) || HashWithIndifferentAccess.new
19
- # @data = HashWithIndifferentAccess.new(json) || HashWithIndifferentAccess.new
20
19
  # self.title = @data['meta']['assetName'] || nil
21
20
  self.title = @data['title'] || nil
22
21
  end
@@ -79,7 +78,11 @@ module Active
79
78
  end
80
79
  end
81
80
  end
82
- return categories.first
81
+ if categories.nil?# && categories.empty?
82
+ return "unknown"
83
+ else
84
+ return categories.first
85
+ end
83
86
  end
84
87
 
85
88
  def address
@@ -258,7 +258,8 @@ module Active
258
258
  @endIndex = parsed_json["endIndex"]
259
259
  @pageSize = parsed_json["pageSize"]
260
260
  @searchTime = parsed_json["searchTime"]
261
- @numberOfResults = parsed_json["numberOfResults"]
261
+ # GSA will only return 1000 events but will give us a number larger then 1000.
262
+ @numberOfResults = (parsed_json["numberOfResults"] <= 1000) ? parsed_json["numberOfResults"] : 1000
262
263
  @results = parsed_json['_results'].collect { |a| Activity.new(GSA.new(a)) }
263
264
 
264
265
  begin
@@ -31,8 +31,16 @@ REG_CENTER_ASSET_TYPE_ID2 = "3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6"
31
31
  ACTIVE_WORKS_ASSET_TYPE_ID = "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1"
32
32
 
33
33
  local_asset_type_id = "EC6E96A5-6900-4A0E-8B83-9AA935F45A73"
34
- puts "Local " + Search.search({:asset_type_id => local_asset_type_id}).results.length.to_s
35
- puts "Local " + Search.search({:asset_type_id => local_asset_type_id, :start_date => Date.new(2010, 1, 1), :end_date => Date.new(2011, 11, 15) }).results.length.to_s
34
+ # puts "Local " + Search.search({:asset_type_id => local_asset_type_id}).results.length.to_s
35
+
36
+ # loc = Search.search({:facet => "", :asset_type_id => local_asset_type_id, :start_date => Date.new(2008, 1, 1), :end_date => Date.new(2012, 11, 15) })
37
+ # loc = Search.search({:facet => "", :url => "local.active.com", :start_date => Date.new(2000, 1, 1), :end_date => Date.new(2019, 11, 15) })
38
+ # loc = Search.search({:facet => "", :url => "local.active.com"})
39
+
40
+ # puts "Local " + loc.results.length.to_s
41
+ # puts loc.results.collect { |r| "#{r.origin} #{r.title} #{r.url}" }
42
+
43
+
36
44
  # puts "ActiveWorks " + Search.search({:asset_type_id => ACTIVE_WORKS_ASSET_TYPE_ID, :start_date => Date.new(2010, 1, 1), :end_date => Date.new(2011, 11, 15) }).results.length.to_s
37
45
 
38
46
  # url = "www.active.com/running/long-branch-nj/new-jersey-marathon-and-long-branch-half-marathon-2011"
@@ -42,5 +50,6 @@ puts "Local " + Search.search({:asset_type_id => local_asset_type_id, :sta
42
50
  # puts r.map(&:url)
43
51
 
44
52
 
45
- # r = Search.search({:dma=>"San Francisco - Oakland - San Jose", :num_results => 5}).results
53
+ s = Search.search({:dma=>"San Francisco - Oakland - San Jose", :num_results => 5})
54
+ puts s.numberOfResults
46
55
  # puts r.map(&:url)
data/spec/search_spec.rb CHANGED
@@ -135,7 +135,7 @@ describe Search do
135
135
  s.bounding_box.should_not be_nil
136
136
  # uri = URI.parse( Search.new({:channels => [:running,:triathlon], :bounding_box => { :sw => "37.695141,-123.013657", :ne => "37.695141,-123.013657"} }).end_point )
137
137
  uri = URI.parse( s.end_point )
138
- puts "????????????????????? "
138
+ puts "?????????????????????"
139
139
  puts uri
140
140
  uri.query.include?("meta:channel=Running+OR+meta:channel=Triathlon").should be_true
141
141
  uri.query.include?("meta:latitudeShifted:127.695141..127.695141+AND+meta:longitudeShifted:56.986343..56.986343").should be_true
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.0.34
1
+ 0.0.35
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Active
3
3
  version: !ruby/object:Gem::Version
4
- hash: 91
4
+ hash: 89
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 34
10
- version: 0.0.34
9
+ - 35
10
+ version: 0.0.35
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Spooner, Brian Levine
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-10 00:00:00 -08:00
18
+ date: 2011-02-09 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency