ninoxe 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjIyZGZjMWU1NGQzMzYxOWIzNDQzOTU5YmYwNGFjZjhjZTU3Y2YwYw==
5
- data.tar.gz: !binary |-
6
- ZGIwOGEyODc1NWRkMWNiMDRjYTZjN2I2NDU3NTJlNjExNDhkNWZhYw==
2
+ SHA1:
3
+ metadata.gz: 1b81f829d1bf9dc4cc382c97655e09affb023d23
4
+ data.tar.gz: f4273f82565d1325c847b4261fca28165632457e
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZTBhYjA0MzcxZmQ2ODExNmNlZDIyMjNiZjUzZmZhZDgwNjczODgwMWU3Mzhm
10
- NjlkMWY1Yzg3NGEzYTk4MzU1ZWExODU1OGNlYTJhYWUyMjU0MmE2ZjRiZDU0
11
- MmE4MjA4MTFhZmY0ZGVlOTc1ZTQzYTIyOWNiMDQxNDU2NmJmYWU=
12
- data.tar.gz: !binary |-
13
- ZDczOTVjNTJlN2I0NjVlNTI3ZTY1YmI2MzlkNzU5Y2E2ZGY5MTAxYzZhMDBh
14
- NGUwZDM3NjYxZmE5N2IxNTI4MjEyOTRhYTcyMzdkZTBlYzhmYTBjNTJmYWY3
15
- MDVkOGZjN2RhOWI4YmE5NTFlNmI2OTkxMjQxMGJiYzgxNGIxMzg=
6
+ metadata.gz: 73b387e179b5511078c5000914110685f18d1fc096a68da061ce9e53de5bfca71ca3173eef844c3ac2d28c6845cc78a4073468d56c188173ad9c04f159166166
7
+ data.tar.gz: 93eaa3f2d445a187caa8ab73ae1bb40e30ac41374922804396b8263e43e812738ea86f808ffa51c7e0925d4f090552cf1a7a2e43e2854dfb1dab32735ac9d647
@@ -16,9 +16,13 @@ module Chouette
16
16
  belongs_to :stop_area, :class_name => 'Chouette::StopArea'
17
17
 
18
18
  validates_presence_of :name
19
- validates_presence_of :link_type
20
19
  validates_presence_of :link_orientation
21
20
 
21
+ def self.nullable_attributes
22
+ [:link_distance, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration,
23
+ :mobility_restricted_traveller_duration]
24
+ end
25
+
22
26
  def access_link_type
23
27
  link_type && Chouette::ConnectionLinkType.new(link_type.underscore)
24
28
  end
@@ -1,8 +1,7 @@
1
1
  class Chouette::Company < Chouette::TridentActiveRecord
2
2
  has_many :lines
3
3
 
4
- validates_presence_of :registration_number
5
- validates_format_of :registration_number, :with => %r{\A[0-9A-Za-z_-]+\Z}
4
+ validates_format_of :registration_number, :with => %r{\A[0-9A-Za-z_-]+\Z}, :allow_nil => true, :allow_blank => true
6
5
 
7
6
  validates_presence_of :name
8
7
 
@@ -12,7 +12,11 @@ class Chouette::ConnectionLink < Chouette::TridentActiveRecord
12
12
  belongs_to :arrival, :class_name => 'Chouette::StopArea'
13
13
 
14
14
  validates_presence_of :name
15
- validates_presence_of :link_type
15
+
16
+ def self.nullable_attributes
17
+ [:link_distance, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration,
18
+ :mobility_restricted_traveller_duration]
19
+ end
16
20
 
17
21
  def connection_link_type
18
22
  link_type && Chouette::ConnectionLinkType.new( link_type.underscore)
@@ -29,8 +29,8 @@ class Chouette::Line < Chouette::TridentActiveRecord
29
29
  validates_presence_of :network
30
30
  validates_presence_of :company
31
31
 
