vng 1.4.4 → 1.6.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/vng/case.rb +2 -2
- data/lib/vng/mock_request.rb +44 -10
- data/lib/vng/version.rb +1 -1
- data/lib/vng/zip.rb +26 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc73ebb5c56c095dd0605b32f41dcb6b75560f84a7b2b8ffcdfed0bc574a54ff
|
4
|
+
data.tar.gz: e64616624354c33d07c9bfe8ffb6c4494008d5dfbd3ce10c8f994015cf483fad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d5df6061ebbe9f818cac377456caf130bedb8c9864d3e984c8d32c1339aef9267006d545fc276e624559f489fb36be2c69118d4730a3c384ec9babe915d33b1
|
7
|
+
data.tar.gz: 2df311c7ae9c712e71f4c8f950ef3bc085888d9ea74d71b2acc989e324f9c6a467e506c267ff78383f8885d97ec01773e78b7722870062ef8ed33c253c1953d0
|
data/CHANGELOG.md
CHANGED
data/lib/vng/case.rb
CHANGED
@@ -11,10 +11,9 @@ module Vng
|
|
11
11
|
@id = id
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.create(client_id
|
14
|
+
def self.create(client_id: nil, summary:, comments:, phone:, email:, zip:)
|
15
15
|
body = {
|
16
16
|
method: '3',
|
17
|
-
clientID: client_id,
|
18
17
|
Fields: [
|
19
18
|
{ fieldID: 219, optionID: 239 }, # Status: open
|
20
19
|
{ fieldID: 220, fieldValue: summary }, # Summary:
|
@@ -26,6 +25,7 @@ module Vng
|
|
26
25
|
{ fieldID: 1023, fieldValue: zip }, # Zip Code:
|
27
26
|
]
|
28
27
|
}
|
28
|
+
body[:clientID] = client_id if client_id
|
29
29
|
|
30
30
|
data = request path: PATH, body: body
|
31
31
|
|
data/lib/vng/mock_request.rb
CHANGED
@@ -48,7 +48,14 @@ module Vng
|
|
48
48
|
{}
|
49
49
|
end
|
50
50
|
when '/api/v1/resources/zips/'
|
51
|
-
|
51
|
+
if @body[:method] == '1'
|
52
|
+
# TODO: The response already includes the ServiceTypes so there
|
53
|
+
# is no need to ask for those in a separate API request:
|
54
|
+
{ "Zip"=>{"zipCodeID"=>"1", "zipCode"=>"21765", "zoneName"=>"Brentwood", "defaultCity"=>"Los Angeles", "provinceAbbr"=>"CA", "franchiseID"=>"105"},
|
55
|
+
"ServiceTypes"=>[{"serviceTypeID"=>14, "serviceType"=>"Pet Grooming", "duration" => 45}]}
|
56
|
+
else
|
57
|
+
{ "Zips"=>[{ "zip"=>"21765", "zoneName"=>"Brentwood", "state"=>"MD" }] }
|
58
|
+
end
|
52
59
|
when '/api/v1/resources/franchises/'
|
53
60
|
if @body.key?(:objectID)
|
54
61
|
{ "Franchise"=>{ "objectID"=>"2201007" }, "Fields"=>[
|
@@ -75,7 +82,7 @@ module Vng
|
|
75
82
|
end
|
76
83
|
when '/api/v1/resources/breeds/'
|
77
84
|
{ "Breeds"=>[
|
78
|
-
{ "breedID"=>2, "breed"=>"Bulldog", "species"=>"Dog", "optionID"=>
|
85
|
+
{ "breedID"=>2, "breed"=>"Bulldog", "species"=>"Dog", "optionID"=>304, "breedLowWeight"=>30, "breedHighWeight"=>50 },
|
79
86
|
{ "breedID"=>3, "breed"=>"Affenpinscher", "species"=>"Dog", "optionID"=>304, "breedLowWeight"=>30, "breedHighWeight"=>50 },
|
80
87
|
{ "breedID"=>4, "breed"=>"Afghan", "species"=>"Dog", "optionID"=>304, "breedLowWeight"=>30, "breedHighWeight"=>50 },
|
81
88
|
{ "breedID"=>5, "breed"=>"Airedale Terrier", "species"=>"Dog", "optionID"=>304, "breedLowWeight"=>30, "breedHighWeight"=>50 },
|
@@ -94,8 +101,8 @@ module Vng
|
|
94
101
|
{ "breedID"=>18, "breed"=>"Bengal", "species"=>"Cat", "optionID"=>305, "breedLowWeight"=>30, "breedHighWeight"=>50 },
|
95
102
|
{ "breedID"=>19, "breed"=>"Birman", "species"=>"Cat", "optionID"=>305, "breedLowWeight"=>30, "breedHighWeight"=>50 },
|
96
103
|
{ "breedID"=>20, "breed"=>"Bombay", "species"=>"Cat", "optionID"=>305, "breedLowWeight"=>30, "breedHighWeight"=>50 },
|
97
|
-
{ "breedID"=>21, "breed"=>"Burmese", "species"=>"Cat", "optionID"=>
|
98
|
-
{ "breedID"=>22, "breed"=>"Chartreux", "species"=>"Cat", "optionID"=>
|
104
|
+
{ "breedID"=>21, "breed"=>"Burmese", "species"=>"Cat", "optionID"=>305, "breedLowWeight"=>30, "breedHighWeight"=>50 },
|
105
|
+
{ "breedID"=>22, "breed"=>"Chartreux", "species"=>"Cat", "optionID"=>305, "breedLowWeight"=>30, "breedHighWeight"=>50 },
|
99
106
|
] }
|
100
107
|
when '/api/v1/data/Leads/'
|
101
108
|
if @body[:Fields].find{|field| field[:fieldID] == 1024}[:fieldValue] == 'invalid-phone'
|
@@ -118,16 +125,43 @@ module Vng
|
|
118
125
|
{ "Location"=>{ "objectID"=>"995681" } }
|
119
126
|
when '/api/v1/data/Assets/'
|
120
127
|
if @body[:method].eql? '3'
|
121
|
-
|
128
|
+
if @body[:Fields].find{|field| field[:fieldID] == 1014}[:optionID].eql? 304
|
129
|
+
{ "Asset"=>{ "objectID"=>"2201008" } } # dog
|
130
|
+
elsif @body[:Fields].find{|field| field[:fieldID] == 1014}[:optionID].eql? 305
|
131
|
+
{ "Asset"=>{ "objectID"=>"2201009" } } # cat
|
132
|
+
end
|
122
133
|
elsif @body[:method].eql? '4'
|
123
134
|
{}
|
124
135
|
end
|
125
136
|
when '/api/v1/data/priceLists/'
|
126
|
-
|
127
|
-
{ "
|
128
|
-
|
129
|
-
|
130
|
-
|
137
|
+
if @body[:assetID].eql? "2201008"
|
138
|
+
{ "PriceItems"=>[
|
139
|
+
{ "priceItemID"=>275111, "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 },
|
140
|
+
{ "priceItemID"=>275112, "priceItem"=>"Bulldog American - 15 Step SPA Super Grooming Service", "value"=>105.0, "taxID"=>256, "durationPerUnit"=>75.0, "serviceBadge"=>nil, "serviceCategory"=>"15 Step Spa", "isOnline"=>true, "isActive"=>true },
|
141
|
+
|
142
|
+
{ "priceItemID"=>275300, "priceItem"=>"Bulldog American - Shave Down", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Not Recommended", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
|
143
|
+
{ "priceItemID"=>275301, "priceItem"=>"Bulldog American - Puppy Cut", "value"=>40.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Recommended", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
|
144
|
+
|
145
|
+
{ "priceItemID"=>275302, "priceItem"=>"De-Shedding Treatment inactive", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>false },
|
146
|
+
{ "priceItemID"=>275303, "priceItem"=>"De-Shedding Treatment 0-30 lbs", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>true },
|
147
|
+
{ "priceItemID"=>275304, "priceItem"=>"De-Shedding Treatment 60 - 100 lbs", "value"=>30.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>nil, "serviceCategory"=>"De-Shed", "isOnline"=>true, "isActive"=>true },
|
148
|
+
{ "priceItemID"=>275305, "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 },
|
149
|
+
|
150
|
+
{ "priceItemID"=>275306, "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 },
|
151
|
+
{ "priceItemID"=>275307, "priceItem"=>"Aches & Pains Package", "value"=>0.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
|
152
|
+
{ "priceItemID"=>275308, "priceItem"=>"Old Add On", "value"=>0.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Not Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
|
153
|
+
] }
|
154
|
+
elsif @body[:assetID].eql? "2201009"
|
155
|
+
{ "PriceItems"=>[
|
156
|
+
{ "priceItemID"=>276111, "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 },
|
157
|
+
|
158
|
+
{ "priceItemID"=>276111, "priceItem"=>"Cat Short Hair - Lion Cut", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
|
159
|
+
{ "priceItemID"=>276111, "priceItem"=>"Cat Short Hair - Shave Down", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>30.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Cut", "isOnline"=>true, "isActive"=>true },
|
160
|
+
|
161
|
+
{ "priceItemID"=>276111, "priceItem"=>"De-Matting - Light", "value"=>15.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
|
162
|
+
{ "priceItemID"=>276111, "priceItem"=>"De-Matting - Moderate", "value"=>20.0, "taxID"=>256, "durationPerUnit"=>15.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
|
163
|
+
] }
|
164
|
+
end
|
131
165
|
when '/api/v1/resources/serviceTypes/'
|
132
166
|
if @body.key?(:zip)
|
133
167
|
{"ServiceTypes" => [
|
data/lib/vng/version.rb
CHANGED
data/lib/vng/zip.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
require 'vng/resource'
|
2
|
+
require 'vng/service_type'
|
2
3
|
|
3
4
|
module Vng
|
4
5
|
# Provides methods to interact with Vonigo ZIP codes.
|
5
6
|
class Zip < Resource
|
6
7
|
PATH = '/api/v1/resources/zips/'
|
7
8
|
|
8
|
-
attr_reader :zip, :state, :zone_name
|
9
|
+
attr_reader :zip, :state, :zone_name, :city, :service_types
|
9
10
|
|
10
|
-
def initialize(zip:, state:, zone_name:)
|
11
|
+
def initialize(zip:, state:, zone_name:, city: nil, service_types: [])
|
11
12
|
@zip = zip
|
12
13
|
@state = state
|
13
14
|
@zone_name = zone_name
|
15
|
+
@city = city
|
16
|
+
@service_types = service_types
|
14
17
|
end
|
15
18
|
|
16
19
|
def self.all
|
@@ -26,5 +29,26 @@ module Vng
|
|
26
29
|
new zip: zip, state: state, zone_name: zone_name
|
27
30
|
end
|
28
31
|
end
|
32
|
+
|
33
|
+
def self.find_by(zip:)
|
34
|
+
body = {
|
35
|
+
method: '1',
|
36
|
+
zip: zip,
|
37
|
+
}
|
38
|
+
|
39
|
+
data = request path: PATH, body: body
|
40
|
+
zip_data = data['Zip']
|
41
|
+
|
42
|
+
unless zip_data['zipCodeID'] == '0'
|
43
|
+
service_types = data['ServiceTypes'].map do |body|
|
44
|
+
id = body['serviceTypeID']
|
45
|
+
type = body['serviceType']
|
46
|
+
duration = body['duration']
|
47
|
+
ServiceType.new id: id, type: type, duration: duration
|
48
|
+
end
|
49
|
+
|
50
|
+
new zip: zip_data['zipCode'], state: zip_data['provinceAbbr'], zone_name: zip_data['zoneName'], city: zip_data['defaultCity'], service_types: service_types
|
51
|
+
end
|
52
|
+
end
|
29
53
|
end
|
30
54
|
end
|
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: 1.
|
4
|
+
version: 1.6.0
|
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-
|
11
|
+
date: 2024-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|