transilien_microservices 0.0.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57960fb00242ddd3df6ccaa4771a6c288e6d4745
4
- data.tar.gz: b8aad89e1f894874be95e82265e2c3a7d7d49c73
3
+ metadata.gz: f9edc20c8388c63c1f098020303be8769383a272
4
+ data.tar.gz: c91f0fa738e3324982a240ec925d793b8ef1afcb
5
5
  SHA512:
6
- metadata.gz: 27a3fbb5e779c25fb9fb66d9fe838cf5fa839d9fd798e0d60d1fdb4adc785103b256c35ebdb4c32970e6c5aa13ca4cd480709feeb7519e8e7d9cdccb17f577ea
7
- data.tar.gz: 100ebd60aa8ac7b8c733f7b7ad0ae079f5ca05f18c4e70a293840416a86a5d7bbac016304b3ae80d9594a0cc65ceb7d43b75645106bf73f721c6c5e6cc2b6a81
6
+ metadata.gz: 85c1d4722e0b2b6e0d35e789efa8ebd0ffcadf6952acd7136ed1be67c3f9bc2a910d6dcfae5291255db72d5bbbe5e16ed471e2c706ae5f8474a42cf7d6762b2c
7
+ data.tar.gz: f43eeed688f5ba7e4fbd3d359a223860ecce59db4c5b25248c782ff40aeeba5b2e2e7166acda0111a218bd1610c7164c712406724eb0f99a4e21053541fdc218
@@ -1 +1 @@
1
- 2.0.0-p0
1
+ 2.2.4
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.0.0"
5
+ - "2.1.8"
6
+ - "2.2.4"
7
+
8
+ # uncomment this line if your project needs to run something other than `rake`:
9
+ script: bundle exec rspec spec
@@ -0,0 +1,4 @@
1
+ - 1.0.0 (2015-12-21)
2
+ * 2 years without real update: make it an major
3
+ * Upgrade nokogiri due to security issues
4
+ * Add changelog file
@@ -1,62 +1,62 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- transilien_microservices (0.0.7)
4
+ transilien_microservices (1.0.0)
5
5
  faraday (>= 0.8.4)
6
- nokogiri (>= 1.5.5)
6
+ nokogiri (>= 1.6)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  celluloid (0.15.2)
12
12
  timers (~> 1.1.0)
13
- coderay (1.1.0)
13
+ coderay (1.0.9)
14
14
  diff-lcs (1.2.5)
15
- faraday (0.9.0)
15
+ faraday (0.9.2)
16
16
  multipart-post (>= 1.2, < 3)
17
- ffi (1.9.3)
17
+ ffi (1.9.0)
18
18
  formatador (0.2.4)
19
- guard (2.2.5)
19
+ guard (2.1.1)
20
20
  formatador (>= 0.2.4)
21
21
  listen (~> 2.1)
22
22
  lumberjack (~> 1.0)
23
23
  pry (>= 0.9.12)
24
24
  thor (>= 0.18.1)
25
- guard-rspec (4.2.3)
26
- guard (~> 2.1)
27
- rspec (>= 2.14, < 4.0)
28
- listen (2.4.0)
25
+ guard-rspec (2.5.4)
26
+ guard (>= 1.1)
27
+ rspec (~> 2.11)
28
+ listen (2.1.1)
29
29
  celluloid (>= 0.15.2)
30
30
  rb-fsevent (>= 0.9.3)
31
31
  rb-inotify (>= 0.9)
32
32
  lumberjack (1.0.4)
33
33
  method_source (0.8.2)
34
- mini_portile (0.5.2)
34
+ mini_portile2 (2.0.0)
35
35
  multipart-post (2.0.0)
36
- nokogiri (1.6.1)
37
- mini_portile (~> 0.5.0)
38
- pry (0.9.12.4)
39
- coderay (~> 1.0)
36
+ nokogiri (1.6.7.1)
37
+ mini_portile2 (~> 2.0.0.rc2)
38
+ pry (0.9.12.2)
39
+ coderay (~> 1.0.5)
40
40
  method_source (~> 0.8)
41
41
  slop (~> 3.4)
42
- pry-doc (0.5.1)
42
+ pry-doc (0.4.6)
43
43
  pry (>= 0.9)
