dynamodb_model 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 695afa2fc15607d068003af7eab703194659ea0f
4
- data.tar.gz: 4a0375284bf1565b781cd5fac752730e4fe7ddb4
3
+ metadata.gz: 9158215874b48548a2277c47f0c8631154003c0d
4
+ data.tar.gz: 14286fcd10167671f71bea13b3a7004ce3297838
5
5
  SHA512:
6
- metadata.gz: d26a55e6f07ae80457927212586ecd0fe1e3a5e7529e29c70db8b948d63c63bef07b75977dcdea0f52dbe3998bbd6eb1396758b58c84f0b3d3d152368a40fdbe
7
- data.tar.gz: e10afd1105fce09364cdd41bfaa8bba11b43e489eaf63b082bd8c199726e87da56cc6e2fb29c12f969f2e7f4bf45e9d5215430f423505cde4cc97abf199eafd7
6
+ metadata.gz: 5cac64e834aa90c2a32a0c02daa5dc140855efeb30991e32909455b0b9ba9c3cd00889d62b0abd40dc0479c3c5b40018c19a436effd9f995f04474fc3bd386c9
7
+ data.tar.gz: 6a542fbb159fd1ea0b807661bfeda3bad08e6f7ea363aacd023fed3e7a2aa901ded383218d9256e27fc48b40164114ac220a453d8cd2ed9119fc8d9589e5dd6a
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [1.0.2]
7
+ - to_json for json rendering
8
+
6
9
  ## [1.0.1]
7
10
  - Check dynamodb local is running when configured
8
11
 
@@ -1,9 +1,60 @@
1
+ # Note: table name created will be namespaced based on
2
+ # DynamodbModel::Migration.table_namespace. This can be set in
3
+ # config/dynamodb.yml
4
+ #
5
+ # development:
6
+ # table_namespace: "mynamespace"
7
+ #
8
+ # This results in:
9
+ # create_table "posts"
10
+ # Produces:
11
+ # table name: "mynamespace-posts"
12
+ #
13
+ # When you're in a in Jets project you can set the namespace based on
14
+ # Jets.config.table_namespace, which is based on the project name and
15
+ # a short version of the environment. Example:
16
+ #
17
+ # `config/dynamodb.yml`:
18
+ # development:
19
+ # table_namespace: <%= Jets.config.table_namespace %>
20
+ #
21
+ # If your project_name is demo and environment is production:
22
+ # create_table "posts" => table name: "demo-prod-posts"
23
+ #
24
+ # If your project_name is proj and environment is staging:
25
+ # create_table "posts" => table name: "demo-stag-posts"
26
+ #
27
+ # If your project_name is proj and environment is development:
28
+ # create_table "posts" => table name: "demo-dev-posts"
29
+ #
30
+ # If the table_namespace is set to a blank string or nil, then a namespace
31
+ # will not be prepended at all.
32
+
1
33
  class CreateCommentsMigration < DynamodbModel::Migration
2
34
  def up
3
35
  create_table :comments do |t|
4
36
  t.partition_key "post_id:string" # required
5
37
  t.sort_key "created_at:string" # optional
6
38
  t.provisioned_throughput(5) # sets both read and write, defaults to 5 when not set
39
+
40
+ # Instead of using partition_key and sort_key you can set the
41
+ # key schema directly also
42
+ # t.key_schema([
43
+ # {attribute_name: "id", :key_type=>"HASH"},
44
+ # {attribute_name: "created_at", :key_type=>"RANGE"}
45
+ # ])
46
+ # t.attribute_definitions([
47
+ # {attribute_name: "id", attribute_type: "N"},
48
+ # {attribute_name: "created_at", attribute_type: "S"}
49
+ # ])
50
+
51
+ # other ways to set provisioned_throughput
52
+ # t.provisioned_throughput(:read, 10)
53
+ # t.provisioned_throughput(:write, 10)
54
+ # t.provisioned_throughput(
55
+ # read_capacity_units: 5,
56
+ # write_capacity_units: 5
57
+ # )
7
58
  end
8
59
  end
9
60
  end
@@ -86,7 +86,8 @@ module DynamodbModel
86
86
  self.class.partition_key
87
87
  end
88
88
 
89
- def to_attrs
89
+ # For render json: item
90
+ def as_json(options={})
90
91
  @attrs
91
92
  end
92
93
 
@@ -1,3 +1,3 @@
1
1
  module DynamodbModel
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamodb_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2017-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.4.5
136
+ rubygems_version: 2.6.13
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: ActiveRecord-ish Dynamodb Model