Class: FakeDynamo::LocalSecondaryIndex

Inherits:
Object
  • Object
show all
Extended by:
Validation
Defined in:
lib/fake_dynamo/local_secondary_index.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Validation

add_errors, api_config, api_config_path, api_input_spec, available_operations, key_schema_mismatch, param, validate!, validate_hash_condition, validate_hash_key, validate_index_names, validate_input, validate_key_data, validate_key_schema, validate_operation, validate_payload, validate_projection, validate_range_condition, validate_range_key, validate_request_size, validate_spec, validate_type

Instance Attribute Details

#key_schemaObject

Returns the value of attribute key_schema.



5
6
7
# File 'lib/fake_dynamo/local_secondary_index.rb', line 5

def key_schema
  @key_schema
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/fake_dynamo/local_secondary_index.rb', line 5

def name
  @name
end

#projectionObject

Returns the value of attribute projection.



5
6
7
# File 'lib/fake_dynamo/local_secondary_index.rb', line 5

def projection
  @projection
end

Class Method Details

.from_data(index_data, attribute_definitions, table_key_schema) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/fake_dynamo/local_secondary_index.rb', line 8

def from_data(index_data, attribute_definitions, table_key_schema)
  index = LocalSecondaryIndex.new
  index.name = index_data['IndexName']
  index.key_schema = KeySchema.new(index_data['KeySchema'], attribute_definitions)
  index.projection = Projection.from_data(index_data['Projection'])
  validate_range_key(index.key_schema)
  validate_hash_key(index.key_schema, table_key_schema)
  index
end

Instance Method Details

#descriptionObject



19
20
21
22
23
24
25
# File 'lib/fake_dynamo/local_secondary_index.rb', line 19

def description
  {'IndexName' => name,
    'IndexSizeBytes' => 0,
    'ItemCount' => 0,
    'KeySchema' => key_schema.description,
    'Projection' => projection.description}
end