Class: Dolphin::Models::Cassandra::Notification

Inherits:
Base
  • Object
show all
Defined in:
lib/dolphin/models/cassandra/notification.rb

Instance Attribute Summary

Attributes inherited from Base

#db

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Dolphin::Models::Cassandra::Base

Instance Method Details

#delete(id) ⇒ Object



22
23
24
# File 'lib/dolphin/models/cassandra/notification.rb', line 22

def delete(id)
  db.remove('notifications', id)
end

#get(id) ⇒ Object



9
10
11
12
# File 'lib/dolphin/models/cassandra/notification.rb', line 9

def get(id)
  res = db.get('notifications', id.to_s)
  MultiJson.load(res['methods'])
end

#put(id, methods) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/dolphin/models/cassandra/notification.rb', line 14

def put(id, methods)
  column_name = 'methods'
  row_key = id.to_s
  value = MultiJson.dump(methods)

  db.insert('notifications', row_key, {column_name => value})
end