nsisam 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/nsisam/client.rb +16 -3
  3. data/nsisam.gemspec +1 -1
  4. metadata +16 -16
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.8
data/lib/nsisam/client.rb CHANGED
@@ -9,6 +9,8 @@ module NSISam
9
9
  #
10
10
  # @param [String] url the SAM node url
11
11
  # @return [Client] the object itself
12
+ # @example
13
+ # nsisam = NSISam::Client.new 'http://user:pass@ip:port/'
12
14
  def initialize(url)
13
15
  user_and_pass = url.match(/(\w+):(\w+)/)
14
16
  @user, @password = user_and_pass[1], user_and_pass[2]
@@ -21,7 +23,9 @@ module NSISam
21
23
  # @param [String] data the desired data to store
22
24
  # @return [Hash] response with the data key and checksum
23
25
  # * "key" [String] the key to access the stored data
24
- # * "checksum" [String] the sha1 checksum of the stored data
26
+ # * "checksum" [String] the sha1 checksum of the stored data
27
+ # @example
28
+ # nsisam.store("something")
25
29
  def store(data)
26
30
  request_data = {:value => data}.to_json
27
31
  request = prepare_request :PUT, request_data
@@ -32,7 +36,10 @@ module NSISam
32
36
  #
33
37
  # @param [Sring] key of the value to delete
34
38
  # @return [Hash] response
35
- # * "deleted" [Boolean] true if the key was sucefully deleted
39
+ # * "deleted" [Boolean] true if the key was successfully deleted
40
+ # @raise [NSISam::Errors::Client::KeyNotFoundError] When the key doesn't exists
41
+ # @example Deleting an existing key
42
+ # nsisam.delete("some key")
36
43
  def delete(key)
37
44
  request_data = {:key => key}.to_json
38
45
  request = prepare_request :DELETE, request_data
@@ -46,6 +53,9 @@ module NSISam
46
53
  # * "from_user" [String] the user who stored the value
47
54
  # * "date" [String] the date when the value was stored
48
55
  # * "data" [String, Hash, Array] the data stored at that key
56
+ # @raise [NSISam::Errors::Client::KeyNotFoundError] When the key doesn't exists
57
+ # @example
58
+ # nsisam.get("some key")
49
59
  def get(key)
50
60
  request_data = {:key => key}.to_json
51
61
  request = prepare_request :GET, request_data
@@ -56,9 +66,12 @@ module NSISam
56
66
  #
57
67
  # @param [String] key of the data to update
58
68
  # @param [String, Hash, Array] data to be stored at the key
59
- # return [Hash] response
69
+ # @return [Hash] response
60
70
  # * "key" [String] just to value key again
61
71
  # * "checksum" [String] the new sha1 checksum of the key's data
72
+ # @raise [NSISam::Errors::Client::KeyNotFoundError] When the key doesn't exists
73
+ # @example
74
+ # nsisam.update("my key", "my value")
62
75
  def update(key, value)
63
76
  request_data = {:key => key, :value => value}.to_json
64
77
  request = prepare_request :POST, request_data
data/nsisam.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "nsisam"
8
- s.version = "0.2.7"
8
+ s.version = "0.2.8"
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"]
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.2.7
4
+ version: 0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &17065580 !ruby/object:Gem::Requirement
16
+ requirement: &13220200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *17065580
24
+ version_requirements: *13220200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sinatra
27
- requirement: &17064960 !ruby/object:Gem::Requirement
27
+ requirement: &13775780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *17064960
35
+ version_requirements: *13775780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &17064220 !ruby/object:Gem::Requirement
38
+ requirement: &13775140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *17064220
46
+ version_requirements: *13775140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yard
49
- requirement: &17063600 !ruby/object:Gem::Requirement
49
+ requirement: &13774500 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *17063600
57
+ version_requirements: *13774500
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &17063020 !ruby/object:Gem::Requirement
60
+ requirement: &13773540 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 2.8.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *17063020
68
+ version_requirements: *13773540
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &17062340 !ruby/object:Gem::Requirement
71
+ requirement: &13772660 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *17062340
79
+ version_requirements: *13772660
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: jeweler
82
- requirement: &17061800 !ruby/object:Gem::Requirement
82
+ requirement: &13771920 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 1.8.3
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *17061800
90
+ version_requirements: *13771920
91
91
  description: ! "A simple gem to access a SAM node. For more info about SAM\n visit
92
92
  www.github.com/nsi-iff/sam_buildout."
93
93
  email: d.camata@gmail.com
@@ -126,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: -2979948941930370823
129
+ hash: 934113303097294613
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements: