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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ead520c5b30cebbcb503045bbfdad7b43f3eba3b
4
- data.tar.gz: db7985726176205529c7449ec01e2e7af8caab61
3
+ metadata.gz: 7fd93bc84ecab26b7d3ebf4f0df1d4cdf9e493eb
4
+ data.tar.gz: ba71bcf8dafb8bd9b4d478397a8a4105d1e0f125
5
5
  SHA512:
6
- metadata.gz: 2e484701caabe832d7aa18f34b664c467759e41b3567d20939d17f014d1904c95db418fe9e9e1bbe2c78af4cdd12860fe21c7c034b94a0e6e8d39c1a4781ec4a
7
- data.tar.gz: 2592fccfcdcc2fc961edd1be26a72092df33bacebb30899cf0cf4cfbaa01de7102c24777cda27f987691ef857b1df7e3fd79493430fd98ed43c5c6ff34533fe8
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. You can set the API key by calling `ztm_api.api_key = (new api key)`. The API key has to be a string. If you try to use a function which requires the API key without specifying it, an NoApiKey exception will be raised.
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
- ##### Methods which require setting the API key:
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
- `get_closest_departures(server_response, script_starting_time, bus_line, number_of_departures)`
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
- ##### Methods which don't require setting the API key:
77
+
78
+
79
+ ### Methods which don't require setting the API key:
70
80
 
71
81
  - `check_alerts()`
72
82
 
@@ -14,9 +14,9 @@ class ZtmWarszawa
14
14
 
15
15
  attr_writer :api_key
16
16
 
17
- #def initialize(api_key)
18
- #@api_key = api_key
19
- #end
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.
@@ -1,3 +1,3 @@
1
1
  class ZtmWarszawa
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ztm_warszawa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Górni