multicity 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ class AgentMulticity
2
+ def load_all
3
+ agent = Multicity::Agent.new
4
+ cars = agent.get_cars
5
+ Sharable.transaction do
6
+ Sharable.delete_all :type_id => Tramobi::VALID_AGENTS["Multicity"], :city => "Berlin"
7
+ cars.each { |car| Sharable.from_multicity(car).save! }
8
+ end
9
+ cars.count
10
+ end
11
+ end
@@ -23,7 +23,8 @@ module Multicity
23
23
  marker = data.scan(/"marker":\[(.*?)\],"/).first
24
24
  marker = marker.to_s.gsub(' ', ' ')
25
25
  marker = JSON.parse("[#{marker}]")
26
- marker.map { |item| Car.new(item) }
26
+ marker.map! { |item| Car.new(item) }
27
+ marker.select { |item| item.valid? }
27
28
  end
28
29
 
29
30
  # Gets the Operation Area for Berlin
@@ -51,5 +51,9 @@ module Multicity
51
51
  end
52
52
  end
53
53
  end
54
+
55
+ def valid?
56
+ !position.nil? && !position[:lat].nil? && !position[:lon].nil?
57
+ end
54
58
  end
55
59
  end
@@ -1,3 +1,3 @@
1
1
  module Multicity
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multicity
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 2
10
- version: 1.1.2
9
+ - 3
10
+ version: 1.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Simon Woker
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-02-07 00:00:00 Z
18
+ date: 2013-02-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -83,6 +83,7 @@ extensions: []
83
83
  extra_rdoc_files: []
84
84
 
85
85
  files:
86
+ - lib/multicity/agent_multicity.rb
86
87
  - lib/multicity/multicity_agent.rb
87
88
  - lib/multicity/multicity_car.rb
88
89
  - lib/multicity/version.rb