Sha256: f2f923e9846008f24afe87dcb3765da1f2fbd3978bfe236073b4b0605b873f8c
Contents?: true
Size: 600 Bytes
Versions: 3
Compression:
Stored size: 600 Bytes
Contents
require 'httparty' require 'hashie' module SgDeliverySlotChecker module Stores class Giant def initialize(postal_code:) @postal_code = postal_code end def available? get_availability end private attr_reader :postal_code def get_availability response = HTTParty.post("https://giant.sg/checkout/cart/checkdelivery", body: { postal_code: postal_code }) slots = response.parsed_response slots.extend Hashie::Extensions::DeepFind slots.deep_find_all("available").any?(true) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems