parking_ticket 1.0.44 → 1.0.45
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 +0 -72
- data/lib/clients/pay_by_phone/adapter.rb +8 -1
- data/lib/parking_ticket/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e95ed1e54c5f7f8cc73b4b1ab62319456daa1380ee02582e7726d0e1d8da0a17
|
4
|
+
data.tar.gz: f3cd0abbe0629928345084aab91026b4362052e737f347095c78c4b8d572c70a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14578687bbf2fb96bbd1d8f37fda3004ba0964173d128b2d4d1f6916eebecfa443bcde5c36bdb13a6c41344795e7908c3a60d5efd592db578b830657281739fb
|
7
|
+
data.tar.gz: bedac2a8e161995f28fc561065d99388e6f1e358266c5261b9c21250a26ab05ce9b3ac4c0354148ff11371c8576de8c30ff02a45080c78fefc6e33ed5ca63d13
|
data/README.md
CHANGED
@@ -19,78 +19,6 @@ Or install it yourself as:
|
|
19
19
|
|
20
20
|
$ gem install parking_ticket
|
21
21
|
|
22
|
-
## Usage
|
23
|
-
|
24
|
-
To make the gem work above your parking account you need set some environment variables :
|
25
|
-
|
26
|
-
This give you access to a bunch of classes but the most important one is the ParkingTicket::Base.
|
27
|
-
|
28
|
-
This class can be instanciated as follow :
|
29
|
-
|
30
|
-
```
|
31
|
-
parking_ticket = ParkingTicket::Base.new(
|
32
|
-
'pay_by_phone',
|
33
|
-
{
|
34
|
-
username: your_pay_by_phone_username,
|
35
|
-
password: your_pay_by_phone_password,
|
36
|
-
license_plate: your_license_plate,
|
37
|
-
zipcode: the_zipcode_where_you_are_resident,
|
38
|
-
card_number: the_card_number_registered_on_pay_by_phone_you_want_to_use, # must be in the format : xxxxxx------xxxx
|
39
|
-
}
|
40
|
-
)
|
41
|
-
```
|
42
|
-
|
43
|
-
Once instanciated and configured correctly (the methods won't work if the is a missing key in the confguration hash), you can use the two instance methods to do what you have to do :
|
44
|
-
|
45
|
-
- #current_ticket
|
46
|
-
This checks if a ticket is currently running for the license_plate.
|
47
|
-
Returns :
|
48
|
-
```
|
49
|
-
#if a ticket is found :
|
50
|
-
{
|
51
|
-
starts_on: 2023-01-11 15:40:22 UTC,
|
52
|
-
ends_on: 2023-01-18 15:40:22 UTC,
|
53
|
-
cost: 9.0,
|
54
|
-
license_plate: your_license_plate,
|
55
|
-
client: "PayByPhone",
|
56
|
-
client_ticket_id: the_id_returned_by_the_adapter,
|
57
|
-
}
|
58
|
-
|
59
|
-
#if no ticket is found
|
60
|
-
nil
|
61
|
-
```
|
62
|
-
|
63
|
-
- #renew
|
64
|
-
This will trigger the renewal of your ticket, works only if no current_ticket is found
|
65
|
-
|
66
|
-
Then you can create a scrypt like this one :
|
67
|
-
|
68
|
-
```
|
69
|
-
#your_scrypt.rb
|
70
|
-
require 'parking_ticket'
|
71
|
-
|
72
|
-
ticket_client = ParkingTicket::Base.new(
|
73
|
-
'pay_by_phone',
|
74
|
-
{
|
75
|
-
username: your_pay_by_phone_username,
|
76
|
-
password: your_pay_by_phone_password,
|
77
|
-
license_plate: your_license_plate,
|
78
|
-
zipcode: the_zipcode_where_you_are_resident,
|
79
|
-
card_number: the_card_number_registered_on_pay_by_phone_you_want_to_use, # must be in the format : xxxxxx------xxxx
|
80
|
-
}
|
81
|
-
)
|
82
|
-
|
83
|
-
unless ticket_client.current_ticket
|
84
|
-
ticket_client.renew
|
85
|
-
end
|
86
|
-
|
87
|
-
```
|
88
|
-
|
89
|
-
And play it as often as you want to ensure that you always have a ticket for your car.
|
90
|
-
(But this is very HTTP request consuming, a lot of wasted request will be performed, i am sure that you can do better than that.)
|
91
|
-
|
92
|
-
Exemple of application : [parkautomat](https://github.com/troptropcontent/parkautomat)
|
93
|
-
|
94
22
|
|
95
23
|
## License
|
96
24
|
|
@@ -13,6 +13,11 @@ module ParkingTicket
|
|
13
13
|
'Visa' => 'visa'
|
14
14
|
}.freeze
|
15
15
|
|
16
|
+
VEHICLE_TYPE_MAPPER = {
|
17
|
+
'Car' => 'combustion_car',
|
18
|
+
'ElectricMotorcycle' => 'electric_motorcycle'
|
19
|
+
}.freeze
|
20
|
+
|
16
21
|
private
|
17
22
|
|
18
23
|
def fetch_and_map_vehicles
|
@@ -20,7 +25,8 @@ module ParkingTicket
|
|
20
25
|
{
|
21
26
|
client_internal_id: vehicle['vehicleId'],
|
22
27
|
license_plate: vehicle['licensePlate'],
|
23
|
-
|
28
|
+
vehicle_type: VEHICLE_TYPE_MAPPER[vehicle['type']],
|
29
|
+
vehicle_description: vehicle.dig("profile", "description"),
|
24
30
|
}
|
25
31
|
end
|
26
32
|
end
|
@@ -97,3 +103,4 @@ module ParkingTicket
|
|
97
103
|
end
|
98
104
|
end
|
99
105
|
end
|
106
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parking_ticket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.45
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Ecrepont
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|