32
- validates_presence_of :registration_number
33
- validates_format_of :registration_number, :with => %r{\A[\d\w_\-]+\Z}
32
+ validates_format_of :registration_number, :with => %r{\A[\d\w_\-]+\Z}, :allow_nil => true, :allow_blank => true
33
+ validates_format_of :stable_id, :with => %r{\A[\d\w_\-]+\Z}, :allow_nil => true, :allow_blank => true
34
34
  validates_format_of :url, :with => %r{\Ahttps?:\/\/([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?\Z}, :allow_nil => true, :allow_blank => true
35
35
  validates_format_of :color, :with => %r{\A[0-9a-fA-F]{6}\Z}, :allow_nil => true, :allow_blank => true
36
36
  validates_format_of :text_color, :with => %r{\A[0-9a-fA-F]{6}\Z}, :allow_nil => true, :allow_blank => true
@@ -38,7 +38,7 @@ class Chouette::Line < Chouette::TridentActiveRecord
38
38
  validates_presence_of :name
39
39
 
40
40
  def self.nullable_attributes
41
- [:published_name, :number, :comment, :url, :color, :text_color]
41
+ [:published_name, :number, :comment, :url, :color, :text_color, :stable_id]
42
42
  end
43
43
 
44
44
  def geometry_presenter
@@ -4,8 +4,9 @@ class Chouette::Network < Chouette::TridentActiveRecord
4
4
 
5
5
  has_many :lines
6
6
 
7
- validates_presence_of :registration_number
8
- validates_format_of :registration_number, :with => %r{\A[0-9A-Za-z_-]+\Z}
7
+ attr_accessor :source_type_name
8
+
9
+ validates_format_of :registration_number, :with => %r{\A[0-9A-Za-z_-]+\Z}, :allow_nil => true, :allow_blank => true
9
10
 
10
11
  validates_presence_of :name
11
12
 
@@ -13,7 +14,7 @@ class Chouette::Network < Chouette::TridentActiveRecord
13
14
  # attr_accessible :registration_number, :source_name, :source_type, :source_identifier, :comment
14
15
 
15
16
  def self.object_id_key
16
- "GroupOfLine"
17
+ "PTNetwork"
17
18
  end
18
19
 
19
20
  def self.nullable_attributes
@@ -28,5 +29,22 @@ class Chouette::Network < Chouette::TridentActiveRecord
28
29
  Chouette::StopArea.joins(:stop_points => [:route => [:line => :network] ]).where(:networks => {:id => self.id})
29
30
  end
30
31
 
32
+ def source_type_name
33
+ # return nil if source_type is nil
34
+ source_type && Chouette::SourceType.new( source_type.underscore)
35
+ end
36
+
37
+ def source_type_name=(source_type_name)
38
+ self.source_type = (source_type_name ? source_type_name.camelcase : nil)
39
+ end
40
+
41
+ @@source_type_names = nil
42
+ def self.source_type_names
43
+ @@source_type_names ||= Chouette::SourceType.all.select do |source_type_name|
44
+ source_type_name.to_i > 0
45
+ end
46
+ end
47
+
48
+
31
49
  end
32
50
 
@@ -0,0 +1,56 @@
1
+ class Chouette::SourceType < ActiveSupport::StringInquirer
2
+
3
+ def initialize(text_code, numerical_code)
4
+ super text_code.to_s
5
+ @numerical_code = numerical_code
6
+ end
7
+
8
+ def self.new(text_code, numerical_code = nil)
9
+ if text_code and numerical_code
10
+ super
11
+ elsif self === text_code
12
+ text_code
13
+ else
14
+ if Fixnum === text_code
15
+ text_code, numerical_code = definitions.rassoc(text_code)
16
+ else
17
+ text_code, numerical_code = definitions.assoc(text_code.to_s)
18
+ end
19
+
20
+ super text_code, numerical_code
21
+ end
22
+ end
23
+
24
+ def to_i
25
+ @numerical_code
26
+ end
27
+
28
+ def inspect
29
+ "#{to_s}/#{to_i}"
30
+ end
31
+
32
+ def name
33
+ camelize
34
+ end
35
+
36
+ @@definitions = [
37
+ ["public_and_private_utilities", 0],
38
+ ["road_authorities", 1],
39
+ ["transit_operator", 2],
40
+ ["public_transport", 3],
41
+ ["passenger_transport_coordinating_authority", 4],
42
+ ["travel_information_service_provider", 5],
43
+ ["travel_agency", 6],
44
+ ["individual_subject_of_travel_itinerary", 7],
45
+ ["other_information", 8]
46
+ ]
47
+ cattr_reader :definitions
48
+
49
+ @@all = nil
50
+ def self.all
51
+ @@all ||= definitions.collect do |text_code, numerical_code|
52
+ new(text_code, numerical_code)
53
+ end
54
+ end
55
+
56
+ end
@@ -84,11 +84,10 @@ class Chouette::TridentActiveRecord < Chouette::ActiveRecord
84
84
  if !self.objectid.valid?
85
85
  #errors.add(:objectid, "is not a valid ObjectId object")
86
86
  errors.add(:objectid,I18n.t("activerecord.errors.models.trident.invalid_object_id",:type => self.class.object_id_key))
87
- else
88
- unless self.objectid.object_type==self.class.object_id_key
89
- #errors.add(:objectid, "doesn't have expected object_type: #{self.class.object_id_key}")
90
- errors.add(:objectid,I18n.t("activerecord.errors.models.trident.invalid_object_id_type",:type => self.class.object_id_key))
91
- end
87
+ # else
88
+ # unless self.objectid.object_type==self.class.object_id_key
89
+ # errors.add(:objectid,I18n.t("activerecord.errors.models.trident.invalid_object_id_type",:type => self.class.object_id_key))
90
+ # end
92
91
  end
93
92
  end
94
93
 
@@ -0,0 +1,7 @@
1
+ class AddStableIdToLine < ActiveRecord::Migration
2
+ def change
3
+ change_table :lines do |t|
4
+ t.string :stable_id
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Ninoxe
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ninoxe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Florisson
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-09-02 00:00:00.000000000 Z
14
+ date: 2015-10-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: georuby-ext
@@ -31,42 +31,42 @@ dependencies:
31
31
  name: activerecord
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ~>
34
+ - - "~>"
35
35
  - !ruby/object:Gem::Version
36
36
  version: 4.1.1
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ~>
41
+ - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: 4.1.1
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: acts_as_list
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - ! '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: 0.1.6
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - ! '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: 0.1.6
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: acts_as_tree
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - ! '>='
62
+ - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: 1.1.0
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ! '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: 1.1.0
72
72
  - !ruby/object:Gem::Dependency
@@ -87,182 +87,182 @@ dependencies:
87
87
  name: deep_cloneable
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - ~>
90
+ - - "~>"
91
91
  - !ruby/object:Gem::Version
92
92
  version: 2.0.0
93
93
  type: :runtime
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - ~>
97
+ - - "~>"
98
98
  - !ruby/object:Gem::Version
99
99
  version: 2.0.0
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: acts-as-taggable-on
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - ! '>='
104
+ - - ">="
105
105
  - !ruby/object:Gem::Version
106
106
  version: '3'
107
107
  type: :runtime
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - ! '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '3'
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: enumerize
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - ~>
118
+ - - "~>"
119
119
  - !ruby/object:Gem::Version
120
120
  version: 0.10.0
121
121
  type: :runtime
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - ~>
125
+ - - "~>"
126
126
  - !ruby/object:Gem::Version
127
127
  version: 0.10.0
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: rake
130
130
  requirement: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - ! '>='
132
+ - - ">="
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0.9'
135
135
  type: :development
136
136
  prerelease: false
137
137
  version_requirements: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - ! '>='
139
+ - - ">="
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0.9'
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: jquery-rails
144
144
  requirement: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - ! '>='
146
+ - - ">="
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  type: :development
150
150
  prerelease: false
151
151
  version_requirements: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - ! '>='
153
+ - - ">="
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  - !ruby/object:Gem::Dependency
157
157
  name: guard
158
158
  requirement: !ruby/object:Gem::Requirement
159
159
  requirements:
160
- - - ! '>='
160
+ - - ">="
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  type: :development
164
164
  prerelease: false
165
165
  version_requirements: !ruby/object:Gem::Requirement
166
166
  requirements:
167
- - - ! '>='
167
+ - - ">="
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  - !ruby/object:Gem::Dependency
171
171
  name: guard-rspec
172
172
  requirement: !ruby/object:Gem::Requirement
173
173
  requirements:
174
- - - ! '>='
174
+ - - ">="
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  type: :development
178
178
  prerelease: false
179
179
  version_requirements: !ruby/object:Gem::Requirement
180
180
  requirements:
181
- - - ! '>='
181
+ - - ">="
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  - !ruby/object:Gem::Dependency
185
185
  name: guard-bundler
186
186
  requirement: !ruby/object:Gem::Requirement
187
187
  requirements:
188
- - - ! '>='
188
+ - - ">="
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  type: :development
192
192
  prerelease: false
193
193
  version_requirements: !ruby/object:Gem::Requirement
194
194
  requirements:
195
- - - ! '>='
195
+ - - ">="
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  - !ruby/object:Gem::Dependency
199
199
  name: guard-migrate
200
200
  requirement: !ruby/object:Gem::Requirement
201
201
  requirements:
202
- - - ! '>='
202
+ - - ">="
203
203
  - !ruby/object:Gem::Version
204
204
  version: '0'
205
205
  type: :development
206
206
  prerelease: false
207
207
  version_requirements: !ruby/object:Gem::Requirement
208
208
  requirements:
209
- - - ! '>='
209
+ - - ">="
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  - !ruby/object:Gem::Dependency
213
213
  name: rspec-rails
214
214
  requirement: !ruby/object:Gem::Requirement
215
215
  requirements:
216
- - - ~>
216
+ - - "~>"
217
217
  - !ruby/object:Gem::Version
218
218
  version: 3.1.0
219
219
  type: :development
220
220
  prerelease: false
221
221
  version_requirements: !ruby/object:Gem::Requirement
222
222
  requirements:
223
- - - ~>
223
+ - - "~>"
224
224
  - !ruby/object:Gem::Version
225
225
  version: 3.1.0
226
226
  - !ruby/object:Gem::Dependency
227
227
  name: shoulda-matchers
228
228
  requirement: !ruby/object:Gem::Requirement
229
229
  requirements:
230
- - - ! '>='
230
+ - - ">="
231
231
  - !ruby/object:Gem::Version
232
232
  version: 1.5.6
233
233
  type: :development
234
234
  prerelease: false
235
235
  version_requirements: !ruby/object:Gem::Requirement
236
236
  requirements:
237
- - - ! '>='
237
+ - - ">="
238
238
  - !ruby/object:Gem::Version
239
239
  version: 1.5.6
240
240
  - !ruby/object:Gem::Dependency
241
241
  name: factory_girl_rails
242
242
  requirement: !ruby/object:Gem::Requirement
243
243
  requirements:
244
- - - ! '>='
244
+ - - ">="
245
245
  - !ruby/object:Gem::Version
246
246
  version: 4.2.1
247
247
  type: :development
248
248
  prerelease: false
249
249
  version_requirements: !ruby/object:Gem::Requirement
250
250
  requirements:
251
- - - ! '>='
251
+ - - ">="
252
252
  - !ruby/object:Gem::Version
253
253
  version: 4.2.1
254
254
  - !ruby/object:Gem::Dependency
255
255
  name: rails
256
256
  requirement: !ruby/object:Gem::Requirement
257
257
  requirements:
258
- - - ~>
258
+ - - "~>"
259
259
  - !ruby/object:Gem::Version
260
260
  version: 4.1.1
261
261
  type: :development
262
262
  prerelease: false
263
263
  version_requirements: !ruby/object:Gem::Requirement
264
264
  requirements:
265
- - - ~>
265
+ - - "~>"
266
266
  - !ruby/object:Gem::Version
267
267
  version: 4.1.1
268
268
  description: This library provides a model to navigate through Chouette database.
@@ -307,6 +307,7 @@ files:
307
307
  - app/models/chouette/object_id.rb
308
308
  - app/models/chouette/pt_link.rb
309
309
  - app/models/chouette/route.rb
310
+ - app/models/chouette/source_type.rb
310
311
  - app/models/chouette/stop_area.rb
311
312
  - app/models/chouette/stop_point.rb
312
313
  - app/models/chouette/time_table.rb
@@ -385,6 +386,7 @@ files:
385
386
  - db/migrate/20150119160029_create_vehicle_journey_footnotes.rb
386
387
  - db/migrate/20150526075108_add_foreign_key_to_routes.rb
387
388
  - db/migrate/20150630135517_remove_uniqueness_for_registration_number.rb
389
+ - db/migrate/20150922093109_add_stable_id_to_line.rb
388
390
  - lib/chouette_factories.rb
389
391
  - lib/ninoxe.rb
390
392
  - lib/ninoxe.rb~
@@ -399,17 +401,17 @@ require_paths:
399
401
  - lib
400
402
  required_ruby_version: !ruby/object:Gem::Requirement
401
403
  requirements:
402
- - - ! '>='
404
+ - - ">="
403
405
  - !ruby/object:Gem::Version
404
406
  version: '0'
405
407
  required_rubygems_version: !ruby/object:Gem::Requirement
406
408
  requirements:
407
- - - ! '>='
409
+ - - ">="
408
410
  - !ruby/object:Gem::Version
409
411
  version: '0'
410
412
  requirements: []
411
413
  rubyforge_project:
412
- rubygems_version: 2.4.2
414
+ rubygems_version: 2.4.8
413
415
  signing_key:
414
416
  specification_version: 4
415
417
  summary: Library dedicated to Chouette access.