nsisam 0.7.5 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.5
1
+ 0.7.6
data/lib/nsisam/client.rb CHANGED
@@ -42,7 +42,7 @@ module NSISam
42
42
  def store(data)
43
43
  request_data = {:value => data}
44
44
  request_data[:expire] = @expire if @expire
45
- request = prepare_request :PUT, request_data.to_json
45
+ request = prepare_request :POST, request_data.to_json
46
46
  Response.new(execute_request(request))
47
47
  end
48
48
 
@@ -54,7 +54,7 @@ module NSISam
54
54
  # @return [Response] object with access to the key and the sha512 checkum of the stored data
55
55
  #
56
56
  # @raise [NSISam::Errors::Client::AuthenticationError] when user and password doesn't match
57
- #
57
+ #
58
58
  # @example
59
59
  # nsisam.store_file(File.read("foo.txt"))
60
60
  # nsisam.store_file(File.read("foo.txt"), :video)
@@ -136,7 +136,7 @@ module NSISam
136
136
  def update(key, value)
137
137
  request_data = {:key => key, :value => value}
138
138
  request_data[:expire] = @expire if @expire
139
- request = prepare_request :POST, request_data.to_json
139
+ request = prepare_request :PUT, request_data.to_json
140
140
  Response.new(execute_request(request))
141
141
  end
142
142
 
@@ -13,7 +13,7 @@ module NSISam
13
13
  rand.to_s
14
14
  end
15
15
 
16
- put "/" do
16
+ post "/" do
17
17
  content_type :json
18
18
  incoming = JSON.parse(request.body.read)
19
19
  key = generate_key
@@ -41,7 +41,7 @@ module NSISam
41
41
  { deleted: true }.to_json
42
42
  end
43
43
 
44
- post "/" do
44
+ put "/" do
45
45
  content_type :json
46
46
  incoming = JSON.parse(request.body.read)
47
47
  expire = incoming['expire']
@@ -50,7 +50,7 @@ module NSISam
50
50
  if incoming.has_key? 'expire'
51
51
  storage.delete(key)
52
52
  else
53
- storage[key] = incoming['value']
53
+ storage[key] = incoming['value']
54
54
  end
55
55
  { key: key, checksum: 0 }.to_json
56
56
  end
data/nsisam.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "nsisam"
8
- s.version = "0.7.5"
8
+ s.version = "0.7.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Douglas Camata"]
12
- s.date = "2012-09-27"
12
+ s.date = "2012-11-30"
13
13
  s.description = "A simple gem to access a SAM node. For more info about SAM\n visit www.github.com/nsi-iff/sam_buildout."
14
14
  s.email = "d.camata@gmail.com"
15
15
  s.extra_rdoc_files = [
data/spec/nsisam_spec.rb CHANGED
@@ -4,11 +4,11 @@ require 'base64'
4
4
  describe NSISam do
5
5
  before :all do
6
6
  fake_options = { user: 'test', password: 'test', host: 'localhost',
7
- port: '9888' }
7
+ port: '7888' }
8
8
  @options = integration_options || fake_options
9
9
  @nsisam = NSISam::Client.new(@options)
10
10
  @keys = Array.new
11
- @fake_sam = NSISam::FakeServerManager.new.start_server(9888) unless integrating?
11
+ @fake_sam = NSISam::FakeServerManager.new.start_server(7888) unless integrating?
12
12
  end
13
13
 
14
14
  before :each do
@@ -40,7 +40,7 @@ describe NSISam do
40
40
  it "can store a value with an expire time" do
41
41
  @nsisam.expire = 2
42
42
  response = @nsisam.store('teste')
43
- sleep(3)
43
+ sleep(3)
44
44
  expect { @nsisam.get(response.key) }.to raise_error(NSISam::Errors::Client::KeyNotFoundError)
45
45
  @nsisam.expire = false
46
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nsisam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-27 00:00:00.000000000 Z
12
+ date: 2012-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -188,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
188
  version: '0'
189
189
  segments:
190
190
  - 0
191
- hash: -2778753143086017794
191
+ hash: 4262540204982114394
192
192
  required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements: