Sha256: 19551a098b67ca90390d371d3383852395bc708fec3acc9e4f4ba5037e766a2a
Contents?: true
Size: 607 Bytes
Versions: 1
Compression:
Stored size: 607 Bytes
Contents
require 'httparty' require 'hashie' module SgDeliverySlotChecker module Stores class ColdStorage def initialize(postal_code:) @postal_code = postal_code end def available? get_availability end private attr_reader :postal_code def get_availability response = HTTParty.get("https://coldstorage.com.sg/checkout/cart/checkdelivery?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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sg_delivery_slot_checker-0.3.0 | lib/sg_delivery_slot_checker/stores/cold_storage.rb |