Class: FakeDynamo::Projection

Inherits:
Object
  • Object
show all
Extended by:
Validation
Defined in:
lib/fake_dynamo/projection.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

Constructor Details

#initialize(type, non_key_attributes) ⇒ Projection

Returns a new instance of Projection.



6
7
8
# File 'lib/fake_dynamo/projection.rb', line 6

def initialize(type, non_key_attributes)
  @type, @non_key_attributes = type, non_key_attributes
end

Instance Attribute Details

#non_key_attributesObject

Returns the value of attribute non_key_attributes.



4
5
6
# File 'lib/fake_dynamo/projection.rb', line 4

def non_key_attributes
  @non_key_attributes
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/fake_dynamo/projection.rb', line 4

def type
  @type
end

Class Method Details

.from_data(data) ⇒ Object



11
12
13
14
15
# File 'lib/fake_dynamo/projection.rb', line 11

def from_data(data)
  projection = Projection.new(data['ProjectionType'], data['NonKeyAttributes'])
  validate_projection(projection)
  projection
end

Instance Method Details

#descriptionObject



18
19
20
# File 'lib/fake_dynamo/projection.rb', line 18

def description
  {'ProjectionType' => type}.merge(non_key_attributes_description)
end

#non_key_attributes_descriptionObject



22
23
24
25
26
27
28
# File 'lib/fake_dynamo/projection.rb', line 22

def non_key_attributes_description
  if non_key_attributes
    {'NonKeyAttributes' => @non_key_attributes}
  else
    {}
  end
end