44
44
  yard (>= 0.8)
45
- rb-fsevent (0.9.4)
46
- rb-inotify (0.9.3)
45
+ rb-fsevent (0.9.3)
46
+ rb-inotify (0.9.2)
47
47
  ffi (>= 0.5.0)
48
- rspec (2.14.1)
49
- rspec-core (~> 2.14.0)
50
- rspec-expectations (~> 2.14.0)
51
- rspec-mocks (~> 2.14.0)
52
- rspec-core (2.14.7)
53
- rspec-expectations (2.14.4)
48
+ rspec (2.99.0)
49
+ rspec-core (~> 2.99.0)
50
+ rspec-expectations (~> 2.99.0)
51
+ rspec-mocks (~> 2.99.0)
52
+ rspec-core (2.99.2)
53
+ rspec-expectations (2.99.2)
54
54
  diff-lcs (>= 1.1.3, < 2.0)
55
- rspec-mocks (2.14.4)
56
- slop (3.4.7)
55
+ rspec-mocks (2.99.2)
56
+ slop (3.4.6)
57
57
  thor (0.18.1)
58
58
  timers (1.1.0)
59
- yard (0.8.7.3)
59
+ yard (0.8.7.2)
60
60
 
61
61
  PLATFORMS
62
62
  ruby
@@ -67,3 +67,6 @@ DEPENDENCIES
67
67
  pry-doc
68
68
  rspec
69
69
  transilien_microservices!
70
+
71
+ BUNDLED WITH
72
+ 1.11.2
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2013 Thomas Lecavelier
1
+ Copyright (c) 2012 Thomas Lecavelier
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,106 +1,74 @@
1
1
  # TransilienMicroservices
2
2
 
3
- Ruby implementation of SNCF Transilien Microservices.
4
-
5
- Here is the original service documentation: http://test.data-sncf.com/index.php/transilien.html/api.22.22-micro-services.html
6
-
7
- These services let you know the theoric train times on the Transilien service.
8
-
9
- Disclamer: The gem only intends to implements the API. If you want a « logical » way to exploits SNCF data, see EasyTransilien gem: https://github.com/ook/easy_transilien
3
+ TODO: Write a gem description
10
4
 
11
5
  ## Installation
12
6
 
13
- Gem developped with ruby 2.0.0, should work with ruby 1.9.3.
7
+ Gem developped with ruby 2.0.0, should work with ruby 1.9.3
14
8
 
15
9
  Add this line to your application's Gemfile:
16
10
 
17
- ```ruby
18
- gem 'transilien_microservices'
19
- ````
11
+ gem 'transilien_microservices'
20
12
 
21
13
  And then execute:
22
14
 
23
- ```sh
24
- $ bundle
25
- ```
15
+ $ bundle
26
16
 
27
17
  Or install it yourself as:
28
18
 
29
- ```sh
30
- $ gem install transilien_microservices
31
- ```
19
+ $ gem install transilien_microservices
32
20
 
33
21
  ## Usage
34
22
 
35
- The best way to access data is certainly querying through `StopArea`. Start by fetching them.
23
+ The best way to access data is certainly querying through StopArea: start by fetching them.
36
24
 
37
- ```ruby
38
- stop_areas = Transilien::StopArea.find
39
- ```
25
+ stop_areas = Transilien::StopArea.find
40
26
 
41
- Every Transilien "main" object has the same attributes:
27
+ Every Transilien "main" objects have the same attributes:
42
28
 
43
- ```ruby
44
- stop_areas.first.inspect
45
- => "#<Transilien::StopArea external_code=\"DUA8738221\" name=\"LA DEFENSE GRANDE ARCHE\" >"
46
- ```
29
+ stop_areas.first.inspect
30
+ => "#<Transilien::StopArea external_code=\"DUA8738221\" name=\"LA DEFENSE GRANDE ARCHE\" >"
47
31
 
48
- * `name` is a "public" name. Can't be filtered directly through Transilien API
49
- * `external_code` is the true "key" to use in queries.
32
+ * "name" is a "public" name. Can't be filtered directly through Transilien API
33
+ * "external_code" is the true "key" to use in queries.
50
34
 
51
- As a bonus method, `#payload` returns the node used to build this object.
35
+ They have in bonus #payload method which return the node used to build this object.
52
36
 
53
- If you want to find a commercial line that stops by two `StopArea`, say: Val d'Argenteuil (DUA8738179) and Paris Saint Lazare (DUA8738400) you can query them this way:
37
+ If you want to find a commercial line that stops by two StopArea, say: Val d'Argenteuil (DUA8738179) and Paris Saint Lazare (DUA8738400) you can query this way:
54
38
 
55
- ```ruby
56
- val_stlaz_lines = Transilien::Line.find(stop_area_external_code: {and: ['DUA8738400', 'DUA8738179']})
57
- ```
39
+ val_stlaz_lines = Transilien::Line.find(stop_area_external_code: {and: ['DUA8738400', 'DUA8738179']})
58
40
 
59
- Ok, but you will probably care about the direction you're taking. You're going from Val to StLaz, not the inverse, so precise it:
41
+ Ok, but to tell the truth, I doubt that you don't bother about the way: you're going from Val to StLaz, not the inverse, so precise it:
60
42
 
61
- ```ruby
62
- val_to_stlaz_lines = Transilien::Line.find(destination_external_code: 'DUA8738400', stop_area_external_code: 'DUA8738179')
63
- ```
43
+ val_to_stlaz_lines = Transilien::Line.find(destination_external_code: 'DUA8738400', stop_area_external_code: 'DUA8738179')
64
44
 
65
- You get an `Array` of `Transilien::Line` that meet your wish.
45
+ You get an Array of Transilien::Line fullfilling your wish.
66
46
 
67
- Staying on this example, we'll stay with the "biggest" Line of the set: "Mantes la Jolie => Gare St Lazare via CONFLANS" DUA800854044
47
+ Staying on that example, we'll stay with the "biggest" Line of the set: "Mantes la Jolie => Gare St Lazare via CONFLANS" DUA800854044
68
48
  To get ALL the stops served by this Line:
69
49
 
70
- ```ruby
71
- Transilien::StopArea.find(line_external_code: 'DUA800854044')
72
- ```
73
-
74
- Ok, that's fun. But Transilien is all about train and departures. What are the trains going from Val d’Argenteuil to Paris Saint Lazare? `Transilien::VehicleJourney` is all about it:
50
+ Transilien::StopArea.find(line_external_code: 'DUA800854044')
75
51
 
76
- ```ruby
77
- instant = Time.new
78
- start_time = Time.local(instant.year, instant.month, instant.day, 17, 30)
79
- end_time = Time.local(instant.year, instant.month, instant.day, 18, 45)
80
- Transilien::VehicleJourney.find stop_area_external_code: {and: ['DUA8738400', 'DUA8738179'], date: Transilien.date(instant), start_time: Transilien.time(start_time), end_time: Transilien.time(end_time) }
81
- ```
52
+ Ok, that's fun. But Transilien is all about train and departures. What are the trains going from Val d’Argenteuil to Paris Saint Lazare? Transilien::VehicleJourney is all about it
82
53
 
83
- Yeah! Better. You still have a problem: this gives you all the journeys starting between `start_time` and `end_time`, but doesnt't give a fuck about your direction.
54
+ instant = Time.new
55
+ start_time = Time.local(instant.year, instant.month, instant.day, 17, 30)
56
+ end_time = Time.local(instant.year, instant.month, instant.day, 18, 45)
57
+ Transilien::VehicleJourney.find stop_area_external_code: {and: ['DUA8738400', 'DUA8738179'], date: Transilien.date(instant), start_time: Transilien.time(start_time), end_time: Transilien.time(end_time) }
84
58
 
85
- Ready to forget what you just learnt? Go back a little bit before this point: a `Line` instance always has at least two `Route` (one way and the other). And its finder accepts a convenient parameter: `check_order`. If set to `1` or `2` stops, `Route` returned will honor the given way by stops order:
59
+ Yeah! Better. You still have a problem: this give you all the journey starting between start_time and end_time on date instant, but don't give a fuck to your way.
86
60
 
