Sha256: 9e38082208ce30494ef663925cbc4202ee8a61cfa2ab4dd052b741472c4c0f4e
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 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 G5Updatable::LocationsUpdater.new(location_hash).update end def update_client G5Updatable::ClientUpdater.new(client_hash).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-0.20.3.pre.1 | lib/g5_updatable/client_feed_processor.rb |