Sha256: ebde1866f77f4cae31914c0486a264bea5d010d5f4c001e930c0d6ad2c273809

Contents?: true

Size: 836 Bytes

Versions: 11

Compression:

Stored size: 836 Bytes

Contents

class G5Updatable::ClientFeedProcessor
  attr_reader :client_uid

  def initialize(client_uid=nil)
    @client_uid = client_uid || ENV["CLIENT_UID"]
    raise "A client_uid must be either passed in or configured!" if @client_uid.blank?
  end

  class << self
    def load_all_clients(clients_url)
      client_uids = G5FoundationClient::Client.all_client_uids clients_url
      client_uids.collect { |client_uid| new(client_uid).work }
    end
  end

  def work
    client = update_client
    update_locations

    client
  end

  private

  def update_locations
    G5Updatable::LocationsUpdater.new(foundation_client).update
  end

  def update_client
    G5Updatable::ClientUpdater.new(foundation_client).update
  end

  def foundation_client
    @foundation_client ||= G5FoundationClient::Client.find_by_uid(@client_uid)
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
g5_updatable-0.10.3 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.10.2 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.10.1 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.10.0 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.9.0 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.8.0 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.7.2 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.7.1 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.7.0 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.6.1 lib/g5_updatable/client_feed_processor.rb
g5_updatable-0.6.0 lib/g5_updatable/client_feed_processor.rb