ztm_warszawa 0.1.5 → 0.1.6
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 +15 -5
- data/lib/ztm_warszawa.rb +3 -3
- data/lib/ztm_warszawa/version.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: 7fd93bc84ecab26b7d3ebf4f0df1d4cdf9e493eb
|
4
|
+
data.tar.gz: ba71bcf8dafb8bd9b4d478397a8a4105d1e0f125
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60316c9ae4a206ba19ab155b3e09a6d289bf3d5a0ac3994221b02db9a208584b4c27fd56751ac9da3acb8f54dde06985a42c28136d0c4e381a3b78a86d25df50
|
7
|
+
data.tar.gz: 9eb1a607b7ad54a0fe3acac9c551f6cced4b4e51f3102c9af71085ad51b72700ce90409f3e67546a76015ac160f9bc6dd1b1d058ac71b8d6d0ba967666c04d5c
|
data/README.md
CHANGED
@@ -40,33 +40,43 @@ This gem depends on the `httparty` gem for making HTTP requests and the `address
|
|
40
40
|
|
41
41
|
First, create the the appropriate object:
|
42
42
|
|
43
|
-
`ztm_api = ZtmWarszawa.new`
|
43
|
+
`ztm_api = ZtmWarszawa.new("api_key")`
|
44
44
|
|
45
|
-
Most of the methods require setting an API key
|
45
|
+
The "api_key" is optional. Most of the methods require setting an API key, though; if you try to use a function which requires the API key without specifying it, an NoApiKey exception will be raised.
|
46
46
|
|
47
47
|
You can get an API key by registering [here](https://api.um.warszawa.pl/index.php?wcag=true&opc=8.8,2,0,0,).
|
48
48
|
|
49
49
|
Now, you can use the following methods:
|
50
50
|
|
51
|
-
|
51
|
+
### Methods which require setting the API key:
|
52
|
+
|
53
|
+
|
52
54
|
|
53
55
|
- `get_stop_id(bus_stop_name)`
|
54
56
|
|
55
57
|
Queries the ZTM API to get the bus stop's ID from its name. The ID is required for all the latter operations. Raises an "BusStopNotFound" exception if the bus stop hasn't been found.
|
56
58
|
|
59
|
+
|
60
|
+
|
57
61
|
- `get_bus_lines(bus_stop_id, bus_stop_no)`
|
58
62
|
|
59
63
|
Returns an array of bus lines (e.g. 527, 141...) that depart from a given bus stop. Raises an "NoDepartures" exception when the server's response is empty (which could mean no buses depart from this stop).
|
60
64
|
|
65
|
+
|
66
|
+
|
61
67
|
- `get_line_departure_hours(bus_stop_id, bus_stop_no, bus_line)`
|
62
68
|
|
63
69
|
Returns the server response with all the hours of departure of a given bus line from a given bus stop. Night bus lines (e.g. N37, N85...) are not supported due to some server-side errors (and an "NightLineError" exception is raised)
|
64
70
|
|
65
|
-
|
71
|
+
|
72
|
+
|
73
|
+
- `get_closest_departures(server_response, script_starting_time, bus_line, number_of_departures)`
|
66
74
|
|
67
75
|
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.
|
68
76
|
|
69
|
-
|
77
|
+
|
78
|
+
|
79
|
+
### Methods which don't require setting the API key:
|
70
80
|
|
71
81
|
- `check_alerts()`
|
72
82
|
|
data/lib/ztm_warszawa.rb
CHANGED
@@ -14,9 +14,9 @@ class ZtmWarszawa
|
|
14
14
|
|
15
15
|
attr_writer :api_key
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
def initialize(api_key = nil)
|
18
|
+
@api_key = api_key
|
19
|
+
end
|
20
20
|
|
21
21
|
# Queries the ZTM API to get the bus stop's ID from its name.
|
22
22
|
# The ID is required for all the latter operations.
|
data/lib/ztm_warszawa/version.rb
CHANGED