vng 1.7.0 → 2.0.0

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: ec68041442659731246003b523c47c70f41ac3127190c3f966a0c774274f9a2e
4
- data.tar.gz: b34853bfd235358cb485ff8fbe84a090dd4104e01f6f01065d6269b20f7f9fbe
3
+ metadata.gz: 2ba9ded97747e245e2102d52fc515f78a6b836b5e5a19709c40413d6c135f62b
4
+ data.tar.gz: 356ecdbc427ba9f6d1977972bafa3b81a4afa3122bc66ed11bbc9d69cfa1e6f9
5
5
  SHA512:
6
- metadata.gz: b2c9cb81c4ec152b7e98800ee01ba68b05617e5b5f85d6dee04607e9c3347faa402f0d3e8109d9579e3683bd7e8d234c5c209ef3e67e8e7d6dd8277e08930dd7
7
- data.tar.gz: 91abf7c0f28cd38e7cd9151797eb3312ea6046db8c07af63ba53861b00cf6603f0b2e17c5a585bba9b75623fe2a58aa17c89df739437ee8de027893a25836d32
6
+ metadata.gz: 1547625c3428ba7727be689119387e1c29b3a931037a01ac6cd03e8df0a9f80a21bf5486d17d23bb5428b902b4d7620696f997fad59e53ec101a8f62c8441f6f
7
+ data.tar.gz: 0646cbea6e388d76db71cf24505862ec92d808901e1c465b3c2796383c24ba93c1bdea676bcab98968e79b79004030133cce0e2c9f533346371ce1b930df595b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [2.0.0] - 2024-12-26
2
+
3
+ ** Breaking changes**
4
+
5
+ - Remove ServiceType.all and ServiceType.where(zip:)
6
+
1
7
  ## [1.7.0] - 2024-12-26
2
8
 
3
9
  - Adds PriceItem.for_price_list_id
@@ -5,42 +5,13 @@ module Vng
5
5
  class ServiceType < Resource
6
6
  PATH = '/api/v1/resources/serviceTypes/'
7
7
 
8
- attr_reader :id, :type, :duration
8
+ attr_reader :id, :type, :duration, :price_list_id
9
9
 
10
- def initialize(id:, type:, duration:)
10
+ def initialize(id:, type:, duration:, price_list_id:)
11
11
  @id = id
12
12
  @type = type
13
13
  @duration = duration
14
- end
15
-
16
- def self.all
17
- data = request path: PATH
18
-
19
- data['ServiceTypes'].map do |body|
20
- id = body['serviceTypeID']
21
- type = body['serviceType']
22
- duration = body['duration']
23
-
24
- new id: id, type: type, duration: duration
25
- end
26
- end
27
-
28
- def self.where(zip:)
29
- body = {
30
- zip: zip,
31
- }
32
-
33
- data = request path: PATH, body: body
34
-
35
- data.fetch('ServiceTypes', []).filter do |body|
36
- body['isActive']
37
- end.map do |body|
38
- id = body['serviceTypeID']
39
- type = body['serviceType']
40
- duration = body['duration']
41
-
42
- new id: id, type: type, duration: duration
43
- end
14
+ @price_list_id = price_list_id
44
15
  end
45
16
  end
46
17
  end
data/lib/vng/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vng
2
- VERSION = '1.7.0'
2
+ VERSION = '2.0.0'
3
3
  end
data/lib/vng/zip.rb CHANGED
@@ -20,6 +20,7 @@ module Vng
20
20
  data = request path: PATH
21
21
 
22
22
  data['Zips'].reject do |franchise|
23
+ # TODO: add "Owned - Not In Service"
23
24
  franchise['zipStatus'].eql? 'Owned – Deactivated'
24
25
  end.map do |body|
25
26
  zip = body['zip']
@@ -39,12 +40,15 @@ module Vng
39
40
  data = request path: PATH, body: body
40
41
  zip_data = data['Zip']
41
42
 
43
+ # TODO: Remove ServiceType class, store duration and price_list_id
44
+ # inside Zip itself
42
45
  unless zip_data['zipCodeID'] == '0'
43
46
  service_types = data['ServiceTypes'].map do |body|
44
47
  id = body['serviceTypeID']
45
48
  type = body['serviceType']
46
49
  duration = body['duration']
47
- ServiceType.new id: id, type: type, duration: duration
50
+ price_list_id = body['priceID']
51
+ ServiceType.new id: id, type: type, duration: duration, price_list_id: price_list_id
48
52
  end
49
53
 
50
54
  new zip: zip_data['zipCode'], state: zip_data['provinceAbbr'], zone_name: zip_data['zoneName'], city: zip_data['defaultCity'], service_types: service_types
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vng
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob