Sha256: c7a17669bba3c3674bcf8f13d4bd24bc2ac88ecf03fb8bba402c4eb5d5b77e0a

Contents?: true

Size: 728 Bytes

Versions: 1

Compression:

Stored size: 728 Bytes

Contents

require "sg_delivery_slot_checker/stores/fairprice"
require "sg_delivery_slot_checker/stores/giant"
require "sg_delivery_slot_checker/stores/cold_storage"

module SgDeliverySlotChecker
  class Checker

    def initialize(postal_code:)
      @postal_code = postal_code.to_s
    end

    def check_availability
      {}.tap do |hash|
        stores.each do |k, v|
          hash[k] = v.new(postal_code: postal_code).available?
        end
      end
    end

    private

    attr_reader :postal_code

    def stores
      {
        fairprice: SgDeliverySlotChecker::Stores::Fairprice,
        giant: SgDeliverySlotChecker::Stores::Giant,
        cold_storage: SgDeliverySlotChecker::Stores::ColdStorage
      }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sg_delivery_slot_checker-0.2.0 lib/sg_delivery_slot_checker/checker.rb