87
- ```ruby
88
- routes_stlaz_val = Transilien::Route.find(stop_area_external_code: {and:['DUA8738400','DUA8738179']}, check_order: 1)
89
- ```
61
+ Ready to forget what you just learnt? Go back a little bit before this point: a Line instance always have at least two Route (one way, the other). And its finder understand a convenient param: CheckOrder. If set to 1, and 2 stops are given, Route returned will honor the given way by stops order:
90
62
 
91
- Here you only get `Route`s stoping by DUA8738400 then DUA8738179, not the inverse.
63
+ routes_stlaz_val = Transilien::Route.find(stop_area_external_code: {and:['DUA8738400','DUA8738179']}, check_order: 1)
92
64
 
93
- Now it'll be easy to get a `VehicleJourney` matching your needs. The same `VehicleJourney` will become:
65
+ Here you have only Route stoping by DUA8738400 then DUA8738179, not the inverse.
94
66
 
95
- ```
96
- Transilien::VehicleJourney.find route_external_code: routes_stlaz_val.map(&:external_code), date: Transilien.date(instant), start_time: Transilien.time(start_time), end_time: Transilien.time(end_time)
97
- ```
67
+ Now it'll be easy to get VehicleJourney matching your needs. The same VehicleJourney will become:
98
68
 
99
- Easier, isn't it? Now take every `Stop` and keep only your matching `StopArea`: you'll get your hours of departures and arrivals :)
69
+ Transilien::VehicleJourney.find route_external_code: routes_stlaz_val.map(&:external_code), date: Transilien.date(instant), start_time: Transilien.time(start_time), end_time: Transilien.time(end_time)
100
70
 
101
- ## Documentation
102
-
103
- You're reading it… Ok, have a look to http://rubydoc.info/gems/transilien_microservices for code documentation. Note: you'll get a better understanding of that implementations if your read API documentation, see first link.
71
+ Easier, isn't it? Now take every Stop and keep only your matching StopArea: you'll get your hours of departures and arrivals :)
104
72
 
105
73
  ## Contributing
106
74
 
@@ -110,10 +78,4 @@ You're reading it… Ok, have a look to http://rubydoc.info/gems/transilien_micr
110
78
  4. Push to the branch (`git push origin my-new-feature`)
111
79
  5. Create new Pull Request
112
80
 
113
- NOTA: you're a beginner gem dev? This command may help you:
114
-
115
- ```sh
116
- $ pry -Ilib -rtransilien_microservices
117
- ```
118
-
119
- (You can replace `pry` with `irb` if you're not that kind of person…)
81
+ NOTA: you're a beginner gem dev? This command may help you: pry -Ilib -rtransilien_microservices (you can replace pry with irb if you're not a good person…)
@@ -15,20 +15,4 @@ class Transilien::Line < Transilien::MicroService
15
15
  def backward
16
16
  payload.at('Backward')
17
17
  end
18
-
19
- def code
20
- payload['LineCode']
21
- end
22
-
23
- def stop_points
24
- @stop_points ||= Transilien::StopPoint.find(line_external_code: external_code)
25
- end
26
-
27
- def stop_areas
28
- @stop_areas ||= Transilien::StopArea.find(line_external_code: external_code)
29
- end
30
-
31
- def routes
32
- @routes ||= Transilien::Route.find(line_external_code: external_code)
33
- end
34
18
  end
@@ -60,10 +60,10 @@ class Transilien::MicroService
60
60
 
61
61
  self.filters = filters
62
62
  response = self.http.get(action_param, params)
63
- #puts('== Request: ')
64
- #puts(action_param.inspect)
65
- #puts(params.inspect)
66
- #puts(response.env[:url].inspect)
63
+ puts('== Request: ')
64
+ puts(action_param.inspect)
65
+ puts(params.inspect)
66
+ puts(response.env[:url].inspect)
67
67
  body = response.body
68
68
  collection = []
69
69
  doc = Nokogiri.XML(body)
@@ -1,9 +1,2 @@
1
1
  class Transilien::Network < Transilien::MicroService
2
- def lines
3
- @lines ||= Transilien::Line.find(network_external_code: external_code)
4
- end
5
-
6
- def codes
7
- @codes ||= lines.map(&:code).uniq.sort
8
- end
9
2
  end
@@ -4,7 +4,6 @@ class Transilien::Stop < Transilien::FakeMicroService
4
4
  class << self
5
5
  def from_node(node, access_time)
6
6
  item = new
7
- item.access_time = access_time
8
7
  item.payload = node
9
8
 
10
9
  stop_node = node.at('StopTime')
@@ -49,16 +49,4 @@ class Transilien::StopArea < Transilien::MicroService
49
49
  @hangs ||= payload.at('HangList').children
50
50
  end
51
51
 
52
- def stop_points
53
- @stop_points ||= Transilien::StopPoint.find(stop_area_external_code: external_code)
54
- end
55
-
56
- def lines
57
- @lines ||= Transilien::Line.find(stop_area_external_code: external_code)
58
- end
59
-
60
- def codes
61
- @codes ||= lines.map(&:code).uniq.sort
62
- end
63
-
64
52
  end
@@ -1,37 +1,20 @@
1
- # Represents Time in Transilien MS API
2
- # Theorically, you NEVER had to instanciate them by yourself
3
- # Note: +total_seconds+ and +day+ looks like mysteries for myself right now…
4
1
  class Transilien::Time < Transilien::FakeMicroService
5
2
  attr_accessor :total_seconds, :day, :hour, :minute
6
3
 
7
4
  class << self
8
- # Build a `Transilien::Time` from a Nokogiri::Node
9
5
  def from_node(node, access_time)
10
6
  item = new
11
7
  item.payload = node
12
8
 
13
9
  item.total_seconds = node.at('TotalSeconds').text
14
- item.day = node.at('Day').text.to_i
15
- item.hour = node.at('Hour').text.to_i
16
- item.minute = node.at('Minute').text.to_i
10
+ item.day = node.at('Day').text
11
+ item.hour = node.at('Hour').text
12
+ item.minute = node.at('Minute').text
17
13
  item
18
14
  end
19
15
  end
20
16
 
21
- # String conversion of the instance.
22
- # It aims only to permit caching (see Transilien::Microservice class)
23
- # @return [String] representation of that instance
24
- def name
25
- "#{day}:#{hour}:#{minute}|#{total_seconds}"
26
- end
27
-
28
- # Convert this object to ruby `::Time`
29
- # Since the current time is not known, set it to `Time.new` year, month and day
30
- def time
31
- now = Time.new
32
- this_month_days_count = Date.new(now.year, now.month, -1).day
33
- return Time.local(now.year + 1, 1, 1, hour, minute) if day == 1 && now.month == 12 && now.day == this_month_days_count
34
- return Time.local(now.year, now.month + 1, 1, hour, minute) if day == 1 && this_month_days_count == now.day
35
- Time.local(now.year, now.month, now.day + day, hour, minute)
17
+ def name # objective: enable caching
18
+ "#{day}:#{hour}:#{minutes}|#{total_seconds}"
36
19
  end
37
20
  end
@@ -1,3 +1,3 @@
1
1
  module Transilien
2
- VERSION = "0.0.7"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -1,17 +1,16 @@
1
- require "transilien/version.rb"
2
- require "transilien/micro_service.rb"
3
- require "transilien/time.rb"
4
- require "transilien/network.rb"
5
- require "transilien/mode_type.rb"
6
- require "transilien/line.rb"
7
- require "transilien/route.rb"
8
- require "transilien/stop_point.rb"
9
- require "transilien/stop_area.rb"
10
- require "transilien/vehicle_journey.rb"
11
- require "transilien/mode.rb"
12
- require "transilien/company.rb"
13
- require "transilien/stop.rb"
14
- require "transilien/route_point.rb"
1
+ require "./lib/transilien/version.rb"
2
+ require "./lib/transilien/micro_service.rb"
3
+ require "./lib/transilien/time.rb"
4
+ require "./lib/transilien/network.rb"
5
+ require "./lib/transilien/mode_type.rb"
6
+ require "./lib/transilien/line.rb"
7
+ require "./lib/transilien/route.rb"
8
+ require "./lib/transilien/stop_point.rb"
9
+ require "./lib/transilien/stop_area.rb"
10
+ require "./lib/transilien/vehicle_journey.rb"
11
+ require "./lib/transilien/mode.rb"
12
+ require "./lib/transilien/company.rb"
13
+ require "./lib/transilien/stop.rb"
15
14
 
16
15
  module Transilien
17
16
  def self.date(time)
@@ -1,5 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
+ raw_payload = %(
4
+
5
+ )
6
+
3
7
  describe Transilien::MicroService do
4
8
  it 'should get a set of Stop' do
5
9
  # This payload was generated from
@@ -10,11 +10,10 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["thomas-gems@lecavelier.name"]
11
11
  gem.description = %q{Implements SNCF Transilien micro-services API: enable access to their theoric offer.}
12
12
  gem.summary = %q{See http://test.data-sncf.com/index.php?p=transilien}
13
- gem.homepage = "https://github.com/ook/transilien_microservices"
14
- gem.license = 'MIT'
13
+ gem.homepage = ""
15
14
 
16
15
  gem.add_runtime_dependency('faraday', '>= 0.8.4') # HTTP(S) connections
17
- gem.add_runtime_dependency('nokogiri', '>= 1.5.5') # XML parsing
16
+ gem.add_runtime_dependency('nokogiri', '>= 1.6') # XML parsing
18
17
 
19
18
  gem.files = `git ls-files`.split($/)
20
19
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transilien_microservices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Lecavelier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-31 00:00:00.000000000 Z
11
+ date: 2015-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.8.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.5.5
33
+ version: '1.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.5.5
40
+ version: '1.6'
41
41
  description: 'Implements SNCF Transilien micro-services API: enable access to their
42
42
  theoric offer.'
43
43
  email:
@@ -46,10 +46,11 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - .gitignore
50
- - .rspec
51
- - .ruby-version
52
- - CHANGELOG
49
+ - ".gitignore"
50
+ - ".rspec"
51
+ - ".ruby-version"
52
+ - ".travis.yml"
53
+ - Changelog.md
53
54
  - Gemfile
54
55
  - Gemfile.lock
55
56
  - Guardfile
@@ -63,7 +64,6 @@ files:
63
64
  - lib/transilien/mode_type.rb
64
65
  - lib/transilien/network.rb
65
66
  - lib/transilien/route.rb
66
- - lib/transilien/route_point.rb
67
67
  - lib/transilien/stop.rb
68
68
  - lib/transilien/stop_area.rb
69
69
  - lib/transilien/stop_point.rb
@@ -71,19 +71,13 @@ files:
71
71
  - lib/transilien/vehicle_journey.rb
72
72
  - lib/transilien/version.rb
73
73
  - lib/transilien_microservices.rb
74
- - spec/line_DUA800854046.xml
75
- - spec/line_spec.rb
76
74
  - spec/microservice_spec.rb
77
75
  - spec/spec_helper.rb
78
- - spec/stop_area_spec.rb
79
- - spec/stoparea_DUA8738400.xml
80
- - spec/time_spec.rb
81
76
  - spec/vehicle_journey_alone.xml
82
77
  - spec/vehicle_journey_spec.rb
83
78
  - transilien_microservices.gemspec
84
- homepage: https://github.com/ook/transilien_microservices
85
- licenses:
86
- - MIT
79
+ homepage: ''
80
+ licenses: []
87
81
  metadata: {}
88
82
  post_install_message:
89
83
  rdoc_options: []
@@ -91,28 +85,23 @@ require_paths:
91
85
  - lib
92
86
  required_ruby_version: !ruby/object:Gem::Requirement
93
87
  requirements:
94
- - - '>='
88
+ - - ">="
95
89
  - !ruby/object:Gem::Version
96
90
  version: '0'
97
91
  required_rubygems_version: !ruby/object:Gem::Requirement
98
92
  requirements:
99
- - - '>='
93
+ - - ">="
100
94
  - !ruby/object:Gem::Version
101
95
  version: '0'
102
96
  requirements: []
103
97
  rubyforge_project:
104
- rubygems_version: 2.0.0
98
+ rubygems_version: 2.4.5.1
105
99
  signing_key:
106
100
  specification_version: 4
107
101
  summary: See http://test.data-sncf.com/index.php?p=transilien
108
102
  test_files:
109
- - spec/line_DUA800854046.xml
110
- - spec/line_spec.rb
111
103
  - spec/microservice_spec.rb
112
104
  - spec/spec_helper.rb
113
- - spec/stop_area_spec.rb
114
- - spec/stoparea_DUA8738400.xml
115
- - spec/time_spec.rb
116
105
  - spec/vehicle_journey_alone.xml
117
106
  - spec/vehicle_journey_spec.rb
118
107
  has_rdoc:
data/CHANGELOG DELETED
@@ -1,23 +0,0 @@
1
- 0.0.7
2
- * Bug fix: No longer crash like a drunk sea otter when we're at the end of a month or a year…
3
-
4
- 0.0.6
5
- * Change: It no longer reject any Line due to weird CodeLine. See EasyTransilien gem for fixes of SNCF shitty data
6
-
7
- 0.0.5
8
- * New: plenty of logical links to transverse object instances (ie: Transilien::Line -> #stop_areas #stop_points #routes, etc.)
9
- * New: Transilien::RoutePoint that UFO between Route and StopArea and StopPoint...
10
-
11
- 0.0.4
12
- * New: Transilien::Line#code give the Line code well known by customers (Ok, I admit it: I need that info for EasyTransilien T_T)
13
-
14
- 0.0.3
15
- * Bug fix: Transilien::Time#name now works
16
- * New : Transilien::Time#time convert instance into ruby Time instance
17
- * Try to start documentation, Yard compatible
18
-
19
- 0.0.2
20
- * Fix require path to ease gem usage
21
-
22
- 0.0.1
23
- * Initial release. Just work
@@ -1,5 +0,0 @@
1
- class Transilien::RoutePoint < Transilien::MicroService
2
- def stop_point
3
- @stop_point ||= Transilien::StopPoint.find(stop_point_external_code: payload.at('StopPoint').at('StopPointExternalCode'))
4
- end
5
- end
@@ -1 +0,0 @@
1
- <?xml version="1.0" encoding="ISO-8859-1"?><ActionLineList><Params Function="api"><SafeMode>0</SafeMode><action>PTReferential</action><RequestedType>linelist</RequestedType><lineexternalcode>DUA800854046</lineexternalcode><networkexternalcode>dua801;dua802;dua803;dua804;dua805;dua850;dua851;dua852;dua853;dua854;dua855</networkexternalcode><interface>1_10</interface><login>opendata</login></Params><LineList LineCount="1"><Line LineIdx="1628" LineId="1627" LineName="Gare St Lazare =&gt; Vernon VIA CONFLANS" LineCode="J" LineExternalCode="DUA800854046" LineAdditionalData="" SortOrder="1628" LineColor="000000" HasAdaptedRoute="0"><ModeType ModeTypeIdx="15" ModeTypeExternalCode="RapidTransit" ModeTypeName="Train de banlieue / RER"/><Network NetworkIdx="76" NetworkId="8" NetworkName="Paris St Lazare" NetworkExternalCode="DUA854"></Network><Forward ForwardName="A"><Direction><StopArea StopAreaIdx="0" StopAreaId="-1" StopAreaName="" StopAreaExternalCode="" MainStopArea="0" MultiModal="0" CarPark="0" MainConnection="0" AdditionalData="" ResaRailCode=""><City CityIdx="0" CityId="-1" CityName="" CityExternalCode="" CityCode=""><Country CountryIdx="0" CountryId="-1" CountryName="" CountryExternalCode=""/></City><Coord/></StopArea></Direction></Forward><Backward BackwardName=""><Direction><StopArea StopAreaIdx="0" StopAreaId="-1" StopAreaName="" StopAreaExternalCode="" MainStopArea="0" MultiModal="0" CarPark="0" MainConnection="0" AdditionalData="" ResaRailCode=""><City CityIdx="0" CityId="-1" CityName="" CityExternalCode="" CityCode=""><Country CountryIdx="0" CountryId="-1" CountryName="" CountryExternalCode=""/></City><Coord/></StopArea></Direction></Backward></Line></LineList><PagerInfo ResponseCount="1" ResponseStartIndex="0" TotalCount="1"/></ActionLineList>
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Transilien::Line do
4
- before(:each) do
5
- # This payload was generated from
6
- # http://ms.api.transilien.com/?Action=LineList&LineExternalCode=DUA800854046
7
- @line = Transilien::Line.from_node(Nokogiri.XML((Pathname.new('spec') + 'line_DUA800854046.xml').read).at('Line'), Time.now)
8
- end
9
-
10
- it 'should get a Line' do
11
- @line.class.should eql(Transilien::Line)
12
- end
13
-
14
- it 'should have a code' do
15
- @line.code.should eql('J')
16
- end
17
-
18
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Transilien::StopArea do
4
- before(:each) do
5
- # This payload was generated from
6
- # http://ms.api.transilien.com/?Action=StopAreaList&StopAreaExternalCode=DUA8738400
7
- @sa = Transilien::StopArea.from_node(Nokogiri.XML((Pathname.new('spec') + 'stoparea_DUA8738400.xml').read).at('StopArea'), Time.now)
8
- end
9
-
10
- it 'should be a StopArea' do
11
- @sa.class.should eq(Transilien::StopArea)
12
- end
13
-
14
- it 'should have at least a line' do
15
- #puts @sa.lines.map { |l| l.name }.inspect
16
- (@sa.lines.length >= 1).should be_true
17
- end
18
-
19
- it 'should have some codes, at least one' do
20
- @sa.codes.is_a?(Array).should be_true
21
- (@sa.codes.length > 0).should be_true
22
- end
23
-
24
- end
@@ -1 +0,0 @@
1
- <?xml version="1.0" encoding="ISO-8859-1"?><ActionStopAreaList><Params Function="api"><SafeMode>0</SafeMode><action>PTReferential</action><RequestedType>stoparealist</RequestedType><stopareaexternalcode>DUA8738400</stopareaexternalcode><networkexternalcode>dua801;dua802;dua803;dua804;dua805;dua850;dua851;dua852;dua853;dua854;dua855</networkexternalcode><interface>1_10</interface><login>opendata</login></Params><StopAreaList StopAreaCount="1"><StopArea StopAreaIdx="306" StopAreaId="311" StopAreaName="GARE DE PARIS SAINT-LAZARE" StopAreaExternalCode="DUA8738400" MainStopArea="1" MultiModal="0" CarPark="0" MainConnection="1" AdditionalData="" ResaRailCode=""><City CityIdx="1" CityId="0" CityName="Paris" CityExternalCode="75056" CityCode="75004"><Country CountryIdx="1" CountryId="0" CountryName="France" CountryExternalCode="FRA"/></City><Coord><CoordX>599145,21</CoordX><CoordY>2430788,22</CoordY></Coord><HangList><Hang StopPointIdx="1019" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1024" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1021" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1023" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1022" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1016" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1003" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1014" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1004" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1001" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="999" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1017" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="998" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1009" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1006" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1020" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1010" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1018" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="997" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1008" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1007" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1011" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1013" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1000" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1015" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1005" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1002" Duration="0" ConnectionKind="14"/><Hang StopPointIdx="1012" Duration="0" ConnectionKind="14"/></HangList><ModeList ModeCount="3"><ModeType ModeTypeIdx="5" ModeTypeExternalCode="Bus" ModeTypeName="Bus"/><ModeType ModeTypeIdx="10" ModeTypeExternalCode="Metro" ModeTypeName="M�tro"/><ModeType ModeTypeIdx="15" ModeTypeExternalCode="RapidTransit" ModeTypeName="Train de banlieue / RER"/></ModeList></StopArea></StopAreaList><PagerInfo ResponseCount="1" ResponseStartIndex="0" TotalCount="1"/></ActionStopAreaList>
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Transilien::Time do
4
- it 'should convert to ::Time easily' do
5
- tt = Transilien::Time.new
6
- tt.day = 0
7
- tt.hour = 14
8
- tt.minute = 42
9
- tt.time.is_a?(::Time).should be_true
10
- now = Time.new
11
- tt.time.should eql(Time.local(now.year, now.month, now.day, 14, 42))
12
- tt.day = 1
13
- this_month_days_count = Date.new(now.year, now.month, -1).day
14
- if now.day == this_month_days_count
15
- tt.time.should eql(Time.local(now.year, now.month+1, 1, 14, 42))
16
- else
17
- tt.time.should eql(Time.local(now.year, now.month, now.day+1, 14, 42))
18
- end
19
- end
20
-
21
- end