vng 3.3.0 → 3.3.2

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: d0040674685e7d8090bd5872e705ce17dd4fae6c16a4390522039719da756c39
4
- data.tar.gz: e78eeca80c62145b6e2c9f737b78b1cf971c6597d21fbce910a3981bb89a90c7
3
+ metadata.gz: 3c0af9c8607d71fa3aa223f74a1a89961370b23bd9281e823edcf15c76144b06
4
+ data.tar.gz: ff11b94c1ddb0b616ebc2750af6d18bdc8a76ed6b1781c48b93a4c487c1bbe3f
5
5
  SHA512:
6
- metadata.gz: 1235ebc7d60b12babbfe060ead7aa92905423d87939b48de7996567317ff4c3dbd16b218e803de22522a963fe52e1e22a186f99fe997998001ffb6b8dd778dce
7
- data.tar.gz: cf02b625c67a97bb01e670ff08f8026a7395531825db98bd958466d95a8736f23c16aa8cf7cd61122e3326e5d1a647a467484cf7a8925b37a11b8dbc43af45ab
6
+ metadata.gz: 684bb3e62c20b3c4c89a2bbf26c2ab52c17a4ea8345838ecdc566e75d0b645d389e2f7559a8c3288dcfdc17332103f2dd4a3f42e0bf730ace0d42a5c3c565853
7
+ data.tar.gz: d983ecf12bcd1e98baa4e720ee2b9963fa71197503e2d9db52a856bf1ec80947c022ef296d63a8b6daaa5dfd88ad8c58a9ec4288f243bc7e3cc1cd008ecbc7c6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [3.3.2] - 2025-01-22
2
+
3
+ - Don't assume isActive is returned as a boolean
4
+
5
+ ## [3.3.1] - 2025-01-22
6
+
7
+ - Add Route#type_id
8
+
1
9
  ## [3.3.0] - 2025-01-15
2
10
 
3
11
  - Add SystemObject.find_by(name:)
data/README.md CHANGED
@@ -19,6 +19,8 @@ Vng::ServiceType.where zip:
19
19
  Vng::SecurityToken.create host:, usename:, password:
20
20
  Vng::Lead.create email:, phone:, name: full_name
21
21
  Vng::Contact.create first_name:, last_name:, email:, phone:, client_id:
22
+ Vng::Contact.edited_since timestamp
23
+ Vng::Client.find contact_id
22
24
  Vng::Location.create address:, city:, zip:, state: state, client_id:
23
25
  Vng::Breed.all
24
26
  Vng::Asset.create name:, weight:, breed_option_id:, client_id:
data/lib/vng/contact.rb CHANGED
@@ -21,7 +21,7 @@ module Vng
21
21
  end
22
22
 
23
23
  def active?
24
- @data['isActive'] != 'false'
24
+ self.class.active? @data
25
25
  end
26
26
 
27
27
  def first_name
data/lib/vng/franchise.rb CHANGED
@@ -46,9 +46,9 @@ module Vng
46
46
  def self.all
47
47
  data = request path: PATH
48
48
 
49
- data.fetch('Franchises', []).filter do |franchise|
50
- franchise['isActive']
51
- end.map do |franchise|
49
+ data.fetch('Franchises', []).filter_map do |franchise|
50
+ next unless active?(franchise)
51
+
52
52
  id = franchise['franchiseID']
53
53
  name = franchise['franchiseName']
54
54
  gmt_offset = franchise['gmtOffsetFranchise']
@@ -54,7 +54,7 @@ module Vng
54
54
  { "fieldID" => 830, "field" => "Primary Contact" },
55
55
  ], "Options" => [
56
56
  {"optionID" => 15840, "name" => "Referral", "fieldID" => 795, "objectTypeID" => 28, "isActive" => false},
57
- {"optionID" => 15841, "name" => "Website", "fieldID" => 795, "objectTypeID" => 28, "isActive" => true},
57
+ {"optionID" => 15841, "name" => "Website", "fieldID" => 795, "objectTypeID" => 28, "isActive" => 'true'},
58
58
  ] }
59
59
  else
60
60
  { "Objects"=>[
@@ -84,8 +84,8 @@ module Vng
84
84
  ] }
85
85
  else
