parking_ticket 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +47 -14
- data/lib/client/pay_by_phone/request.rb +1 -1
- data/lib/parking_ticket/version.rb +1 -1
- data/parking_ticket-1.0.0.gem +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46eea131e0a69fa49115d452afc9ee575b52a06084eb8a026bf115b33b2d46f6
|
4
|
+
data.tar.gz: 735ffb052fecb3599af5bf71ec7a28c60e48e8ed2025e8cb7923e7f6bb570851
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21652de95a323f337d244d5c652a826b5cda0de762c4d3e4f7be31bcf9b62a2e5e7d14eaf7744b48ac9c7aae1de0c03984e1fe3be76cf4cd34b9a4012e785857
|
7
|
+
data.tar.gz: bfdc6306def10532b510639fe275c7e948f274797e99f4eb314e06a3af98502713e40e57e23756959137f51a0c7b4252caf1e26eaa8f8d6dd738ee02caf6e44a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
![example workflow](https://github.com/troptropcontent/parking_ticket/actions/workflows/main.yml/badge.svg)
|
1
2
|
# ParkingTicket
|
2
3
|
|
3
4
|
This gem is a wrapper around the majors residential parking tickets api (for now only PayByPhone is supported).
|
@@ -22,22 +23,45 @@ Or install it yourself as:
|
|
22
23
|
|
23
24
|
To make the gem work above your parking account you need set some environment variables :
|
24
25
|
|
25
|
-
|
26
|
-
- `PAYBYPHONE_PASSWORD` : your PayByPhone password
|
27
|
-
- `PAYBYPHONE_USERNAME` : your PayByPhone username (usually your phone number)
|
28
|
-
- `PAYBYPHONE_LICENSEPLATE` : tyhe license plate of the car that must be covered
|
29
|
-
- `PAYBYPHONE_ZIPCODE` : the zipcode you're resident in
|
30
|
-
- `PAYBYPHONE_CARDNUMBER` : the credit card used to pay parking tickets (must be formated as folow xxxxxx------xxxx)
|
26
|
+
This give you access to a bunch of classes but the most important one is the ParkingTicket::Base.
|
31
27
|
|
32
|
-
|
28
|
+
This class can be instanciated as follow :
|
33
29
|
|
34
|
-
|
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 :
|
35
44
|
|
36
|
-
|
37
|
-
|
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
|
+
```
|
38
62
|
|
39
|
-
|
40
|
-
|
63
|
+
- #renew
|
64
|
+
This will trigger the renewal of your ticket, works only if no current_ticket is found
|
41
65
|
|
42
66
|
Then you can create a scrypt like this one :
|
43
67
|
|
@@ -45,7 +69,16 @@ Then you can create a scrypt like this one :
|
|
45
69
|
#your_scrypt.rb
|
46
70
|
require 'parking_ticket'
|
47
71
|
|
48
|
-
ticket_client = ParkingTicket.new
|
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
|
+
)
|
49
82
|
|
50
83
|
unless ticket_client.current_ticket
|
51
84
|
ticket_client.renew
|
@@ -53,7 +86,7 @@ end
|
|
53
86
|
|
54
87
|
```
|
55
88
|
|
56
|
-
And play as often as you want to ensure that you always have a ticket for your car.
|
89
|
+
And play it as often as you want to ensure that you always have a ticket for your car.
|
57
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.)
|
58
91
|
|
59
92
|
Exemple of application : [parkautomat](https://github.com/troptropcontent/parkautomat)
|
@@ -11,7 +11,7 @@ module ParkingTicket
|
|
11
11
|
connection.get("/parking/accounts/#{account_id}/sessions?periodType=Current").body
|
12
12
|
end
|
13
13
|
|
14
|
-
def new_ticket(
|
14
|
+
def new_ticket(account_id, parking_start_time, quote_id, payment_method_id)
|
15
15
|
connection.post(
|
16
16
|
"/parking/accounts/#{account_id}/sessions/",
|
17
17
|
{
|
Binary file
|
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.1
|
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-01-
|
11
|
+
date: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- lib/parking_ticket.rb
|
47
47
|
- lib/parking_ticket/configuration.rb
|
48
48
|
- lib/parking_ticket/version.rb
|
49
|
+
- parking_ticket-1.0.0.gem
|
49
50
|
homepage: https://github.com/troptropcontent/parking_ticket
|
50
51
|
licenses:
|
51
52
|
- MIT
|