sg_delivery_slot_checker 0.2.0 → 0.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb75d060692f9b14b0a8022be4d7228e7b3629c5158c48e282e5dfa2429159d2
|
4
|
+
data.tar.gz: 30fed5a94bd259e20209e67951fd89c4123fde97540517354dede3849e8aed1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df9b1cc0180f9bee98a09efced54576a4d1c5bf0a5545567039fbf09fc908ccdab102d4a4cd3f08d78baabddab00b8f5369ab8f7cfd7322bb867fa7b70b25b8d
|
7
|
+
data.tar.gz: 874e3c4d52ec05497a1ab38e99d2afa26cd581fe017434d7445fecdc33f4623dc84e170114bce937d94c404fe22b76654dfedafa6010552f8856326877195e56
|
data/Gemfile.lock
CHANGED
@@ -18,11 +18,8 @@ module SgDeliverySlotChecker
|
|
18
18
|
attr_reader :postal_code
|
19
19
|
|
20
20
|
def get_availability
|
21
|
-
response = HTTParty.
|
22
|
-
|
23
|
-
'postal_code': postal_code
|
24
|
-
}
|
25
|
-
)
|
21
|
+
response = HTTParty.get("https://coldstorage.com.sg/checkout/cart/checkdelivery?postal_code=#{postal_code}")
|
22
|
+
|
26
23
|
slots = response.parsed_response
|
27
24
|
slots.extend Hashie::Extensions::DeepFind
|
28
25
|
slots.deep_find_all("available").any?(true)
|
@@ -21,12 +21,12 @@ module SgDeliverySlotChecker
|
|
21
21
|
attr_reader :postal_code
|
22
22
|
|
23
23
|
def store_id
|
24
|
-
response = HTTParty.get("https://website-api.omni.fairprice.com.sg/api/serviceable-area?city=Singapore&pincode
|
24
|
+
response = HTTParty.get("https://website-api.omni.fairprice.com.sg/api/serviceable-area?city=Singapore&pincode=\"#{postal_code}\"")
|
25
25
|
response.parsed_response&.dig("data", "store", "id")
|
26
26
|
end
|
27
27
|
|
28
28
|
def get_availability(store:)
|
29
|
-
response = HTTParty.get("https://website-api.omni.fairprice.com.sg/api/slot-availability?address[pincode]
|
29
|
+
response = HTTParty.get("https://website-api.omni.fairprice.com.sg/api/slot-availability?address[pincode]=\"#{postal_code}\"&storeId=#{store}")
|
30
30
|
response.parsed_response&.dig("data", "available")
|
31
31
|
end
|
32
32
|
|