86
86
  { "Franchises"=>[
87
- { "franchiseID"=>106, "franchiseName"=>"Mississauga", "gmtOffsetFranchise"=>-300, "isActive"=>false },
88
- { "franchiseID"=>107, "franchiseName"=>"Boise", "gmtOffsetFranchise"=>-420, "isActive"=>true },
87
+ { "franchiseID"=>106, "franchiseName"=>"Mississauga", "gmtOffsetFranchise"=>-300, "isActive" => 'false' },
88
+ { "franchiseID"=>107, "franchiseName"=>"Boise", "gmtOffsetFranchise"=>-420, "isActive" => true },
89
89
  ] }
90
90
  end
91
91
  when '/api/v1/resources/availability/'
@@ -139,7 +139,7 @@ module Vng
139
139
  when '/api/v1/data/Contacts/'
140
140
  if @body[:pageNo].eql? 1
141
141
  {"Contacts" => [
142
- {"objectID" => "2201007", "dateLastEdited" => "1736479080", "isActive" => "true", "Fields" => [
142
+ {"objectID" => "2201007", "dateLastEdited" => "1736479080", "isActive" => true, "Fields" => [
143
143
  {"fieldID"=>127, "fieldValue"=>"Vng" },
144
144
  {"fieldID"=>128, "fieldValue"=>"Example" },
145
145
  {"fieldID"=>97, "fieldValue"=>"vng@example.com" },
@@ -152,7 +152,7 @@ module Vng
152
152
  {"fieldID"=>128, "fieldValue"=>"Email" },
153
153
  {"fieldID"=>96, "fieldValue"=>"8648648640" },
154
154
  ], "Relations" => [
155
- {"objectID" => 916758, "relationType" => "client", "isActive" => "true"},
155
+ {"objectID" => 916758, "relationType" => "client", "isActive" => true},
156
156
  ]},
157
157
  ]}
158
158
  elsif @body[:pageNo].nil?
@@ -184,37 +184,37 @@ module Vng
184
184
  when '/api/v1/resources/priceBlocks/'
185
185
  if @body[:pageNo].eql? 1
186
186
  { "PriceBlocks" => [
187
- {"priceBlockID"=>329, "priceListID"=>455, "priceBlock"=>"Affenpinscher", "sequence"=>1, "isActive"=>true},
188
- {"priceBlockID"=>331, "priceListID"=>455, "priceBlock"=>"Afghan", "sequence"=>2, "isActive"=>false},
189
- {"priceBlockID"=>332, "priceListID"=>455, "priceBlock"=>"Airedale Terrier", "sequence"=>3, "isActive"=>true},
190
- {"priceBlockID"=>333, "priceListID"=>455, "priceBlock"=>"Persian", "sequence"=>4, "isActive"=>true},
187
+ {"priceBlockID"=>329, "priceListID"=>455, "priceBlock"=>"Affenpinscher", "sequence"=>1, "isActive" => 'true'},
188
+ {"priceBlockID"=>331, "priceListID"=>455, "priceBlock"=>"Afghan", "sequence"=>2, "isActive" => false},
189
+ {"priceBlockID"=>332, "priceListID"=>455, "priceBlock"=>"Airedale Terrier", "sequence"=>3, "isActive" => true},
190
+ {"priceBlockID"=>333, "priceListID"=>455, "priceBlock"=>"Persian", "sequence"=>4, "isActive" => true},
191
191
  ]}
192
192
  else
193
193
  { }
194
194
  end
195
195
  when '/api/v1/resources/priceLists/'
196
196
  { "PriceLists" => [
197
- { "priceListID" => 145, "priceList": "Pet Grooming Default", "serviceTypeID" => 14, "isActive" => true },
197
+ { "priceListID" => 145, "priceList": "Pet Grooming Default", "serviceTypeID" => 14, "isActive" => 'true' },
198
198
  { "priceListID" => 146, "priceList": "Pet Grooming Special", "serviceTypeID" => 14, "isActive" => true },
199
199
  { "priceListID" => 147, "priceList": "Pet Grooming Old", "serviceTypeID" => 14, "isActive" => false },
200
200
  ]}
201
201
  when '/api/v1/resources/priceItems/'
202
202
  if @body[:pageNo].eql? 1
203
203
  { "PriceItems"=>[
204
- { "priceItemID"=>275111, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>1, "priceItem"=>"Bulldog American - 15 Step SPA Grooming Service", "value"=>85.0, "taxID"=>256, "durationPerUnit"=>45.0, "serviceBadge"=>"Required", "serviceCategory"=>"15 Step Spa", "isOnline"=>true, "isActive"=>true },
205
- { "priceItemID"=>275112, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>2, "priceItem"=>"Bulldog American - 15 Step SPA Super Grooming Service", "value"=>105.0, "taxID"=>256, "durationPerUnit"=>75.0, "serviceBadge"=>nil, "serviceCategory"=>"15 Step Spa", "isOnline"=>false, "isActive"=>true },
204
+ { "priceItemID"=>275111, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>1, "priceItem"=>"Bulldog American - 15 Step SPA Grooming Service", "value"=>85.0, "taxID"=>256, "durationPerUnit"=>45.0, "serviceBadge"=>"Required", "serviceCategory"=>"15 Step Spa", "isOnline"=>true, "isActive" => 'true' },
205
+ { "priceItemID"=>275112, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>2, "priceItem"=>"Bulldog American - 15 Step SPA Super Grooming Service", "value"=>105.0, "taxID"=>256, "durationPerUnit"=>75.0, "serviceBadge"=>nil, "serviceCategory"=>"15 Step Spa", "isOnline"=>false, "isActive" => true },
206
206
 
207
- { "priceItemID"=>275300, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>3, "priceItem"=>"Bulldog American - Shave Down", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Not Recommended", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
208
- { "priceItemID"=>275301, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>4, "priceItem"=>"Bulldog American - Puppy Cut", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Recommended", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
207
+ { "priceItemID"=>275300, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>3, "priceItem"=>"Bulldog American - Shave Down", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Not Recommended", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive" => 'true' },
208
+ { "priceItemID"=>275301, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>4, "priceItem"=>"Bulldog American - Puppy Cut", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Recommended", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive" => true },
209
209
 
210
- { "priceItemID"=>275302, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>5, "priceItem"=>"De-Shedding Treatment inactive", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>false },
211
- { "priceItemID"=>275303, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>6, "priceItem"=>"De-Shedding Treatment 0-30 lbs", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>true },
212
- { "priceItemID"=>275304, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>7, "priceItem"=>"De-Shedding Treatment 60 - 100 lbs", "value"=>30.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>true },
213
- { "priceItemID"=>275305, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>8, "priceItem"=>"De-shedding Treatment - 101 lbs and over", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>20.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>true },
210
+ { "priceItemID"=>275302, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>5, "priceItem"=>"De-Shedding Treatment inactive", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive" => 'false' },
211
+ { "priceItemID"=>275303, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>6, "priceItem"=>"De-Shedding Treatment 0-30 lbs", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive" => 'true' },
212
+ { "priceItemID"=>275304, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>7, "priceItem"=>"De-Shedding Treatment 60 - 100 lbs", "value"=>30.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive" => true },
213
+ { "priceItemID"=>275305, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>8, "priceItem"=>"De-shedding Treatment - 101 lbs and over", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>20.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive" => true },
214
214
 
215
- { "priceItemID"=>275306, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>9, "priceItem"=>"Hot Aloe SPA Re- Moisturizing Treatment 0-30 lbs", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>20.0, "serviceBadge"=>nil, "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
216
- { "priceItemID"=>275307, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>10, "priceItem"=>"Aches & Pains Package", "value"=>0.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
217
- { "priceItemID"=>275308, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>11, "priceItem"=>"Old Add On", "value"=>0.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Not Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
215
+ { "priceItemID"=>275306, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>9, "priceItem"=>"Hot Aloe SPA Re- Moisturizing Treatment 0-30 lbs", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>20.0, "serviceBadge"=>nil, "serviceCategory"=>"Add Ons", "isOnline" => 'true', "isActive" => true },
216
+ { "priceItemID"=>275307, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>10, "priceItem"=>"Aches & Pains Package", "value"=>0.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Add Ons", "isOnline" => true, "isActive" => 'true' },
217
+ { "priceItemID"=>275308, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>11, "priceItem"=>"Old Add On", "value"=>0.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Not Offered", "serviceCategory"=>"Add Ons", "isOnline" => true, "isActive" => true },
218
218
  ] }
219
219
  else
220
220
  { }
@@ -222,27 +222,27 @@ module Vng
222
222
  when '/api/v1/data/priceLists/'
223
223
  if @body[:assetID].eql?(2201008)
224
224
  { "PriceItems"=>[
225
- { "priceItemID"=>275111, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>1, "priceItem"=>"Bulldog American - 15 Step SPA Grooming Service", "value"=>85.0, "taxID"=>256, "durationPerUnit"=>45.0, "serviceBadge"=>"Required", "serviceCategory"=>"15 Step Spa", "isOnline"=>true, "isActive"=>true },
226
- { "priceItemID"=>275112, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>2, "priceItem"=>"Bulldog American - 15 Step SPA Super Grooming Service", "value"=>105.0, "taxID"=>256, "durationPerUnit"=>75.0, "serviceBadge"=>nil, "serviceCategory"=>"15 Step Spa", "isOnline"=>false, "isActive"=>true },
225
+ { "priceItemID"=>275111, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>1, "priceItem"=>"Bulldog American - 15 Step SPA Grooming Service", "value"=>85.0, "taxID"=>256, "durationPerUnit"=>45.0, "serviceBadge"=>"Required", "serviceCategory"=>"15 Step Spa", "isOnline" => 'true', "isActive" => true },
226
+ { "priceItemID"=>275112, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>2, "priceItem"=>"Bulldog American - 15 Step SPA Super Grooming Service", "value"=>105.0, "taxID"=>256, "durationPerUnit"=>75.0, "serviceBadge"=>nil, "serviceCategory"=>"15 Step Spa", "isOnline" => false, "isActive" => 'true' },
227
227
 
228
- { "priceItemID"=>275300, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>3, "priceItem"=>"Bulldog American - Shave Down", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Not Recommended", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
229
- { "priceItemID"=>275301, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>4, "priceItem"=>"Bulldog American - Puppy Cut", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Recommended", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
228
+ { "priceItemID"=>275300, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>3, "priceItem"=>"Bulldog American - Shave Down", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Not Recommended", "serviceCategory"=>"Cut", "isOnline" => true, "isActive" => true },
229
+ { "priceItemID"=>275301, "priceBlockID"=>329, "descriptionHelp"=>"A price item", "sequence"=>4, "priceItem"=>"Bulldog American - Puppy Cut", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Recommended", "serviceCategory"=>"Cut", "isOnline" => true, "isActive" => 'true' },
230
230
 
231
231
  { "priceItemID"=>275302, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>5, "priceItem"=>"De-Shedding Treatment inactive", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>false },
232
232
  { "priceItemID"=>275303, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>6, "priceItem"=>"De-Shedding Treatment 0-30 lbs", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>true },
233
233
  { "priceItemID"=>275304, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>7, "priceItem"=>"De-Shedding Treatment 60 - 100 lbs", "value"=>30.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>true },
234
234
  { "priceItemID"=>275305, "priceBlockID"=>331, "descriptionHelp"=>"A price item", "sequence"=>8, "priceItem"=>"De-shedding Treatment - 101 lbs and over", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>20.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>true },
235
235
 
236
- { "priceItemID"=>275306, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>9, "priceItem"=>"Hot Aloe SPA Re- Moisturizing Treatment 0-30 lbs", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>20.0, "serviceBadge"=>nil, "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
236
+ { "priceItemID"=>275306, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>9, "priceItem"=>"Hot Aloe SPA Re- Moisturizing Treatment 0-30 lbs", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>20.0, "serviceBadge"=>nil, "serviceCategory"=>"Add Ons", "isOnline"=>'true', "isActive"=>true },
237
237
  { "priceItemID"=>275307, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>10, "priceItem"=>"Aches & Pains Package", "value"=>0.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
238
238
  { "priceItemID"=>275308, "priceBlockID"=>332, "descriptionHelp"=>"A price item", "sequence"=>11, "priceItem"=>"Old Add On", "value"=>0.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Not Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
239
239
  ] }
240
240
  elsif @body[:assetID].eql? 2201009
241
241
  { "PriceItems"=>[
242
- { "priceItemID"=>276111, "priceBlockID"=>333, "descriptionHelp"=>"A price item", "sequence"=>21, "priceItem"=>"Cat Short Hair - 15 Step SPA Grooming Service", "value"=>65.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Recommended", "serviceCategory"=>"15 Step Spa", "isOnline"=>true, "isActive"=>true },
242
+ { "priceItemID"=>276111, "priceBlockID"=>333, "descriptionHelp"=>"A price item", "sequence"=>21, "priceItem"=>"Cat Short Hair - 15 Step SPA Grooming Service", "value"=>65.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Recommended", "serviceCategory"=>"15 Step Spa", "isOnline"=>true, "isActive"=>'true' },
243
243
 
244
244
  { "priceItemID"=>276111, "priceBlockID"=>333, "descriptionHelp"=>"A price item", "sequence"=>22, "priceItem"=>"Cat Short Hair - Lion Cut", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
245
- { "priceItemID"=>276111, "priceBlockID"=>333, "descriptionHelp"=>"A price item", "sequence"=>23, "priceItem"=>"Cat Short Hair - Shave Down", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
245
+ { "priceItemID"=>276111, "priceBlockID"=>333, "descriptionHelp"=>"A price item", "sequence"=>23, "priceItem"=>"Cat Short Hair - Shave Down", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Cut", "isOnline"=>'true', "isActive"=>true },
246
246
 
247
247
  { "priceItemID"=>276111, "priceBlockID"=>333, "descriptionHelp"=>"A price item", "sequence"=>24, "priceItem"=>"De-Matting - Light", "value"=>15.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
248
248
  { "priceItemID"=>276111, "priceBlockID"=>333, "descriptionHelp"=>"A price item", "sequence"=>25, "priceItem"=>"De-Matting - Moderate", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
@@ -251,19 +251,19 @@ module Vng
251
251
  when '/api/v1/resources/serviceTypes/'
252
252
  if @body.key?(:zip)
253
253
  {"ServiceTypes" => [
254
- {"serviceTypeID" => 14, "serviceType" => "Pet Grooming (name)", "duration" => 45,"isActive" => true},
254
+ {"serviceTypeID" => 14, "serviceType" => "Pet Grooming (name)", "duration" => 45,"isActive" => 'true'},
255
255
  {"serviceTypeID" => 16, "serviceType" => "Pet Grooming (name)", "duration" => 45,"isActive" => false},
256
256
  ]}
257
257
  else
258
258
  { "ServiceTypes"=>[
259
- { "serviceTypeID"=>14, "serviceType"=>"Pet Grooming", "duration"=>90, "isActive"=>true },
259
+ { "serviceTypeID"=>14, "serviceType"=>"Pet Grooming", "duration"=>90, "isActive"=>'true' },
260
260
  ] }
261
261
  end
262
262
  when '/api/v1/resources/Routes/'
263
263
  {"Routes" => [
264
- {"routeID" => AVAILABLE_ROUTE_ID, "routeName" => "Route 1", "isActive" => true},
265
- {"routeID" => 2, "routeName" => "Route 2", "isActive" => true},
266
- {"routeID" => 3, "routeName" => "Route 3 (Inactive)", "isActive" => false},
264
+ {"routeID" => AVAILABLE_ROUTE_ID, "routeName" => "Route 1", "isActive" => 'true', "routeTypeID" => 106},
265
+ {"routeID" => 2, "routeName" => "Route 2", "isActive" => true, "routeTypeID" => 107},
266
+ {"routeID" => 3, "routeName" => "Route 3 (Inactive)", "isActive" => false, "routeTypeID" => 1},
267
267
  ]}
268
268
  when '/api/v1/data/WorkOrders/'
269
269
  if @body[:pageNo].eql? 1
@@ -20,7 +20,7 @@ module Vng
20
20
  data = request path: PATH, body: body, returning: 'PriceBlocks'
21
21
 
22
22
  data.filter_map do |body|
23
- next unless body['isActive']
23
+ next unless active?(body)
24
24
 
25
25
  id = body['priceBlockID']
26
26
  name = body['priceBlock']
@@ -29,7 +29,7 @@ module Vng
29
29
  data = request path: '/api/v1/resources/priceItems/', body: body, returning: 'PriceItems'
30
30
 
31
31
  data.filter_map do |body|
32
- next unless body['isOnline'] && body['isActive']
32
+ next unless online?(body) && active?(body)
33
33
 
34
34
  id = body['priceItemID']
35
35
  price_item = body['priceItem']
@@ -56,9 +56,9 @@ module Vng
56
56
 
57
57
  data = request path: PATH, body: body
58
58
 
59
- data['PriceItems'].filter do |body|
60
- body['isOnline'] && body['isActive']
61
- end.map do |body|
59
+ data['PriceItems'].filter_map do |body|
60
+ next unless online?(body) && active?(body)
61
+
62
62
  id = body['priceItemID']
63
63
  price_item = body['priceItem']
64
64
  index = body['sequence']
@@ -16,7 +16,7 @@ module Vng
16
16
  data = request path: PATH
17
17
 
18
18
  data.fetch('PriceLists', []).filter_map do |price_list|
19
- next unless price_list['isActive']
19
+ next unless active?(price_list)
20
20
  next unless price_list['serviceTypeID'].eql?(14)
21
21
 
22
22
  id = price_list['priceListID']
data/lib/vng/resource.rb CHANGED
@@ -42,11 +42,19 @@ module Vng
42
42
  def self.value_for_relation(data, relation_type)
43
43
  relation = data['Relations'].find do |relation|
44
44
  relation['relationType'] == relation_type &&
45
- relation['isActive'] == 'true'
45
+ active?(relation)
46
46
  end
47
47
  relation['objectID'] if relation
48
48
  end
49
49
 
50
+ def self.active?(item)
51
+ item['isActive'].to_s.eql? 'true'
52
+ end
53
+
54
+ def self.online?(item)
55
+ item['isOnline'].to_s.eql? 'true'
56
+ end
57
+
50
58
  # @return [String] the Vonigo API host.
51
59
  def self.host
52
60
  Vng.configuration.host
data/lib/vng/route.rb CHANGED
@@ -5,23 +5,25 @@ module Vng
5
5
  class Route < Resource
6
6
  PATH = '/api/v1/resources/Routes/'
7
7
 
8
- attr_reader :id, :name
8
+ attr_reader :id, :name, :type_id
9
9
 
10
- def initialize(id:, name:)
10
+ def initialize(id:, name:, type_id:)
11
11
  @id = id
12
12
  @name = name
13
+ @type_id = type_id
13
14
  end
14
15
 
15
16
  def self.all
16
17
  data = request path: PATH
17
18
 
18
- data.fetch('Routes', []).filter do |route|
19
- route['isActive']
20
- end.map do |body|
19
+ data.fetch('Routes', []).filter_map do |body|
20
+ next unless active?(body)
21
+
21
22
  id = body['routeID']
22
23
  name = body['routeName']
24
+ type_id = body['routeTypeID']
23
25
 
24
- new id: id, name: name
26
+ new id: id, name: name, type_id: type_id
25
27
  end
26
28
  end
27
29
  end
@@ -1,6 +1,6 @@
1
1
  module Vng
2
2
  # Provides methods to interact with Vonigo system fields’ options.
3
- class SystemOption
3
+ class SystemOption < Resource
4
4
  attr_reader :id, :name
5
5
 
6
6
  def initialize(id:, name:)
@@ -10,7 +10,7 @@ module Vng
10
10
 
11
11
  def self.for_system_field_id(system_field_id, options = {})
12
12
  options.lazy.filter_map do |option|
13
- next unless option['isActive']
13
+ next unless active?(option)
14
14
 
15
15
  if option['fieldID'].eql? system_field_id
16
16
  new id: option['optionID'], name: option['name']
data/lib/vng/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vng
2
- VERSION = '3.3.0'
2
+ VERSION = '3.3.2'
3
3
  end
@@ -45,7 +45,7 @@ module Vng
45
45
  data = request path: PATH, body: body, returning: 'WorkOrders'
46
46
 
47
47
  data.filter_map do |body|
48
- next unless body['isActive']
48
+ next unless active?(body)
49
49
 
50
50
  id = body['objectID']
51
51
  # scheduled_on is in the time zone of the franchise, not UTC
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vng
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-16 00:00:00.000000000 Z
10
+ date: 2025-01-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: simplecov