ruby-safenet 0.5.4 → 0.5.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d00b02e91e4592ae3d4c4d63acad17734a812ce
4
- data.tar.gz: fab4d08f04ad8519c8dbd9faa0373b189c000965
3
+ metadata.gz: b1ea51a1265525fe0511ecd9595f911cd5aa495a
4
+ data.tar.gz: 5e766bd9499b2b6dfa18344410d9102799a08a77
5
5
  SHA512:
6
- metadata.gz: c76956e645f5bc982a83727ecad71fa420a70c356f9b0f6da3199efdcea2247edabb6d92dbfa9c525510ce77367b4b482c52b3f2c09c71ca987444608a876b06
7
- data.tar.gz: 36dcd18c48a2231cdfe92e9999493bab02ab77efabe01162f92e87eeb7cbe41dcbae1775c534d6734d15762185f9a49097f7299ccd59c9f77efddf3022329945
6
+ metadata.gz: a978d7cab5d727ac2d59843da5d4077f3b7d4afa3badc08d3229518634827c85f0427786e49e2c386fea2f01a945c39789ca0a2e2c90e173aaff5e6dd5306d68
7
+ data.tar.gz: ead1b8fab8d9a6e0ce53d9f53a74be2beb0083f23b92e5e905dfb8c8417589ddafaf83086299735e8f72f100d6053c21f1677b53b60930a82361506d5ff81785
data/README.md CHANGED
@@ -158,6 +158,7 @@ puts contents
158
158
  |nfs|delete_directory|dir_path (_string_)|root_path ("_app_" or "_drive_")|https://maidsafe.readme.io/docs/nfs-create-directory|
159
159
  |nfs|create_file|file_path (_string_), contents (_string_ \| _binary_)|root_path ("_app_" or "_drive_"), meta (_string_), content_type (_string_)|https://maidsafe.readme.io/docs/nfsfile|
160
160
  |nfs|get_file|file_path (_string_)|root_path ("_app_" or "_drive_"), offset (_int_), length (_int_), range (eg. "bytes 0-1000")|https://maidsafe.readme.io/docs/nfs-get-file|
161
+ |nfs|move_file|||https://api.safedev.org/nfs/file/move-file.html|
161
162
  |nfs|rename_file|file_path (_string_), new_name (_string_)|root_path ("_app_" or "_drive_"), meta (_string_)|* Alias to "update_file_meta"|
162
163
  |nfs|update_file_meta|file_path (_string_)|root_path ("_app_" or "_drive_"), meta (_string_), name (_string_)|https://maidsafe.readme.io/docs/nfs-update-file-metadata|
163
164
  |nfs|delete_file|file_path (_string_)|root_path ("_app_" or "_drive_")|https://maidsafe.readme.io/docs/nfs-delete-file|
@@ -1,3 +1,3 @@
1
1
  module Safenet
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
data/lib/safenet.rb CHANGED
@@ -494,6 +494,31 @@ module SafeNet
494
494
  end
495
495
 
496
496
 
497
+ # Move or copy a file
498
+ def move_file(src_root_path, src_path, dst_root_path, dst_path, action = 'move')
499
+ # Entry point
500
+ url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/nfs/movefile"
501
+
502
+ # Payload
503
+ payload = {}
504
+ payload["srcRootPath"] = src_root_path # 'app' or 'drive'
505
+ payload["srcPath"] = src_path
506
+ payload["destRootPath"] = dst_root_path # 'app' or 'drive'
507
+ payload["destPath"] = dst_path
508
+ payload["action"] = action
509
+
510
+ # API call
511
+ uri = URI(url)
512
+ http = Net::HTTP.new(uri.host, uri.port)
513
+ req = Net::HTTP::Post.new(uri.path, {
514
+ 'Authorization' => "Bearer #{@client.key_helper.get_valid_token()}",
515
+ 'Content-Type' => 'application/json'
516
+ })
517
+ req.body = payload.to_json
518
+ res = http.request(req)
519
+ res.code == "200" ? true : JSON.parse(res.body)
520
+ end
521
+
497
522
  #
498
523
  # Delete a file.
499
524
  # Only authorised requests can invoke the API.
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
4
+ version: 0.5.5
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-03-10 00:00:00.000000000 Z
11
+ date: 2017-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler