Class: Zetto::Storage::ImpuretyData::Restore

Inherits:
Object
  • Object
show all
Defined in:
lib/zetto/storage/impurety_data/restore.rb

Instance Method Summary collapse

Instance Method Details

#execute(token_data_str) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/zetto/storage/impurety_data/restore.rb', line 5

def execute(token_data_str)

  token_data_hash = JSON.parse(token_data_str)
  key_of_impurity_hash = token_data_hash.keys[0]
  redis = Zetto::Storage::Connect::RedisSingelton.get
  json_data = redis.get('impurity_hash_data:' + key_of_impurity_hash.to_s)
  return nil if json_data.nil?
  data = JSON.parse(json_data)
  data['token'] = token_data_hash[key_of_impurity_hash]
  data
rescue Exception => e
  Zetto::Services::Info.error_message I18n.t('exseptions.unknown_error', argument: 'Zetto::Storage::ImpuretyData::Restore', current_method: __method__), e
  nil
end