Class: EVSSClaimsSyncStatusTracker

Inherits:
Common::RedisStore show all
Defined in:
app/models/evss_claims_sync_status_tracker.rb

Constant Summary

Constants inherited from Common::RedisStore

Common::RedisStore::REQ_CLASS_INSTANCE_VARS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Common::RedisStore

create, delete, #destroy, #destroyed?, exists?, #expire, find, find_or_build, #initialize, #initialize_dup, keys, #persisted?, pop, redis_key, redis_store, redis_ttl, #save, #save!, #ttl, #update, #update!

Constructor Details

This class inherits a constructor from Common::RedisStore

Instance Attribute Details

#claim_idObject

Returns the value of attribute claim_id.



10
11
12
# File 'app/models/evss_claims_sync_status_tracker.rb', line 10

def claim_id
  @claim_id
end

Instance Method Details

#collection_keyObject (private)



42
43
44
45
46
47
48
49
# File 'app/models/evss_claims_sync_status_tracker.rb', line 42

def collection_key
  unless user_uuid
    raise Common::Exceptions::InternalServerError, ArgumentError.new(
      'EVSSClaimsRedisHelper#collection_key was called without having set a user uuid'
    )
  end
  'all'
end

#delete_collection_statusObject



30
31
32
33
# File 'app/models/evss_claims_sync_status_tracker.rb', line 30

def delete_collection_status
  status_hash.delete(collection_key)
  save
end

#delete_single_statusObject



35
36
37
38
# File 'app/models/evss_claims_sync_status_tracker.rb', line 35

def delete_single_status
  status_hash.delete(single_record_key)
  save
end

#get_collection_statusObject



12
13
14
# File 'app/models/evss_claims_sync_status_tracker.rb', line 12

def get_collection_status
  status_hash[collection_key]
end

#get_single_statusObject



16
17
18
# File 'app/models/evss_claims_sync_status_tracker.rb', line 16

def get_single_status
  status_hash[single_record_key]
end

#set_collection_status(status) ⇒ Object



20
21
22
23
# File 'app/models/evss_claims_sync_status_tracker.rb', line 20

def set_collection_status(status)
  status_hash[collection_key] = status
  save
end

#set_single_status(status) ⇒ Object



25
26
27
28
# File 'app/models/evss_claims_sync_status_tracker.rb', line 25

def set_single_status(status)
  status_hash[single_record_key] = status
  save
end

#single_record_keyObject (private)



51
52
53
54
55
56
57
58
59
60
61
62
# File 'app/models/evss_claims_sync_status_tracker.rb', line 51

def single_record_key
  arr = []
  arr << 'claim_id' unless claim_id
  arr << 'user_uuid' unless user_uuid

  unless arr.empty?
    raise Common::Exceptions::InternalServerError, ArgumentError.new(
      "EVSSClaimsRedisHelper#single_record_key was called without having set a #{arr.join(', ')}"
    )
  end
  "update_from_remote.#{claim_id}"
end