nsisam 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.3
1
+ 0.6.4
@@ -4,19 +4,22 @@ require File.dirname(__FILE__) + '/response'
4
4
 
5
5
  module NSISam
6
6
  class FakeClient
7
+
8
+ attr_accessor :expire
9
+
7
10
  def initialize
8
11
  @storage = {}
9
12
  end
10
13
 
11
14
  def store(data)
12
15
  key = Time.now.to_i.to_s
13
- @storage[key] = JSON.load(data.to_json)
16
+ @storage[key] = JSON.load(data.to_json) unless @expire
14
17
  Response.new 'key' => key, 'checksum' => 0
15
18
  end
16
19
 
17
20
  def store_file(file, type=:file)
18
21
  key = Time.now.to_i.to_s
19
- @storage[key] = {type.to_s => Base64.encode64(file)}.to_json
22
+ @storage[key] = {type.to_s => Base64.encode64(file)}.to_json unless @expire
20
23
  Response.new "key" => key, "checksum" => 0
21
24
  end
22
25
 
@@ -48,8 +51,12 @@ module NSISam
48
51
 
49
52
  def update(key, value)
50
53
  if @storage.has_key?(key)
51
- @storage[key] = value
52
- Response.new 'key' => key, 'checksum' => 0
54
+ if @expire
55
+ @storage.delete(key)
56
+ else
57
+ @storage[key] = value
58
+ end
59
+ Response.new 'key' => key, 'checksum' => 0
53
60
  else
54
61
  raise NSISam::Errors::Client::KeyNotFoundError
55
62
  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.6.3"
8
+ s.version = "0.6.4"
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-04"
12
+ s.date = "2012-09-06"
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 = [
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.6.3
4
+ version: 0.6.4
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-04 00:00:00.000000000 Z
12
+ date: 2012-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  segments:
174
174
  - 0
175
- hash: -2000685296802539724
175
+ hash: 1859438398968231153
176
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  none: false
178
178
  requirements: