transilien_microservices 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9ce413dfd4786a986a8fe3226cef622df78e9f9
4
- data.tar.gz: 3b672ac27a336f667d79fa1f73543d9012a84bb6
3
+ metadata.gz: 4e8cfb26dac1858fbf4b4c7ebac75daadda2c7cb
4
+ data.tar.gz: 4cadc46e4741ee1a22f7f367aae37588f6f285f3
5
5
  SHA512:
6
- metadata.gz: 0c673cb9635c16509f58f0829002111cfdf40302ff62d0252f5f27dac5ec6d393f171074e1d16096224d20cedcb7d9460608689fe5fd0e8265d594d6a8258253
7
- data.tar.gz: 70b3ebb0084748339843dd5b64fd33b4cec56d5cf1c5f37be79a2b7062171b3b0b81d5104f63a6804641914ca1e829e4c9b4eba7fdc471e1546e37a34ab0be73
6
+ metadata.gz: ace09e85bfcce2c6ed9fbd9a590ff119ad00c178fe008f934175a0f196b1cfc555da411eea90f4b0f62922aae559ec13c5dc40358465168e84ef3c906e2a25b5
7
+ data.tar.gz: 5109350653b20ad975bace3d805855f3ab468b480f1dcee6c85fe83b1b181e9bbe537e72120192cdd2c8d20a788a4bfb588f2cc99b63577aa702db55c89c5c84
data/README.md CHANGED
@@ -2,79 +2,101 @@
2
2
 
3
3
  Ruby implementation of SNCF Transilien Microservices.
4
4
 
5
- Here the original service documentation: http://test.data-sncf.com/index.php/transilien.html/api.22.22-micro-services.html
5
+ Here is the original service documentation: http://test.data-sncf.com/index.php/transilien.html/api.22.22-micro-services.html
6
6
 
7
- These services let you know the theoric offer on Transilien service.
7
+ These services let you know the theoric train times on the Transilien service.
8
8
 
9
- Disclamer: The gem only intend to implements the API. I'll create a "easy" wrapper to access these data in a convenient way very soon.
9
+ Disclamer: The gem only intends to implements the API. I'll create a "easy" wrapper to access these data in a convenient way very soon.
10
10
 
11
11
  ## Installation
12
12
 
13
- Gem developped with ruby 2.0.0, should work with ruby 1.9.3
13
+ Gem developped with ruby 2.0.0, should work with ruby 1.9.3.
14
14
 
15
15
  Add this line to your application's Gemfile:
16
16
 
17
- gem 'transilien_microservices'
17
+ ```ruby
18
+ gem 'transilien_microservices'
19
+ ````
18
20
 
19
21
  And then execute:
20
22
 
21
- $ bundle
23
+ ```sh
24
+ $ bundle
25
+ ```
22
26
 
23
27
  Or install it yourself as:
24
28
 
25
- $ gem install transilien_microservices
29
+ ```sh
30
+ $ gem install transilien_microservices
31
+ ```
26
32
 
27
33
  ## Usage
28
34
 
29
- The best way to access data is certainly querying through StopArea: start by fetching them.
35
+ The best way to access data is certainly querying through `StopArea`. Start by fetching them.
30
36
 
31
- stop_areas = Transilien::StopArea.find
37
+ ```ruby
38
+ stop_areas = Transilien::StopArea.find
39
+ ```
32
40
 
33
- Every Transilien "main" objects have the same attributes:
41
+ Every Transilien "main" object has the same attributes:
34
42
 
35
- stop_areas.first.inspect
36
- => "#<Transilien::StopArea external_code=\"DUA8738221\" name=\"LA DEFENSE GRANDE ARCHE\" >"
43
+ ```ruby
44
+ stop_areas.first.inspect
45
+ => "#<Transilien::StopArea external_code=\"DUA8738221\" name=\"LA DEFENSE GRANDE ARCHE\" >"
46
+ ```
37
47
 
38
- * "name" is a "public" name. Can't be filtered directly through Transilien API
39
- * "external_code" is the true "key" to use in queries.
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.
40
50
 
41
- They have in bonus #payload method which return the node used to build this object.
51
+ As a bonus method, `#payload` returns the node used to build this object.
42
52
 
43
- 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:
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:
44
54
 
45
- val_stlaz_lines = Transilien::Line.find(stop_area_external_code: {and: ['DUA8738400', 'DUA8738179']})
55
+ ```ruby
56
+ val_stlaz_lines = Transilien::Line.find(stop_area_external_code: {and: ['DUA8738400', 'DUA8738179']})
57
+ ```
46
58
 
47
- 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:
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:
48
60
 
49
- val_to_stlaz_lines = Transilien::Line.find(destination_external_code: 'DUA8738400', stop_area_external_code: 'DUA8738179')
61
+ ```ruby
62
+ val_to_stlaz_lines = Transilien::Line.find(destination_external_code: 'DUA8738400', stop_area_external_code: 'DUA8738179')
63
+ ```
50
64
 
51
- You get an Array of Transilien::Line fullfilling your wish.
65
+ You get an `Array` of `Transilien::Line` that meet your wish.
52
66
 
53
- Staying on that example, we'll stay with the "biggest" Line of the set: "Mantes la Jolie => Gare St Lazare via CONFLANS" DUA800854044
67
+ Staying on this example, we'll stay with the "biggest" Line of the set: "Mantes la Jolie => Gare St Lazare via CONFLANS" DUA800854044
54
68
  To get ALL the stops served by this Line:
55
69
 
56
- Transilien::StopArea.find(line_external_code: 'DUA800854044')
70
+ ```ruby
71
+ Transilien::StopArea.find(line_external_code: 'DUA800854044')
72
+ ```
57
73
 
58
- 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
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:
59
75
 
60
- instant = Time.new
61
- start_time = Time.local(instant.year, instant.month, instant.day, 17, 30)
62
- end_time = Time.local(instant.year, instant.month, instant.day, 18, 45)
63
- 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) }
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
+ ```
64
82
 
65
- 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.
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.
66
84
 
67
- 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:
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:
68
86
 
69
- routes_stlaz_val = Transilien::Route.find(stop_area_external_code: {and:['DUA8738400','DUA8738179']}, check_order: 1)
87
+ ```ruby
88
+ routes_stlaz_val = Transilien::Route.find(stop_area_external_code: {and:['DUA8738400','DUA8738179']}, check_order: 1)
89
+ ```
70
90
 
71
- Here you have only Route stoping by DUA8738400 then DUA8738179, not the inverse.
91
+ Here you only get `Route`s stoping by DUA8738400 then DUA8738179, not the inverse.
72
92
 
73
- Now it'll be easy to get VehicleJourney matching your needs. The same VehicleJourney will become:
93
+ Now it'll be easy to get a `VehicleJourney` matching your needs. The same `VehicleJourney` will become:
74
94
 
75
- 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)
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
+ ```
76
98
 
77
- Easier, isn't it? Now take every Stop and keep only your matching StopArea: you'll get your hours of departures and arrivals :)
99
+ Easier, isn't it? Now take every `Stop` and keep only your matching `StopArea`: you'll get your hours of departures and arrivals :)
78
100
 
79
101
  ## Contributing
80
102
 
@@ -86,6 +108,8 @@ Easier, isn't it? Now take every Stop and keep only your matching StopArea: you'
86
108
 
87
109
  NOTA: you're a beginner gem dev? This command may help you:
88
110
 
89
- pry -Ilib -rtransilien_microservices
111
+ ```sh
112
+ $ pry -Ilib -rtransilien_microservices
113
+ ```
90
114
 
91
- (you can replace pry with irb if you're not a good person…)
115
+ (You can replace `pry` with `irb` if you're not that kind of person…)
@@ -1,3 +1,3 @@
1
1
  module Transilien
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,16 +1,16 @@
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"
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
14
 
15
15
  module Transilien
16
16
  def self.date(time)
@@ -1,9 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
- raw_payload = %(
4
-
5
- )
6
-
7
3
  describe Transilien::MicroService do
8
4
  it 'should get a set of Stop' do
9
5
  # This payload was generated from
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transilien_microservices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Lecavelier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-29 00:00:00.000000000 Z
11
+ date: 2013-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday