vng 2.1.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09b4cd00ba4b70329bb9824f7ebcf41d3d97f02e2bc9677a19dd383d3c0de4c3'
4
- data.tar.gz: 0f2624b2c49242c74810bc7149f29bc95d2f1fdf314222f4e357f119b1e7926c
3
+ metadata.gz: 240226a07b22399db9b611a1651c0ca709b931620ac224e7ac01e2e289e4cd97
4
+ data.tar.gz: f10775485ccc1b6cdc9a9873a5a9296b4ac4fb2796f4d1a2afadb7eec1165264
5
5
  SHA512:
6
- metadata.gz: 38071da71b58c98fe424be4269fc0d101e49c6b388aa1cff971dd5ea1e693abc968f3bc294ef723043a9a35478cd7de150017bc49a3eb339c94ed7275e2cb692
7
- data.tar.gz: 01e5b806637ebcf5b4dfe9b40bffcdb1fc3e9f944732cb99be9ccf0dc0ddbdcdee910020a704d119956168fa87f867ed795cab960b44863b105dec8030a1f0d8
6
+ metadata.gz: a61c7417e857912b88ef45a013e0567a1f3fdbf6c43b2a2a3cb8d8c390dc2830c590da0c0af7d5b6915a2fd702ce84f30876c042a7571d68ef4b68b11c6313fd
7
+ data.tar.gz: 31369f5292794ec854e41dc6a40537e9f5a25d3ba4d4e74c1ec02494bf97920a6a9ca82e8c022c0f841d1953fd57a89e2eb3248554f1c156957ac3c8c8219eeb
data/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
- ## [2.1.0] - 2024-12-8
1
+ ## [2.2.1] - 2025-01-02
2
+
3
+ - Always return an array for .all methods
4
+ - Discard ZIP codes 'Owned - Not In Service'
5
+
6
+ ## [2.2.0] - 2025-01-02
7
+
8
+ - Adds Franchise#cell and Franchise#phone
9
+
10
+ ## [2.1.0] - 2024-12-28
2
11
 
3
12
  - Adds Availability.where(zip:)
4
13
 
@@ -8,7 +17,7 @@
8
17
 
9
18
  ## [2.0.0] - 2024-12-26
10
19
 
11
- ** Breaking changes**
20
+ **Breaking changes**
12
21
 
13
22
  - Remove ServiceType.all and ServiceType.where(zip:)
14
23
 
@@ -28,7 +28,7 @@ module Vng
28
28
 
29
29
  data = request path: PATH, body: body
30
30
 
31
- data['Availability'].map do |availability|
31
+ data.fetch('Availability', []).map do |availability|
32
32
  route_id = availability['routeID'].to_i
33
33
  date = Date.strptime availability['dayID'], '%Y%m%d'
34
34
  minutes = availability['startTime'].to_i
data/lib/vng/breed.rb CHANGED
@@ -19,7 +19,7 @@ module Vng
19
19
  def self.all
20
20
  data = request path: PATH
21
21
 
22
- data['Breeds'].map do |breed|
22
+ data.fetch('Breeds', []).map do |breed|
23
23
  id = breed['breedID']
24
24
  name = breed['breed']
25
25
  species = breed['species']
data/lib/vng/franchise.rb CHANGED
@@ -5,13 +5,15 @@ module Vng
5
5
  class Franchise < Resource
6
6
  PATH = '/api/v1/resources/franchises/'
7
7
 
8
- attr_reader :id, :name, :gmt_offset, :email
8
+ attr_reader :id, :name, :gmt_offset, :email, :phone, :cell
9
9
 
10
- def initialize(id:, name: nil, gmt_offset: nil, email: nil)
10
+ def initialize(id:, name: nil, gmt_offset: nil, email: nil, phone: nil, cell: nil)
11
11
  @id = id
12
12
  @name = name
13
13
  @gmt_offset = gmt_offset
14
14
  @email = email
15
+ @phone = phone
16
+ @cell = cell
15
17
  end
16
18
 
17
19
 
