ruby-safenet 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +23 -4
- data/lib/safenet/version.rb +1 -1
- data/lib/safenet.rb +10 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a3aaf208f93f8c870707fc7a0708a59cc8f3fa1
|
4
|
+
data.tar.gz: 4b761d4aefa387c4f2f10d841791a15d38ae24ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f6e198c3ca9d0886c4623453fce84dbbf1562dec157a7d1fc34cca107a3abae80343ef98e7909b867cd59328471a48ffe5688433bb4ac1cb11dfa520de35eb2
|
7
|
+
data.tar.gz: 6d5690268fa7543968ee7a9d962cf6546aaab115db0e54b31b89ef2da30ab44414a1ff0851773fdaa51f07e0aca863a7cc748777dca0a653ba63040435eba433
|
data/README.md
CHANGED
@@ -12,15 +12,34 @@ A Ruby library for accessing the SAFE network
|
|
12
12
|
require "safenet"
|
13
13
|
|
14
14
|
SafeNet.set_app_info({
|
15
|
-
name: "Demo App",
|
15
|
+
name: "Ruby Demo App",
|
16
16
|
version: "0.0.1",
|
17
|
-
vendor: "
|
18
|
-
id: "org.
|
17
|
+
vendor: "Vendor's Name",
|
18
|
+
id: "org.thevendor.demo",
|
19
19
|
})
|
20
20
|
|
21
21
|
SafeNet.create_directory("/mydir")
|
22
|
-
SafeNet.file("/mydir/index.html")
|
22
|
+
SafeNet.file("/mydir/index.html", is_private: false)
|
23
23
|
SafeNet.update_file_content("/mydir/index.html", "Hello world!<br>I'm a webpage :D")
|
24
24
|
SafeNet.register_service("mywonderfulapp", "www", "/mydir")
|
25
25
|
SafeNet.get_file("/mydir/index.html")
|
26
26
|
```
|
27
|
+
|
28
|
+
*Upload / Download:*
|
29
|
+
```ruby
|
30
|
+
# upload
|
31
|
+
SafeNet.file("/mydir/dog.jpg")
|
32
|
+
SafeNet.update_file_content("/mydir/dog.jpg", File.read("/home/daniel/Pictures/dog.jpg"))
|
33
|
+
|
34
|
+
# download
|
35
|
+
File.open("/home/daniel/Pictures/dog-new.jpg", "w") do |file|
|
36
|
+
file.write(SafeNet.get_file("/mydir/dog.jpg"))
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
*Directory's file list:*
|
41
|
+
```ruby
|
42
|
+
SafeNet.get_directory("/mydir")["files"].each do |file|
|
43
|
+
puts file["name"]
|
44
|
+
end
|
45
|
+
```
|
data/lib/safenet/version.rb
CHANGED
data/lib/safenet.rb
CHANGED
@@ -8,10 +8,10 @@ module SafeNet
|
|
8
8
|
require "cgi" # CGI.escape method
|
9
9
|
|
10
10
|
# default values
|
11
|
-
@@NAME = "Demo App"
|
11
|
+
@@NAME = "Ruby Demo App"
|
12
12
|
@@VERSION = "0.0.1"
|
13
|
-
@@VENDOR = "
|
14
|
-
@@ID = "org.
|
13
|
+
@@VENDOR = "Vendor's Name"
|
14
|
+
@@ID = "org.thevendor.demo"
|
15
15
|
@@LAUCHER_SERVER = "http://localhost:8100/"
|
16
16
|
@@CONF_PATH = File.join(File.expand_path('..', __FILE__), "conf.json")
|
17
17
|
|
@@ -120,9 +120,9 @@ module SafeNet
|
|
120
120
|
# payload
|
121
121
|
payload = {
|
122
122
|
filePath: file_path,
|
123
|
-
isPrivate: options[:is_private],
|
124
|
-
isVersioned: options[:is_versioned],
|
125
|
-
isPathShared: options[:is_path_shared]
|
123
|
+
isPrivate: options[:is_private].to_s,
|
124
|
+
isVersioned: options[:is_versioned].to_s,
|
125
|
+
isPathShared: options[:is_path_shared].to_s
|
126
126
|
}
|
127
127
|
|
128
128
|
# optional
|
@@ -154,9 +154,9 @@ module SafeNet
|
|
154
154
|
# payload
|
155
155
|
payload = {
|
156
156
|
dirPath: dir_path,
|
157
|
-
isPrivate: options[:is_private],
|
158
|
-
isVersioned: options[:is_versioned],
|
159
|
-
isPathShared: options[:is_path_shared]
|
157
|
+
isPrivate: options[:is_private].to_s,
|
158
|
+
isVersioned: options[:is_versioned].to_s,
|
159
|
+
isPathShared: options[:is_path_shared].to_s
|
160
160
|
}
|
161
161
|
|
162
162
|
# optional
|
@@ -283,7 +283,7 @@ module SafeNet
|
|
283
283
|
longName: long_name,
|
284
284
|
serviceName: service_name,
|
285
285
|
serviceHomeDirPath: service_home_dir_path,
|
286
|
-
isPathShared: options[:is_path_shared]
|
286
|
+
isPathShared: options[:is_path_shared].to_s
|
287
287
|
}
|
288
288
|
|
289
289
|
# optional
|