class SgDeliverySlotChecker::Stores::Giant
Attributes
postal_code[R]
Public Class Methods
new(postal_code:)
click to toggle source
# File lib/sg_delivery_slot_checker/stores/giant.rb, line 8 def initialize(postal_code:) @postal_code = postal_code end
Public Instance Methods
available?()
click to toggle source
# File lib/sg_delivery_slot_checker/stores/giant.rb, line 12 def available? get_availability end
Private Instance Methods
get_availability()
click to toggle source
# File lib/sg_delivery_slot_checker/stores/giant.rb, line 20 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