@@ -34,14 +36,17 @@ module Vng
34
36
  }
35
37
 
36
38
  data = request path: PATH, body: body
39
+
37
40
  email = value_for_field data, 9
38
- new id: franchise_id, email: email
41
+ phone = value_for_field data, 18
42
+ cell = value_for_field data, 1001
43
+ new id: franchise_id, email: email, phone: phone, cell: cell
39
44
  end
40
45
 
41
46
  def self.all
42
47
  data = request path: PATH
43
48
 
44
- data['Franchises'].filter do |franchise|
49
+ data.fetch('Franchises', []).filter do |franchise|
45
50
  franchise['isActive']
46
51
  end.map do |franchise|
47
52
  id = franchise['franchiseID']
@@ -54,12 +54,18 @@ module Vng
54
54
  { "Zip"=>{"zipCodeID"=>"1", "zipCode"=>"21765", "zoneName"=>"Brentwood", "defaultCity"=>"Los Angeles", "provinceAbbr"=>"CA", "franchiseID"=>"105"},
55
55
  "ServiceTypes"=>[{"serviceTypeID"=>14, "serviceType"=>"Pet Grooming", "duration" => 45}]}
56
56
  else
57
- { "Zips"=>[{ "zip"=>"21765", "zoneName"=>"Brentwood", "state"=>"MD" }] }
57
+ { "Zips"=>[
58
+ { "zip"=>"21763", "zoneName"=>"Brentwood", "state"=>"MD", "zipStatus"=>"Owned - Not In Service" },
59
+ { "zip"=>"21764", "zoneName"=>"Brentwood", "state"=>"MD", "zipStatus"=>"Owned – Deactivated" },
60
+ { "zip"=>"21765", "zoneName"=>"Brentwood", "state"=>"MD", "zipStatus"=>"Owned - Currently Serviced" },
61
+ ] }
58
62
  end
59
63
  when '/api/v1/resources/franchises/'
60
64
  if @body.key?(:objectID)
61
65
  { "Franchise"=>{ "objectID"=>"2201007" }, "Fields"=>[
62
66
  { "fieldID"=>9, "fieldValue"=>"vng@example.com" },
67
+ { "fieldID"=>18, "fieldValue"=>"3103103100", "optionID"=>0 },
68
+ { "fieldID"=>1001, "fieldValue"=>"3103103100", "optionID"=>0 },
63
69
  ] }
64
70
  else
65
71
  { "Franchises"=>[
@@ -15,7 +15,7 @@ module Vng
15
15
  def self.all
16
16
  data = request path: PATH
17
17
 
18
- data['PriceLists'].filter_map do |price_list|
18
+ data.fetch('PriceLists', []).filter_map do |price_list|
19
19
  next unless price_list['isActive']
20
20
  next unless price_list['serviceTypeID'].eql?(14)
21
21
 
data/lib/vng/route.rb CHANGED
@@ -15,7 +15,7 @@ module Vng
15
15
  def self.all
16
16
  data = request path: PATH
17
17
 
18
- data['Routes'].filter do |route|
18
+ data.fetch('Routes', []).filter do |route|
19
19
  route['isActive']
20
20
  end.map do |body|
21
21
  id = body['routeID']
data/lib/vng/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vng
2
- VERSION = '2.1.0'
2
+ VERSION = '2.2.1'
3
3
  end
data/lib/vng/zip.rb CHANGED
@@ -19,9 +19,8 @@ module Vng
19
19
  def self.all
20
20
  data = request path: PATH
21
21
 
22
- data['Zips'].reject do |franchise|
23
- # TODO: add "Owned - Not In Service"
24
- franchise['zipStatus'].eql? 'Owned – Deactivated'
22
+ data.fetch('Zips', []).reject do |franchise|
23
+ ['Owned Deactivated', 'Owned - Not In Service'].include? franchise['zipStatus']
25
24
  end.map do |body|
26
25
  zip = body['zip']
27
26
  state = body['state']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vng
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-29 00:00:00.000000000 Z
11
+ date: 2025-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov