Sha256: f51eab4efeb8138670cf97c7826bacd7a31a56f63b197771f3616337ca04c92d

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 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
    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.3.0 lib/sg_delivery_slot_checker/checker.rb