ninoxe 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTVmYzlhODAxNTc2NDUyNzA3ZjBlYTIwYTM2NDE2ODk4MWFhZmIzMA==
4
+ MmJlMTlmNjY1MmU2ZGY1OGRjOTZhYTI0ZWY5NDA4NDg4MWI3MTg3Nw==
5
5
  data.tar.gz: !binary |-
6
- ZTJmOTZlMmMwYTY0ZmEyMzM3YmEzOGE3MGRmZjdkMWMxNTk2MjNiZg==
6
+ NzE5YjQ5Mjk2YjNmNTdlY2E5ODdjNTEyMzhhNThmZWMwNThmMTIzOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZWExMzk3Nzk1MWYwMDgwNWY5NDY2Njk2Y2ZmOGM2MjNlMGI3NTM3OGE2MTgz
10
- OWRmYzE5NzQ5MGZmNTk4YzUzMWE2ZjQyZGQyY2Y5MmRjMjZkNmNiYTRmNzQz
11
- Y2M2MmE2ZGU5YjM4MjJlNDdjYWNlZjc0MWQ1Y2E3YzRkOTQxNjA=
9
+ MzNiODQxYjE0NzY4Yzk5NzkxNDNhMjI4ODdmYmRmMmFjY2FmOWE2MGZjNWFi
10
+ MDU4ZTJhZDBiNDllYmI1YzZhNTFkYmIxOTIyYWYxYzNkNGVhN2FjNzFhYzM1
11
+ ZDQ3OWY0MzkwOTkxNWJmOTM4MmIyYzZlZjkwZTRlZTRmNzNmMDE=
12
12
  data.tar.gz: !binary |-
13
- NmZiZmY3Zjc3MTRhOTg2ODQ1MTcyMjU5NTIxYTlhZTVkNjE1M2VlMzdkMzgy
14
- NTQ1ZjdiN2MwOWE4ZjVlZTgyMTg0ZGVhZmMwOTFhNGE5YmRjYmUxYzFjNjE1
15
- MmNjNWJjNWQ4YWQ0ZDY3ZmRhNzRiNjdkZTJhZmEwMWVjZDE1NDE=
13
+ ZjM2YmM1Zjk4YWE1MDU3MGIwZjJlYTdiZTVhY2E1ZGQxMDc2ZGI0OWM0NWVh
14
+ ZGVkZTBjZThhZDI2NGE0ZmY5NDBlZDI1ZGFlNTA1Nzc4YjFiOWExNmRjYzk3
15
+ YjQ0ZmJlNWI1N2JiNGMxMzhjYTQ1MDVhYzEyZTRmODUwNmJlNjM=
@@ -0,0 +1,8 @@
1
+ module Chouette
2
+ module ForAlightingEnumerations
3
+ extend Enumerize
4
+ extend ActiveModel::Naming
5
+
6
+ enumerize :for_alighting, in: %w[normal forbidden request_stop is_flexible]
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Chouette
2
+ module ForBoardingEnumerations
3
+ extend Enumerize
4
+ extend ActiveModel::Naming
5
+
6
+ enumerize :for_boarding, in: %w[normal forbidden request_stop is_flexible]
7
+ end
8
+ end
@@ -6,7 +6,7 @@ class Chouette::GroupOfLine < Chouette::TridentActiveRecord
6
6
 
7
7
  validates_presence_of :name
8
8
 
9
- attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :lines
9
+ attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :lines, :registration_number
10
10
  attr_accessible :line_tokens
11
11
  attr_reader :line_tokens
12
12
 
