Class: HecksAdapters::DynamoDB::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/repository.rb

Overview

Use the Aws::DynamoDB::Client to persist your domain resources

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(head) ⇒ Repository

Returns a new instance of Repository.



12
13
14
15
# File 'lib/repository.rb', line 12

def initialize(head)
  @head = head
  @client = Aws::DynamoDB::Client.new(region: 'us-east-1')
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/repository.rb', line 10

def id
  @id
end

Instance Method Details

#create(args) ⇒ Object



17
18
19
# File 'lib/repository.rb', line 17

def create(args)
  Commands::Create.new(args, head, client).call
end

#delete(id) ⇒ Object



21
22
23
# File 'lib/repository.rb', line 21

def delete(id)
  Commands::Delete.new({id: id}, head, client).call
end

#read(id) ⇒ Object



25
26
27
# File 'lib/repository.rb', line 25

def read(id)
  Commands::Read.new(id, head, client).call
end

#update(id, attributes) ⇒ Object



29
30
31
# File 'lib/repository.rb', line 29

def update(id, attributes)
  Commands::Update.new(id, attributes, head, client).call
end