ztm_warszawa 0.1.1 → 0.1.3
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 +4 -4
- data/README.md +6 -2
- data/lib/ztm_warszawa/version.rb +1 -1
- data/lib/ztm_warszawa.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb65a00d5d254953f3e4279c69ad8dbfbc83787
|
4
|
+
data.tar.gz: 85b887a46eedad4774862c791426ce347483dfe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e336a47c5b6a9e7a92f01a2222f9b9150be747d42c040281e453edbada089c690876e1d0c4392929942ee808b402cf55002c7ba61c3d85fefd3e7ecd888ce21
|
7
|
+
data.tar.gz: ccc58044bedb352dcf68f8d032bf2d33b4fe59244267a7aa2b51cd4d68b4288dfa9196f266d08b533567b2ff3a05cf69ce53584ef58106c68faa45d3ed23fd14
|
data/README.md
CHANGED
@@ -36,7 +36,9 @@ First, create the the appropriate object:
|
|
36
36
|
|
37
37
|
`ztm_api = ZtmWarszawa.new(api_key)`
|
38
38
|
|
39
|
-
The API key has to be a string. It can be changed later on by calling `ztm_api.api_key = (new api key)`.
|
39
|
+
The API key has to be a string. It can be changed later on by calling `ztm_api.api_key = (new api key)`.
|
40
|
+
|
41
|
+
You can get an API key by registering [here](https://api.um.warszawa.pl/index.php?wcag=true&opc=8.8,2,0,0,).
|
40
42
|
|
41
43
|
Now, you can use the following methods:
|
42
44
|
|
@@ -44,7 +46,9 @@ Now, you can use the following methods:
|
|
44
46
|
|
45
47
|
- `get_bus_lines(bus_stop_id, bus_stop_no)`: Returns an array of bus lines (e.g. 527, 141...) that depart from a given bus stop.
|
46
48
|
|
47
|
-
- `
|
49
|
+
- `get_line_departure_hours(bus_stop_id, bus_stop_no, bus_line)`: Returns the server response with all the hours of departure of a given bus line from a given bus stop.
|
50
|
+
|
51
|
+
- `get_closest_departures(server_response, script_starting_time, bus_line, number_of_departures)`: Given the server's response from `get_line_departure_hours()`, finds a given number of closest departures. The result is an array of hashes with "bus_line" and "time" entries.
|
48
52
|
|
49
53
|
## License
|
50
54
|
|
data/lib/ztm_warszawa/version.rb
CHANGED
data/lib/ztm_warszawa.rb
CHANGED
@@ -35,7 +35,7 @@ class ZtmWarszawa
|
|
35
35
|
return bus_lines
|
36
36
|
end
|
37
37
|
|
38
|
-
# Returns the server response with all the hours of departure of a given bus line from a given bus stop
|
38
|
+
# Returns the server response with all the hours of departure of a given bus line from a given bus stop.
|
39
39
|
def get_line_departure_hours(bus_stop_id, bus_stop_no, bus_line)
|
40
40
|
url = "https://api.um.warszawa.pl/api/action/dbtimetable_get?id=e923fa0e-d96c-43f9-ae6e-60518c9f3238&busstopId=#{bus_stop_id}&busstopNr=#{bus_stop_no}&line=#{bus_line}&apikey=#{@api_key}"
|
41
41
|
response = HTTParty.get(url).parsed_response["result"]
|