vng 3.3.1 → 3.3.2

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: 7c12edbb4518fc769872a46bb3060e6e88d8850c18e0c0eec6b9aea157bfcaa8
4
- data.tar.gz: 1bb1e134d2bf6b1ab736fd9c342f594fd826b1de7b116f114113f383fc33d157
3
+ metadata.gz: 3c0af9c8607d71fa3aa223f74a1a89961370b23bd9281e823edcf15c76144b06
4
+ data.tar.gz: ff11b94c1ddb0b616ebc2750af6d18bdc8a76ed6b1781c48b93a4c487c1bbe3f
5
5
  SHA512:
6
- metadata.gz: 61b780b5a55aa0c4cc87ee51ca4c9c9b1d850e4fb68bfae22939d95d4c5aef7315a79775c1be3ce37121ffbaff4400166693ec433eedd7a4ef6346d14766d120
7
- data.tar.gz: 6f87f2b80d1d52c9aa7711556bc1ae211f2b330b2e612cff7d2f450b803dc21838c1880cbc255609f94ecf4bed1f63df8f783d5a0c5f18ab56be43fc8f1707ea
6
+ metadata.gz: 684bb3e62c20b3c4c89a2bbf26c2ab52c17a4ea8345838ecdc566e75d0b645d389e2f7559a8c3288dcfdc17332103f2dd4a3f42e0bf730ace0d42a5c3c565853
7
+ data.tar.gz: d983ecf12bcd1e98baa4e720ee2b9963fa71197503e2d9db52a856bf1ec80947c022ef296d63a8b6daaa5dfd88ad8c58a9ec4288f243bc7e3cc1cd008ecbc7c6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [3.3.2] - 2025-01-22
2
+
3
+ - Don't assume isActive is returned as a boolean
4
+
1
5
  ## [3.3.1] - 2025-01-22
2
6
 
3
7
  - Add Route#type_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,17 +251,17 @@ 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, "routeTypeID" => 106},
264
+ {"routeID" => AVAILABLE_ROUTE_ID, "routeName" => "Route 1", "isActive" => 'true', "routeTypeID" => 106},
265
265
  {"routeID" => 2, "routeName" => "Route 2", "isActive" => true, "routeTypeID" => 107},
266
266
  {"routeID" => 3, "routeName" => "Route 3 (Inactive)", "isActive" => false, "routeTypeID" => 1},
267
267
  ]}
@@ -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
@@ -16,9 +16,9 @@ module Vng
16
16
  def self.all
17
17
  data = request path: PATH
18
18
 
19
- data.fetch('Routes', []).filter do |route|
20
- route['isActive']
21
- end.map do |body|
19
+ data.fetch('Routes', []).filter_map do |body|
20
+ next unless active?(body)
21
+
22
22
  id = body['routeID']
23
23
  name = body['routeName']
24
24
  type_id = body['routeTypeID']
@@ -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.1'
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vng
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob