Class: Vendors::Getyourguide::NotifyWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- Vendors::Getyourguide::NotifyWorker
- Defined in:
- app/workers/vendors/getyourguide/notify_worker.rb
Constant Summary collapse
- BASE_URL =
ENV['GETYOURGUIDE_NOTIFY_AVAILABILITY_UPDATE_BASE_URL']
- USERNAME =
ENV['GETYOURGUIDE_NOTIFY_AVAILABILITY_UPDATE_USERNAME']
- PASSWORD =
ENV['GETYOURGUIDE_NOTIFY_AVAILABILITY_UPDATE_PASSWORD']
- MAX_REQUESTS_PER_HOUR =
1000- REQUEST_INTERVAL =
in seconds
3600 / MAX_REQUESTS_PER_HOUR
Instance Method Summary collapse
Instance Method Details
#perform(restaurant_ids = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/workers/vendors/getyourguide/notify_worker.rb', line 13 def perform(restaurant_ids = nil) # skip this worker if flipper feature is disabled return unless Flipper.enabled?(:gyg_notify_availability) vendor_id = Doorkeeper::Application.find_by(name: ApiVendorV1::Constants::GET_YOUR_GUIDE_VENDOR_NAME)&.id # skip if oauth application is not found return if vendor_id.blank? return if restaurant_ids.blank? active_restaurants = find_active_not_expired_restaurants(restaurant_ids, vendor_id) inactive_restaurants = find_inactive_restaurants(restaurant_ids, vendor_id) processed_active_restaurants(active_restaurants) if active_restaurants.present? processed_inactive_restaurants(inactive_restaurants) if inactive_restaurants.present? end |