Class: Eventosaurus::Models::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/eventosaurus/models/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_name:, partition_key:, local_indexes: {}, args: {}) ⇒ Table

Returns a new instance of Table.



11
12
13
14
15
16
17
18
# File 'lib/eventosaurus/models/table.rb', line 11

def initialize(table_name:, partition_key:, local_indexes: {}, args: {})
  @table_name = table_name
  @partition_key_name = partition_key.keys.first
  @partition_key_type = partition_key.values.first.to_s.capitalize
  @local_indexes = local_indexes
  @read_capacity_units = args[:read_capacity_units] || 50
  @write_capacity_units = args[:read_capacity_units] || 100
end

Instance Attribute Details

#local_indexesObject (readonly)

Returns the value of attribute local_indexes.



4
5
6
# File 'lib/eventosaurus/models/table.rb', line 4

def local_indexes
  @local_indexes
end

#partition_key_nameObject (readonly)

Returns the value of attribute partition_key_name.



4
5
6
# File 'lib/eventosaurus/models/table.rb', line 4

def partition_key_name
  @partition_key_name
end

#partition_key_typeObject (readonly)

Returns the value of attribute partition_key_type.



4
5
6
# File 'lib/eventosaurus/models/table.rb', line 4

def partition_key_type
  @partition_key_type
end

#read_capacity_unitsObject (readonly)

Returns the value of attribute read_capacity_units.



4
5
6
# File 'lib/eventosaurus/models/table.rb', line 4

def read_capacity_units
  @read_capacity_units
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



4
5
6
# File 'lib/eventosaurus/models/table.rb', line 4

def table_name
  @table_name
end

#write_capacity_unitsObject (readonly)

Returns the value of attribute write_capacity_units.



4
5
6
# File 'lib/eventosaurus/models/table.rb', line 4

def write_capacity_units
  @write_capacity_units
end

Instance Method Details

#to_hashObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/eventosaurus/models/table.rb', line 20

def to_hash
  {
    attribute_definitions: attribute_definitions,
    global_secondary_indexes: global_secondary_indexes,
    key_schema: table_key_schema,
    local_secondary_indexes: local_secondary_indexes,
    provisioned_throughput: provisioned_throughput,
    table_name: table_name
  }
end