parking_ticket 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: b2316d548e3f47bee94290a6e0b4399150d1db6948217c4a0434cae0b3ab5ebd
4
- data.tar.gz: 31cbaee19c0e458085ef5ab1c142d2fe5f24a82ff152e9e797c1a8e4ddd03782
3
+ metadata.gz: 46eea131e0a69fa49115d452afc9ee575b52a06084eb8a026bf115b33b2d46f6
4
+ data.tar.gz: 735ffb052fecb3599af5bf71ec7a28c60e48e8ed2025e8cb7923e7f6bb570851
5
5
  SHA512:
6
- metadata.gz: e5c572a25ce7df3ab41f449dbaf1999df4efde403ccad560c87bf284ceb1e08ae3c072a4950a06244ffe94086b147fb0fb56d779a16315cdae05a34e5f39450f
7
- data.tar.gz: a1e55ec8f66f0909c49bd53d5cc89ceb243cd6f72d6070befe77f9f57c8b10d4650a396a5f7054cdec7959400e0cb2dd64f42415300bf168f74ebed8715d6e2a
6
+ metadata.gz: 21652de95a323f337d244d5c652a826b5cda0de762c4d3e4f7be31bcf9b62a2e5e7d14eaf7744b48ac9c7aae1de0c03984e1fe3be76cf4cd34b9a4012e785857
7
+ data.tar.gz: bfdc6306def10532b510639fe275c7e948f274797e99f4eb314e06a3af98502713e40e57e23756959137f51a0c7b4252caf1e26eaa8f8d6dd738ee02caf6e44a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parking_ticket (1.0.0)
4
+ parking_ticket (1.0.1)
5
5
  faraday
6
6
 
7
7
  GEM
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
- #PayByPhone :
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
- #Other apis to come
28
+ This class can be instanciated as follow :
33
29
 
34
- Two methods comes with the gem :
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
- #`ParkingTicket.current_ticket`
37
- => returns an object representing a currently running residential ticket for your car. It returns nil if no ticket are found.
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
- #`ParkingTicket.renew`
40
- => register a new residential ticket for your car, this won't work if current_ticket returns something.
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(_account_id, _parking_start_time, _quote_id, _payment_method_id)
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
  {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ParkingTicket
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
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.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-13 00:00:00.000000000 Z
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