Sha256: 1163e37bc55784a88fa9a0730a5aa08ef00cf47ffd36e1daad6b5fa9903b4839
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
class G5Updatable::ClientFeedProcessor attr_reader :client_uid def initialize(params) @client_uid = params[:client_uid] || ENV["CLIENT_UID"] raise "A client_uid must be either passed in or configured!" if @client_uid.blank? @location_uid = params[:location_uid] end class << self def load_all_clients G5Updatable::AllClientUrnsFetcher.fetch_uids.each do |uid| puts "Loading: #{uid}" load_client(uid) end end def load_client(client_uid) begin new(client_uid: client_uid).work rescue => e Rails.logger.error e nil end end end def work @location_uid ? update_location : update_client end private def update_location return unless update_params = location_hash G5Updatable::LocationsUpdater.new(update_params).update end def update_client return unless update_params = client_hash G5Updatable::ClientUpdater.new(update_params).update end def client_hash G5Updatable::Fetcher.get_with_token(@client_uid)['client'] end def location_hash G5Updatable::Fetcher.get_with_token(@location_uid)['location'] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
g5_updatable-1.0.2.pre.1 | app/lib/g5_updatable/client_feed_processor.rb |