@@ -1,39 +1,43 @@
1
- class Chouette::StopPoint < Chouette::TridentActiveRecord
2
- # FIXME http://jira.codehaus.org/browse/JRUBY-6358
3
- self.primary_key = "id"
4
-
5
- belongs_to :stop_area
6
- belongs_to :route, inverse_of: :stop_points
7
- acts_as_list :scope => 'route_id = \'#{route.id}\'',:top_of_list => 0
8
-
9
- attr_accessible :route_id, :stop_area_id, :objectid, :object_version, :creation_time, :creator_id, :position
10
-
11
- has_many :vehicle_journey_at_stops, :dependent => :destroy
12
- has_many :vehicle_journeys, :through => :vehicle_journey_at_stops, :uniq => true
13
-
14
- before_destroy :remove_dependent_journey_pattern_stop_points
15
-
16
- validates_presence_of :stop_area
17
- validate :stop_area_id_validation
18
-
19
- scope :default_order, order("position")
1
+ module Chouette
2
+ class StopPoint < TridentActiveRecord
3
+ include ForBoardingEnumerations
4
+ include ForAlightingEnumerations
5
+
6
+ # FIXME http://jira.codehaus.org/browse/JRUBY-6358
7
+ self.primary_key = "id"
8
+
9
+ belongs_to :stop_area
10
+ belongs_to :route, inverse_of: :stop_points
11
+ has_many :vehicle_journey_at_stops, :dependent => :destroy
12
+ has_many :vehicle_journeys, :through => :vehicle_journey_at_stops, :uniq => true
13
+
14
+ acts_as_list :scope => 'route_id = \'#{route.id}\'',:top_of_list => 0
15
+
16
+ attr_accessible :route_id, :stop_area_id, :objectid, :object_version, :creation_time, :creator_id, :position, :for_boarding, :for_alighting
17
+
18
+ validates_presence_of :stop_area
19
+ validate :stop_area_id_validation
20
+
21
+ scope :default_order, order("position")
22
+
23
+ before_destroy :remove_dependent_journey_pattern_stop_points
24
+ def remove_dependent_journey_pattern_stop_points
25
+ route.journey_patterns.each do |jp|
26
+ if jp.stop_point_ids.include?( id)
27
+ jp.stop_point_ids = jp.stop_point_ids - [id]
28
+ end
29
+ end
30
+ end
20
31
 
21
- def stop_area_id_validation
32
+ def stop_area_id_validation
22
33
  if stop_area_id.nil?
23
- errors.add(:stop_area_id, I18n.t("errors.messages.empty"))
34
+ errors.add(:stop_area_id, I18n.t("errors.messages.empty"))
24
35
  end
25
- end
26
-
27
- def self.area_candidates
28
- Chouette::StopArea.where( :area_type => ['Quay', 'BoardingPosition'])
29
- end
36
+ end
30
37
 
31
- def remove_dependent_journey_pattern_stop_points
32
- route.journey_patterns.each do |jp|
33
- if jp.stop_point_ids.include?( id)
34
- jp.stop_point_ids = jp.stop_point_ids - [id]
35
- end
38
+ def self.area_candidates
39
+ Chouette::StopArea.where( :area_type => ['Quay', 'BoardingPosition'])
36
40
  end
37
- end
38
41
 
42
+ end
39
43
  end
@@ -1,45 +1,49 @@
1
- class Chouette::VehicleJourneyAtStop < Chouette::ActiveRecord
2
- self.primary_key = "id"
3
-
4
- belongs_to :stop_point
5
- belongs_to :vehicle_journey
6
-
7
- after_initialize :set_virtual_attributes
8
-
9
- attr_accessor :_destroy
10
- attr_accessible :vehicle_journey_id, :stop_point_id, :connecting_service_id, :boarding_alighting_possibility, :arrival_time, :departure_time, :waiting_time, :elapse_duration, :headway_frequency, :_destroy, :stop_point
11
-
12
- validate :arrival_must_be_before_departure
13
-
14
- def arrival_must_be_before_departure
15
- # security against nil values
16
- return unless arrival_time && departure_time
17
-
18
- if exceeds_gap?( arrival_time, departure_time)
19
- errors.add(:arrival_time,I18n.t("activerecord.errors.models.vehicle_journey_at_stop.arrival_must_be_before_departure"))
1
+ module Chouette
2
+ class VehicleJourneyAtStop < ActiveRecord
3
+ include ForBoardingEnumerations
4
+ include ForAlightingEnumerations
5
+
6
+ # FIXME http://jira.codehaus.org/browse/JRUBY-6358
7
+ self.primary_key = "id"
8
+
9
+ belongs_to :stop_point
10
+ belongs_to :vehicle_journey
11
+
12
+ attr_accessor :_destroy
13
+ attr_accessible :vehicle_journey_id, :stop_point_id, :connecting_service_id, :boarding_alighting_possibility, :arrival_time, :departure_time, :waiting_time, :elapse_duration, :headway_frequency, :_destroy, :stop_point, :for_boarding, :for_alighting
14
+
15
+ validate :arrival_must_be_before_departure
16
+ def arrival_must_be_before_departure
17
+ # security against nil values
18
+ return unless arrival_time && departure_time
19
+
20
+ if exceeds_gap?( arrival_time, departure_time)
21
+ errors.add(:arrival_time,I18n.t("activerecord.errors.models.vehicle_journey_at_stop.arrival_must_be_before_departure"))
22
+ end
20
23
  end
