ruby-safenet 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94714d427465750270f13a62a14d9a59da099c18
4
- data.tar.gz: 78a16709f15a9ff9eaab4208d610b622f72850c5
3
+ metadata.gz: 4a3aaf208f93f8c870707fc7a0708a59cc8f3fa1
4
+ data.tar.gz: 4b761d4aefa387c4f2f10d841791a15d38ae24ee
5
5
  SHA512:
6
- metadata.gz: 7bc87dc547b3f5d5b66e4c337e9470c6720cceecd84a59f623ba0f46bb82f8e5f58e609324a916ab6f37c104e38bb75b681d224c3908a7ba32488550cf80cc5f
7
- data.tar.gz: 7e38c246363bff2e5f75695c593f9a2caf33ac4ed83e60a36a472f53917fd81068c1aedf22b59d4ed31cb3aabaa09efc2cda0faaeed6b8ec8b375175d84719c5
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: "maidsafe",
18
- id: "org.maidsafe.demo",
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
+ ```
@@ -1,3 +1,3 @@
1
1
  module Safenet
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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 = "maidsafe"
14
- @@ID = "org.maidsafe.demo"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-safenet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Loureiro