gkv 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e7086ff4e33f99aaff34e5eb12b442d856450c3
4
- data.tar.gz: 18ed48d3a23cdbff795a52585df57a4c5290e065
3
+ metadata.gz: 431ffdcd55686613c8dec5a08c52a30dc7f7b3a2
4
+ data.tar.gz: 7386ee297118d07e28e5b4dc21c2ec8809d38d9f
5
5
  SHA512:
6
- metadata.gz: 719eb2aab72564f373356d43b8404ff06635546848f5d85edc9664f204940dd48d85b59013b89a169fc83343f1b14b92a05992c63725251243dddb49930413c8
7
- data.tar.gz: 48bf8e3495393f8f1f162531b17a4e998d517ccbb78ce34918c088c95770913303fe8375ca4f18899f458daa55f39be2cf35e3c124a1825c3db671fe81d9cb7f
6
+ metadata.gz: 4bac8fe3dc27c0556ea6ecbf09c77d5ed7eea866659d37ca3b9bf8a0d9fc17f3c38a302a0b9c86cba4c0856fe3203fb241a497e149dd2e7a24d30288e1342535
7
+ data.tar.gz: e96f636090b22f61b489779d47898b2745496950331199860a4f98080c1dc87d325583447d964f7a5a4d3bd8add5ca830e3991db6a343ea16acee4efe8531242
data/README.md CHANGED
@@ -34,7 +34,7 @@ set(*key*, *value*)
34
34
  db = Gkv::Database.new
35
35
  db.set('key', 12)
36
36
  # input is all coerced to the string type and returned when set
37
- # => '12'
37
+ # => 'some_hash'
38
38
  ```
39
39
 
40
40
  ### Get
@@ -43,7 +43,7 @@ get(*key*)
43
43
  ```ruby
44
44
  db = Gkv::Database.new
45
45
  db.set('apples', '10')
46
- # => '10'
46
+ # => 'some_hash'
47
47
  db.get('apples')
48
48
  # => '10'
49
49
  ```
@@ -55,7 +55,9 @@ get_version(*version*, *key*)
55
55
  ```ruby
56
56
  db = Gkv::Database.new
57
57
  db.set('apples', '20')
58
+ # => some_hash
58
59
  db.set('apples', '50')
60
+ # => some_hash
59
61
  db.get_version(1, 'apples')
60
62
  # => '20'
61
63
  db.get_version(2, 'apples')
@@ -68,11 +70,13 @@ db.get_version(2, 'apples')
68
70
  db = Gkv::Database.new
69
71
 
70
72
  db.set("Apples", "10")
73
+ # => some_hash
71
74
  db.get("Apples")
72
75
  # => "10"
73
76
 
74
77
  # update some values
75
78
  db.set("Apples", "12")
79
+ # => some_hash
76
80
  db.get("Apples")
77
81
  # => "12"
78
82
  db.get_version(1, "Apples")
@@ -81,23 +85,10 @@ db.get_version(1, "Apples")
81
85
  # keys that do not exist return KeyError
82
86
  db.get('magic')
83
87
  # => KeyError
84
-
85
- # using it in sinatra
86
- require 'sinatra'
87
- require 'json'
88
-
89
- post '/' do
90
- db.set(params['key'], params['value')
91
- { msg: "#{params['key']} set to #{params['value']}" }.to_json
92
- rescue
93
- { error: "Please send key and value params" }.to_json
94
- end
95
- end
96
-
97
- get '/get/:key' do
98
- { key: db.get(params['key']) }.to_json
99
- end
100
88
  ```
89
+
90
+ There is an example application included in the `example_app` directory that utilizes Sinatra
91
+
101
92
  ## Development
102
93
 
103
94
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the
@@ -0,0 +1,5 @@
1
+ # A sample Gemfile
2
+ source "https://rubygems.org"
3
+
4
+ gem "gkv"
5
+ gem "sinatra"
@@ -0,0 +1,22 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ gkv (0.1.0)
5
+ rack (1.6.2)
6
+ rack-protection (1.5.3)
7
+ rack
8
+ sinatra (1.4.6)
9
+ rack (~> 1.4)
10
+ rack-protection (~> 1.4)
11
+ tilt (>= 1.3, < 3)
12
+ tilt (2.0.1)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ gkv
19
+ sinatra
20
+
21
+ BUNDLED WITH
22
+ 1.10.3
@@ -0,0 +1,20 @@
1
+ require 'gkv'
2
+ require 'json'
3
+ require 'sinatra'
4
+
5
+ db = Gkv::Database.new
6
+
7
+ get '/get/:key' do
8
+ db.get(params['key'])
9
+ end
10
+
11
+ post '/set' do
12
+ begin
13
+ key, value = params.fetch('key'), params.fetch('value')
14
+ db.set(key, value)
15
+ rescue KeyError
16
+ { error: 'Please send key and value params in your request' }.to_json
17
+ end
18
+ end
19
+
20
+ # tuh duh
@@ -1,3 +1,3 @@
1
1
  module Gkv
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gkv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - '='
@@ -85,6 +85,9 @@ files:
85
85
  - bin/console
86
86
  - bin/gkv
87
87
  - bin/setup
88
+ - example_application/Gemfile
89
+ - example_application/Gemfile.lock
90
+ - example_application/server.rb
88
91
  - gkv.gemspec
89
92
  - lib/gkv.rb
90
93
  - lib/gkv/database.rb