parking_ticket 1.0.42 → 1.0.44

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: 6e77e38e86c6e6caa460258bbcaadc68d36cd9132bcfa1addac8076241d7ccb1
4
- data.tar.gz: 1dbf3192eff48e871d11cbddccbd671e123c8c04340511df1e69e89f76920d89
3
+ metadata.gz: 7f82a0816a5df051133eba4073549f58652fab997cdd3fb18c9f733327ddf93f
4
+ data.tar.gz: 124d3967a17675ae978a35715427e4178519f9ac33bd9f3816a14f4e6cb31f17
5
5
  SHA512:
6
- metadata.gz: 314a53f64ffcc2242859c3f1c3469d3511989b370aa4ca62f94f9769ab78433d6bbb889df6af732d86a8e39c5bc0c66d29f4d3ebb6354c3fe24e4c738fae50a0
7
- data.tar.gz: 3ab7e2363a945b4f791551dc7d195599949e750fabdd04ede23f19dcef631150f9c4f7f4061a6685720767ba1564c289823128b8e00d33f91552224beef061fe
6
+ metadata.gz: c88c4dea61fbdba1adf7861952d90c53c33d11246a0afba0ff247d9ad29b8ac6b4bccf270cd648f665b3bb89b32e7f8c63fe103d3c281577338eec5b75799915
7
+ data.tar.gz: 1fbc40e759abe15b93f9c5562cb7dc34b8cf98859e91ecfffd8567f23fa5510e6dfbd37facbf1b2e0ffbe68e32a3ee97d314a174764a8dfd830b64084601bffa
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parking_ticket (1.0.42)
4
+ parking_ticket (1.0.44)
5
5
  faraday
6
6
 
7
7
  GEM
@@ -43,12 +43,18 @@ module ParkingTicket
43
43
  fetch_and_map_quote(rate_option_id, zipcode, license_plate, quantity, time_unit)
44
44
  end
45
45
 
46
- def new_ticket(license_plate, zipcode, rate_option_id, quantity, time_unit, payment_method_id:)
46
+ def new_ticket(license_plate:, zipcode:, rate_option_client_internal_id:, quantity:, time_unit:, payment_method_id:)
47
47
  raise_invalid_credentials! unless valid_credentials?
48
- return if running_ticket(license_plate, zipcode)
48
+ # return if running_ticket(license_plate, zipcode)
49
49
 
50
- request_new_ticket(license_plate, zipcode, rate_option_id, quantity, time_unit,
51
- payment_method_id: payment_method_id)
50
+ request_new_ticket(
51
+ license_plate: license_plate,
52
+ zipcode: zipcode,
53
+ rate_option_client_internal_id: rate_option_client_internal_id,
54
+ quantity: quantity,
55
+ time_unit: time_unit,
56
+ payment_method_id: payment_method_id
57
+ )
52
58
  end
53
59
 
54
60
  private
@@ -54,16 +54,20 @@ module ParkingTicket
54
54
  end.first
55
55
  end
56
56
 
57
- def request_new_ticket(license_plate, zipcode, rate_option_id, quantity, time_unit, payment_method_id:)
57
+ def request_new_ticket(license_plate:, zipcode:, rate_option_client_internal_id:, quantity:, time_unit:, payment_method_id:)
58
58
  mapped_time_unit = ACCEPTED_TIME_UNIT_MAPPER.key(time_unit)
59
- quote = fetch_and_map_quote(rate_option_id, zipcode, license_plate, quantity, mapped_time_unit)
59
+
60
+ quote = fetch_and_map_quote(rate_option_client_internal_id, zipcode, license_plate, quantity,
61
+ time_unit)
62
+
60
63
  client.new_ticket(
61
- quote[:client_internal_id],
62
- zipcode,
63
- license_plate,
64
- quantity,
65
- mapped_time_unit,
66
- quote[:starts_on],
64
+ license_plate: license_plate,
65
+ zipcode: zipcode,
66
+ rate_option_client_internal_id: rate_option_client_internal_id,
67
+ quantity: quantity,
68
+ time_unit: mapped_time_unit,
69
+ quote_client_internal_id: quote[:client_internal_id],
70
+ starts_on: quote[:starts_on],
67
71
  payment_method_id: payment_method_id
68
72
  )
69
73
  end
@@ -58,18 +58,18 @@ module ParkingTicket
58
58
  ).body
59
59
  end
60
60
 
61
- def new_ticket(token, account_id, quote_id, zipcode, license_plate, quantity, time_unit, start_time, payment_method_id:)
61
+ def new_ticket(token, account_id, license_plate:, zipcode:, rate_option_client_internal_id:, quantity:, time_unit:, quote_client_internal_id:, starts_on:, payment_method_id:)
62
62
  base_data = {
63
63
  "expireTime": nil,
64
64
  "duration": {
65
- "quantity": quantity,
65
+ "quantity": quantity.to_s,
66
66
  "timeUnit": time_unit
67
67
  },
68
68
  "licensePlate": license_plate,
69
69
  "locationId": zipcode,
70
- "rateOptionId": '75101',
71
- "startTime": start_time,
72
- "quoteId": quote_id,
70
+ "rateOptionId": rate_option_client_internal_id,
71
+ "startTime": starts_on,
72
+ "quoteId": quote_client_internal_id,
73
73
  "parkingAccountId": account_id
74
74
  }
75
75
 
@@ -144,9 +144,16 @@ module ParkingTicket
144
144
  self.class.quote(token, account_id, rate_option_id, zipcode, license_plate, quantity, time_unit)
145
145
  end
146
146
 
147
- def new_ticket(quote_id, zipcode, license_plate, quantity, time_unit, start_time, payment_method_id:)
148
- self.class.new_ticket(token, account_id, quote_id, zipcode, license_plate, quantity,
149
- time_unit, start_time, payment_method_id)
147
+ def new_ticket(license_plate:, zipcode:, rate_option_client_internal_id:, quantity:, time_unit:, quote_client_internal_id:, starts_on:, payment_method_id:)
148
+ self.class.new_ticket(token, account_id,
149
+ license_plate: license_plate,
150
+ zipcode: zipcode,
151
+ rate_option_client_internal_id: rate_option_client_internal_id,
152
+ quantity: quantity,
153
+ time_unit: time_unit,
154
+ quote_client_internal_id: quote_client_internal_id,
155
+ starts_on: starts_on,
156
+ payment_method_id: payment_method_id)
150
157
  end
151
158
 
152
159
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ParkingTicket
4
- VERSION = '1.0.42'
4
+ VERSION = '1.0.44'
5
5
  end
@@ -66,8 +66,15 @@ module ParkingTicket
66
66
  adapter.payment_methods
67
67
  end
68
68
 
69
- def new_ticket(license_plate, zipcode, rate_option_id, quantity, time_unit, payment_method_id)
70
- adapter.new_ticket(license_plate, zipcode, rate_option_id, quantity, time_unit, payment_method_id)
69
+ def new_ticket(license_plate:, zipcode:, rate_option_client_internal_id:, quantity:, time_unit:, payment_method_id:)
70
+ adapter.new_ticket(
71
+ license_plate: license_plate,
72
+ zipcode: zipcode,
73
+ rate_option_client_internal_id: rate_option_client_internal_id,
74
+ quantity: 1,
75
+ time_unit: time_unit,
76
+ payment_method_id: payment_method_id
77
+ )
71
78
  end
72
79
 
73
80
  def quote(rate_option_id, zipcode, license_plate, quantity, time_unit)
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.42
4
+ version: 1.0.44
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-02-22 00:00:00.000000000 Z
11
+ date: 2023-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday