dynamodb-api 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: d75862785a658c569431a755b19e37972e48f76349d528f30f634286a1af56bf
4
- data.tar.gz: '039ea9788559f220a13c72b77ec8fbe600dd4eb9313052ac4b38334a1df22a53'
3
+ metadata.gz: e196a23ffdf4694c7b647f18949c3b644081870d0d1dc544632f90147f85a4be
4
+ data.tar.gz: 37d3c999ea267dee7c3659072f3f36d5ba164602694bc59dfbd692669506dcde
5
5
  SHA512:
6
- metadata.gz: d61815e063b12dfb9af4769e9e53fa2c6479ab4a84ec627ef89fbfe1a42d6c7c0ee8d7e59d8752d3090510c9d1e51d20e4a0499994dfee8c54a7cc724e387fae
7
- data.tar.gz: a2fefb7692e4447eab1fb80f0fe0f16977483a2838b76b44a5dcf74a5af29515e29f4368e2d65bcb2dcce288158706e4088eb33c7e292ba697ec038b4a021c7e
6
+ metadata.gz: 32f0a895f778a5793590c09f7c778aab242aa5ac6be4ca487414e166e9565b5c7e99e98b4d17617f70ac93250c1fe8d4bb70ced8d575f110b2b434445c392e40
7
+ data.tar.gz: b5bbc5126019038c091738b491650a857c47899f5ea4050b857a193108c44e19ee44446d9089739e5e22786ffe4f5bf8ce3674ee74b30add1a4b6e3e5f8a971e
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in dynamodb-api.gemspec
6
6
  gemspec
7
+
8
+ gem 'pry-byebug', platforms: :ruby
data/Gemfile.lock ADDED
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dynamodb-api (0.2.0)
5
+ aws-sdk-dynamodb (~> 1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ aws-eventstream (1.0.1)
11
+ aws-partitions (1.96.0)
12
+ aws-sdk-core (3.22.1)
13
+ aws-eventstream (~> 1.0)
14
+ aws-partitions (~> 1.0)
15
+ aws-sigv4 (~> 1.0)
16
+ jmespath (~> 1.0)
17
+ aws-sdk-dynamodb (1.8.0)
18
+ aws-sdk-core (~> 3)
19
+ aws-sigv4 (~> 1.0)
20
+ aws-sigv4 (1.0.3)
21
+ byebug (10.0.2)
22
+ coderay (1.1.2)
23
+ diff-lcs (1.3)
24
+ jmespath (1.4.0)
25
+ method_source (0.9.0)
26
+ pry (0.11.3)
27
+ coderay (~> 1.1.0)
28
+ method_source (~> 0.9.0)
29
+ pry-byebug (3.6.0)
30
+ byebug (~> 10.0)
31
+ pry (~> 0.10)
32
+ rake (10.5.0)
33
+ rspec (3.7.0)
34
+ rspec-core (~> 3.7.0)
35
+ rspec-expectations (~> 3.7.0)
36
+ rspec-mocks (~> 3.7.0)
37
+ rspec-core (3.7.1)
38
+ rspec-support (~> 3.7.0)
39
+ rspec-expectations (3.7.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.7.0)
42
+ rspec-mocks (3.7.0)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.7.0)
45
+ rspec-support (3.7.1)
46
+
47
+ PLATFORMS
48
+ ruby
49
+
50
+ DEPENDENCIES
51
+ bundler (~> 1.16)
52
+ dynamodb-api!
53
+ pry
54
+ pry-byebug
55
+ rake (~> 10.0)
56
+ rspec (~> 3.0)
57
+
58
+ BUNDLED WITH
59
+ 1.16.2
data/dynamodb-api.gemspec CHANGED
@@ -22,7 +22,10 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
+ spec.add_runtime_dependency 'aws-sdk-dynamodb', '~> 1'
26
+
25
27
  spec.add_development_dependency 'bundler', '~> 1.16'
26
28
  spec.add_development_dependency 'rake', '~> 10.0'
27
29
  spec.add_development_dependency 'rspec', '~> 3.0'
30
+ spec.add_development_dependency 'pry'
28
31
  end
data/lib/dynamodb/api.rb CHANGED
@@ -1,7 +1,19 @@
1
- require "dynamodb/api/version"
1
+ require 'aws-sdk-dynamodb'
2
+
3
+ require 'dynamodb/api/version'
4
+ require 'dynamodb/api/config'
5
+ require 'dynamodb/api/adapter'
2
6
 
3
7
  module Dynamodb
4
8
  module Api
5
- # Your code goes here...
9
+ extend self
10
+
11
+ def config
12
+ block_given? ? yield(Dynamodb::Api::Config) : Dynamodb::Api::Config
13
+ end
14
+
15
+ def adapter
16
+ @adapter ||= Dynamodb::Api::Adapter.new
17
+ end
6
18
  end
7
19
  end
@@ -0,0 +1,32 @@
1
+ module Dynamodb
2
+ module Api
3
+ class Adapter
4
+ def connect!
5
+ @client = Aws::DynamoDB::Client.new(connect_config)
6
+ end
7
+
8
+ def connect_config
9
+ @connect_hash = {}
10
+
11
+ if Dynamodb::Api::Config.endpoint?
12
+ @connect_hash[:endpoint] = Dynamodb::Api::Config.endpoint
13
+ end
14
+ if Dynamodb::Api::Config.access_key?
15
+ @connect_hash[:access_key_id] = Dynamodb::Api::Config.access_key
16
+ end
17
+ if Dynamodb::Api::Config.secret_key?
18
+ @connect_hash[:secret_access_key] = Dynamodb::Api::Config.secret_key
19
+ end
20
+ if Dynamodb::Api::Config.region?
21
+ @connect_hash[:region] = Dynamodb::Api::Config.region
22
+ end
23
+
24
+ @connect_hash
25
+ end
26
+
27
+ def client
28
+ @client
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,15 @@
1
+ require 'dynamodb/api/config/options'
2
+
3
+ module Dynamodb
4
+ module Api
5
+ module Config
6
+ extend self
7
+ extend Options
8
+
9
+ option :access_key, default: nil
10
+ option :secret_key, default: nil
11
+ option :region, default: nil
12
+ option :endpoint, default: nil
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,41 @@
1
+ module Dynamodb
2
+ module Api
3
+ module Config
4
+ module Options
5
+ def defaults
6
+ @defaults ||= {}
7
+ end
8
+
9
+ def option(name, options = {})
10
+ defaults[name] = settings[name] = options[:default]
11
+
12
+ class_eval <<-RUBY
13
+ def #{name}
14
+ settings[#{name.inspect}]
15
+ end
16
+
17
+ def #{name}=(value)
18
+ settings[#{name.inspect}] = value
19
+ end
20
+
21
+ def #{name}?
22
+ #{name}
23
+ end
24
+
25
+ def reset_#{name}
26
+ settings[#{name.inspect}] = defaults[#{name.inspect}]
27
+ end
28
+ RUBY
29
+ end
30
+
31
+ def reset
32
+ settings.replace(defaults)
33
+ end
34
+
35
+ def settings
36
+ @settings ||= {}
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  module Dynamodb
2
2
  module Api
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamodb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WalkerSumida
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-19 00:00:00.000000000 Z
11
+ date: 2018-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk-dynamodb
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description: aws dynamodb api
56
84
  email:
57
85
  - walkersumida@gmail.com
@@ -64,6 +92,7 @@ files:
64
92
  - ".travis.yml"
65
93
  - CODE_OF_CONDUCT.md
66
94
  - Gemfile
95
+ - Gemfile.lock
67
96
  - LICENSE.txt
68
97
  - README.md
69
98
  - Rakefile
@@ -71,6 +100,9 @@ files:
71
100
  - bin/setup
72
101
  - dynamodb-api.gemspec
73
102
  - lib/dynamodb/api.rb
103
+ - lib/dynamodb/api/adapter.rb
104
+ - lib/dynamodb/api/config.rb
105
+ - lib/dynamodb/api/config/options.rb
74
106
  - lib/dynamodb/api/version.rb
75
107
  homepage: https://github.com/walkersumida/dynamodb-api
76
108
  licenses: