vng 3.3.1 → 3.4.0

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: 7c12edbb4518fc769872a46bb3060e6e88d8850c18e0c0eec6b9aea157bfcaa8
4
- data.tar.gz: 1bb1e134d2bf6b1ab736fd9c342f594fd826b1de7b116f114113f383fc33d157
3
+ metadata.gz: 82efc2a53c1701fc7eb085e9288eb19f5aad31bd8c6b53a741b7df6f7f3614fb
4
+ data.tar.gz: ce64e32bef02da3d05f0bb2abe617d43fb3e6a88e5f9ef17b7513d7436de0be6
5
5
  SHA512:
6
- metadata.gz: 61b780b5a55aa0c4cc87ee51ca4c9c9b1d850e4fb68bfae22939d95d4c5aef7315a79775c1be3ce37121ffbaff4400166693ec433eedd7a4ef6346d14766d120
7
- data.tar.gz: 6f87f2b80d1d52c9aa7711556bc1ae211f2b330b2e612cff7d2f450b803dc21838c1880cbc255609f94ecf4bed1f63df8f783d5a0c5f18ab56be43fc8f1707ea
6
+ metadata.gz: 6d0ea75c0ed1a0597ceeaead6523c2cc1e398127bf6bf52a738f82ccbeb92fe7d1dcc8821beee09716a20976878f2b62c0797e225742215b39aba2ef4237f824
7
+ data.tar.gz: a483291bb5db42d991b3574dca10786f617dd6f7c263142430d926bd9c2cd3a238f01e72ddc655c0c3fdfa70c59f834ccbf8ad4d901b1dec61c3150a8d271cb5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [3.4.0] - 2025-01-22
2
+
3
+ - Add WorkOrder#route_id
4
+
5
+ ## [3.3.2] - 2025-01-22
6
+
7
+ - Don't assume isActive is returned as a boolean
8
+
1
9
  ## [3.3.1] - 2025-01-22
2
10
 
3
11
  - 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.4.0'
3
3
  end
@@ -5,9 +5,9 @@ module Vng
5
5
  class WorkOrder < Resource
6
6
  PATH = '/api/v1/data/WorkOrders/'
7
7
 
8
- attr_reader :id, :scheduled_on, :price, :discount, :tax, :tip, :duration, :total
8
+ attr_reader :id, :scheduled_on, :price, :discount, :tax, :tip, :duration, :total, :route_id
9
9
 
10
- def initialize(id:, scheduled_on: nil, price: nil, discount: nil, tax: nil, tip: nil, duration: nil, total: nil)
10
+ def initialize(id:, scheduled_on: nil, price: nil, discount: nil, tax: nil, tip: nil, duration: nil, total: nil, route_id: nil)
11
11
  @id = id
12
12
  @scheduled_on = scheduled_on
13
13
  @price = price
@@ -16,6 +16,7 @@ module Vng
16
16
  @tip = tip
17
17
  @duration = duration
18
18
  @total = total
19
+ @route_id = route_id
19
20
  end
20
21
 
21
22
  def self.create(lock_id:, client_id:, contact_id:, location_id:, duration:, summary:, line_items:)
@@ -45,7 +46,7 @@ module Vng
45
46
  data = request path: PATH, body: body, returning: 'WorkOrders'
46
47
 
47
48
  data.filter_map do |body|
48
- next unless body['isActive']
49
+ next unless active?(body)
49
50
 
50
51
  id = body['objectID']
51
52
  # scheduled_on is in the time zone of the franchise, not UTC
@@ -56,8 +57,9 @@ module Vng
56
57
  tip = BigDecimal(value_for_field body, 810)
57
58
  duration = Integer(value_for_field body, 186)
58
59
  total = BigDecimal(value_for_field body, 9835)
60
+ route_id = value_for_relation body, 'route'
59
61
 
60
- new id:, scheduled_on:, price:, discount:, tax:, tip:, duration:, total:
62
+ new id:, scheduled_on:, price:, discount:, tax:, tip:, duration:, total:, route_id:
61
63
  end
62
64
  end
63
65
 
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.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob