Class: Dynamodb::Api::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamodb/api/adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAdapter

Returns a new instance of Adapter.



6
7
8
# File 'lib/dynamodb/api/adapter.rb', line 6

def initialize
  @client = Aws::DynamoDB::Client.new(connect_config)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/dynamodb/api/adapter.rb', line 4

def client
  @client
end

Instance Method Details

#connect_configObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dynamodb/api/adapter.rb', line 10

def connect_config
  @connect_hash = {}

  if Dynamodb::Api::Config.endpoint?
    @connect_hash[:endpoint] = Dynamodb::Api::Config.endpoint
  end
  if Dynamodb::Api::Config.access_key?
    @connect_hash[:access_key_id] = Dynamodb::Api::Config.access_key
  end
  if Dynamodb::Api::Config.secret_key?
    @connect_hash[:secret_access_key] = Dynamodb::Api::Config.secret_key
  end
  if Dynamodb::Api::Config.region?
    @connect_hash[:region] = Dynamodb::Api::Config.region
  end

  @connect_hash
end