vng 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/vng/mock_request.rb +10 -3
- 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/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"=>[
|
@@ -127,7 +134,7 @@ module Vng
|
|
127
134
|
{}
|
128
135
|
end
|
129
136
|
when '/api/v1/data/priceLists/'
|
130
|
-
if @body[:assetID].eql? 2201008
|
137
|
+
if @body[:assetID].eql? "2201008"
|
131
138
|
{ "PriceItems"=>[
|
132
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 },
|
133
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 },
|
@@ -144,7 +151,7 @@ module Vng
|
|
144
151
|
{ "priceItemID"=>275307, "priceItem"=>"Aches & Pains Package", "value"=>0.0, "taxID"=>256, "durationPerUnit"=>60.0, "serviceBadge"=>"Offered", "serviceCategory"=>"Add Ons", "isOnline"=>true, "isActive"=>true },
|
145
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 },
|
146
153
|
] }
|
147
|
-
elsif @body[:assetID].eql? 2201009
|
154
|
+
elsif @body[:assetID].eql? "2201009"
|
148
155
|
{ "PriceItems"=>[
|
149
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 },
|
150
157
|
|
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
|