Class: Shoryuken::Later::Client
- Inherits:
-
Object
- Object
- Shoryuken::Later::Client
- Defined in:
- lib/shoryuken/later/client.rb
Constant Summary collapse
- @@tables =
{}
Class Method Summary collapse
- .ddb ⇒ Object
- .put_item(table, attributes, options = {unless_exists: 'id'}) ⇒ Object
- .tables(table) ⇒ Object
Class Method Details
.ddb ⇒ Object
20 21 22 |
# File 'lib/shoryuken/later/client.rb', line 20 def ddb @ddb ||= AWS::DynamoDB.new end |
.put_item(table, attributes, options = {unless_exists: 'id'}) ⇒ Object
15 16 17 18 |
# File 'lib/shoryuken/later/client.rb', line 15 def put_item(table, attributes, ={unless_exists: 'id'}) attributes['id'] ||= SecureRandom.uuid tables(table).items.create(attributes, ) end |
.tables(table) ⇒ Object
9 10 11 12 13 |
# File 'lib/shoryuken/later/client.rb', line 9 def tables(table) @@tables[table.to_s] ||= ddb.tables[table].tap do |tbl| tbl.hash_key = [:id, :string] end end |