21
- end
22
-
23
- def increasing_times_validate( previous)
24
- result = true
25
- return result unless previous
26
-
27
- if exceeds_gap?( previous.departure_time, departure_time)
28
- result = false
29
- errors.add( :departure_time, 'departure time gap overflow')
24
+
25
+ after_initialize :set_virtual_attributes
26
+ def set_virtual_attributes
27
+ @_destroy = false
30
28
  end
31
- if exceeds_gap?( previous.arrival_time, arrival_time)
32
- result = false
33
- errors.add( :arrival_time, 'arrival time gap overflow')
29
+
30
+ def increasing_times_validate( previous)
31
+ result = true
32
+ return result unless previous
33
+
34
+ if exceeds_gap?( previous.departure_time, departure_time)
35
+ result = false
36
+ errors.add( :departure_time, 'departure time gap overflow')
37
+ end
38
+ if exceeds_gap?( previous.arrival_time, arrival_time)
39
+ result = false
40
+ errors.add( :arrival_time, 'arrival time gap overflow')
41
+ end
42
+ result
34
43
  end
35
- result
36
- end
37
- def exceeds_gap?( first, second)
38
- 3600 < ( ( second-first)%( 3600 * 24))
39
- end
44
+ def exceeds_gap?( first, second)
45
+ 3600 < ( ( second-first)%( 3600 * 24))
46
+ end
40
47
 
41
- def set_virtual_attributes
42
- @_destroy = false
43
48
  end
44
-
45
49
  end
@@ -0,0 +1,9 @@
1
+ class AddBoardingAndAlightingToStopPoint < ActiveRecord::Migration
2
+ def change
3
+ add_column :stop_points, :for_boarding, :string
4
+ add_column :stop_points, :for_alighting, :string
5
+
6
+ add_column :vehicle_journey_at_stops, :for_boarding, :string
7
+ add_column :vehicle_journey_at_stops, :for_alighting, :string
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddRegistrationNumberToGroupOfLines < ActiveRecord::Migration
2
+ def change
3
+ add_column :group_of_lines, :registration_number, :string
4
+ end
5
+ end
@@ -1,4 +1,5 @@
1
1
  Factory.define :group_of_line, :class => "Chouette::GroupOfLine" do |group_of_line|
2
2
  group_of_line.sequence(:name) { |n| "Group Of Line #{n}" }
3
3
  group_of_line.sequence(:objectid) { |n| "test:GroupOfLine:#{n}" }
4
+ group_of_line.sequence(:registration_number) { |n| "#{n}" }
4
5
  end
@@ -1,3 +1,3 @@
1
1
  module Ninoxe
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
data/lib/ninoxe.rb CHANGED
@@ -4,6 +4,7 @@ require "acts_as_list"
4
4
  require "foreigner"
5
5
  require "acts_as_tree"
6
6
  require "acts-as-taggable-on"
7
+ require "enumerize"
7
8
 
8
9
  module Ninoxe
9
10
  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.1.3
4
+ version: 1.1.4
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: 2014-11-27 00:00:00.000000000 Z
14
+ date: 2015-01-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: georuby-ext
@@ -111,6 +111,20 @@ dependencies:
111
111
  - - ! '>='
112
112
  - !ruby/object:Gem::Version
113
113
  version: '3'
114
+ - !ruby/object:Gem::Dependency
115
+ name: enumerize
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: 0.8.0
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ~>
126
+ - !ruby/object:Gem::Version
127
+ version: 0.8.0
114
128
  - !ruby/object:Gem::Dependency
115
129
  name: rake
116
130
  requirement: !ruby/object:Gem::Requirement
@@ -295,6 +309,8 @@ files:
295
309
  - app/models/chouette/direction.rb
296
310
  - app/models/chouette/exporter.rb
297
311
  - app/models/chouette/file_validator.rb
312
+ - app/models/chouette/for_alighting_enumerations.rb
313
+ - app/models/chouette/for_boarding_enumerations.rb
298
314
  - app/models/chouette/group_of_line.rb
299
315
  - app/models/chouette/journey_pattern.rb
300
316
  - app/models/chouette/line.rb
@@ -378,6 +394,8 @@ files:
378
394
  - db/migrate/20141017075349_add_gtfs_fields_to_companies.rb
379
395
  - db/migrate/20141017075515_add_gtfs_fields_to_stop_areas.rb
380
396
  - db/migrate/20141017075627_add_gtfs_fields_to_lines.rb
397
+ - db/migrate/20141210123519_add_boarding_and_alighting_to_stop_point.rb
398
+ - db/migrate/20141216084607_add_registration_number_to_group_of_lines.rb
381
399
  - lib/chouette_factories.rb
382
400
  - lib/factories/chouette_access_links.rb
383
401
  - lib/factories/chouette_access_points.rb