ruby-safenet 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/safenet.rb +13 -2
- data/lib/safenet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d00b02e91e4592ae3d4c4d63acad17734a812ce
|
4
|
+
data.tar.gz: fab4d08f04ad8519c8dbd9faa0373b189c000965
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c76956e645f5bc982a83727ecad71fa420a70c356f9b0f6da3199efdcea2247edabb6d92dbfa9c525510ce77367b4b482c52b3f2c09c71ca987444608a876b06
|
7
|
+
data.tar.gz: 36dcd18c48a2231cdfe92e9999493bab02ab77efabe01162f92e87eeb7cbe41dcbae1775c534d6734d15762185f9a49097f7299ccd59c9f77efddf3022329945
|
data/lib/safenet.rb
CHANGED
@@ -98,7 +98,7 @@ module SafeNet
|
|
98
98
|
#
|
99
99
|
# Reference: https://maidsafe.readme.io/docs/auth
|
100
100
|
#
|
101
|
-
def auth
|
101
|
+
def auth
|
102
102
|
# entry point
|
103
103
|
url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/auth"
|
104
104
|
|
@@ -1009,13 +1009,24 @@ module SafeNet
|
|
1009
1009
|
|
1010
1010
|
def read_or_create(name, contents = '', type = 500)
|
1011
1011
|
sd = @client.sd.read(name)
|
1012
|
-
if sd.is_a?(Hash) # doesn't exist
|
1012
|
+
if sd.is_a?(Hash) && (sd["errorCode"] == 404) # doesn't exist
|
1013
1013
|
sd = contents
|
1014
1014
|
@client.sd.create(name, sd, type)
|
1015
1015
|
end
|
1016
|
+
sd
|
1017
|
+
end
|
1016
1018
|
|
1019
|
+
# create or update
|
1020
|
+
def set(name, contents = '', type = 500)
|
1021
|
+
sd = @client.sd.update(name, contents)
|
1022
|
+
if sd.is_a?(Hash) && (sd["errorCode"] == -22) # doesn't exist
|
1023
|
+
sd = @client.sd.create(name, contents)
|
1024
|
+
end
|
1017
1025
|
sd
|
1018
1026
|
end
|
1027
|
+
|
1028
|
+
# aliases
|
1029
|
+
alias_method :get, :read
|
1019
1030
|
end
|
1020
1031
|
|
1021
1032
|
class Immutable
|
data/lib/safenet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-safenet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Loureiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|