pcloud 0.3.0 → 0.3.4
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/CHANGELOG.md +31 -0
- data/README.md +2 -2
- data/lib/pcloud/client.rb +2 -3
- data/lib/pcloud/exceptions.rb +5 -0
- data/lib/pcloud/files/file_handler.rb +9 -11
- data/lib/pcloud/version.rb +1 -1
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7df62eab48d24a93c744f681a6ade3ee5289c95a8908cb08e172e3d00a290055
|
4
|
+
data.tar.gz: f7c3e5c5920de62a07e9881e9803cb3541bff7526ea224ca74b1f42f80c833e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 639b5105fa6035d61d8a66f2db26e56fe8617dad179a1b3bc49d2662a248a94def930ef345cfe37de2abcec1f35ba7ea3d1d492a3cde3b4f326d392428a5aa7f
|
7
|
+
data.tar.gz: a056b1c638006d03ac4bb6e1c6481b02a0fbcf912f81077852e4834573853fde806396a24949d2b528cd04a45e6a97dcb03b393178cb48cc96c26b2e5e8caeca
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### ⚠ BREAKING CHANGES
|
4
|
+
|
5
|
+
* github release action
|
6
|
+
|
7
|
+
### Bug Fixes
|
8
|
+
|
9
|
+
* github release action ([95f59d6](https://github.com/7urkm3n/pcloud/commit/95f59d660ca20ea045bea8b47f25c7e79e6b6cfe))
|
10
|
+
|
11
|
+
## [0.3.4](https://github.com/7urkm3n/pcloud/compare/v0.3.3...v0.3.4) (2023-05-01)
|
12
|
+
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
* release github test ([51ac204](https://github.com/7urkm3n/pcloud/commit/51ac2042e4bab63d2ecf86c801da42da980022a5))
|
17
|
+
* release test\ ([f1b3a22](https://github.com/7urkm3n/pcloud/commit/f1b3a220732a9d9f6a7772dd33b315602c56934b))
|
18
|
+
|
19
|
+
### [0.3.3](https://www.github.com/7urkm3n/pcloud/compare/v0.3.2...v0.3.3) (2023-04-28)
|
20
|
+
|
21
|
+
|
22
|
+
### Bug Fixes
|
23
|
+
|
24
|
+
* json 2.2.0 was giving an issue for Ruby 3. <wrong number of arguments (given 2, expected 1) (ArgumentError)>
|
25
|
+
* and Ruby min req. chnaged to 2.3 and Forwardable version 1.3.3
|
26
|
+
|
27
|
+
### [0.3.2](https://www.github.com/7urkm3n/pcloud/compare/v0.3.1...v0.3.2) (2021-09-05)
|
28
|
+
|
29
|
+
|
30
|
+
### Bug Fixes
|
31
|
+
|
32
|
+
* filehandle error fixed ([45fae7c](https://www.github.com/7urkm3n/pcloud/commit/45fae7c42fd483b86d42c80fd9e6a11619933a40))
|
33
|
+
|
3
34
|
### [0.3.1](https://www.github.com/7urkm3n/pcloud/compare/v0.3.0...v0.3.1) (2021-09-04)
|
4
35
|
|
5
36
|
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ This Gem provides a Ruby interface to [Pcloud.com](https://docs.pcloud.com).
|
|
6
6
|
|
7
7
|
<!-- [](https://rubygems.org/gems/pcloud) -->
|
8
8
|
|
9
|
-
##### Want to contribute? [Doc Link](
|
9
|
+
##### Want to contribute? [Doc Link](CONTRIBUTE.md)
|
10
10
|
|
11
11
|
## Installation and Configuration
|
12
12
|
|
@@ -143,4 +143,4 @@ Pcloud.file.upload(params, payload)
|
|
143
143
|
|
144
144
|
### Supported Ruby versions
|
145
145
|
|
146
|
-
2.
|
146
|
+
2.3+
|
data/lib/pcloud/client.rb
CHANGED
@@ -34,12 +34,11 @@ module Pcloud
|
|
34
34
|
self
|
35
35
|
end
|
36
36
|
|
37
|
-
private
|
38
|
-
|
39
37
|
def request(verb, path, params, payload = {})
|
40
38
|
Pcloud::Request.call(self, verb, path, params, payload)
|
41
39
|
end
|
42
|
-
|
40
|
+
|
41
|
+
private
|
43
42
|
def authorize(options)
|
44
43
|
raise ConfigurationError, :username unless @username
|
45
44
|
raise ConfigurationError, :password unless @password
|
data/lib/pcloud/exceptions.rb
CHANGED
@@ -6,6 +6,11 @@ module Pcloud
|
|
6
6
|
super "missing key `#{key}' in the client configuration"
|
7
7
|
end
|
8
8
|
end
|
9
|
+
class NotFoundError < Error
|
10
|
+
def initialize(key, message)
|
11
|
+
super "not found `#{key}' with value of #{message}"
|
12
|
+
end
|
13
|
+
end
|
9
14
|
class HTTPError < Error
|
10
15
|
def initialize(key, message)
|
11
16
|
super "#{key} Bad request: #{message}"
|
@@ -9,7 +9,7 @@ module Pcloud
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def upload(params, payload)
|
12
|
-
request(:post, 'uploadfile', params, payload)
|
12
|
+
@client.request(:post, 'uploadfile', params, payload)
|
13
13
|
end
|
14
14
|
|
15
15
|
def download(params)
|
@@ -22,30 +22,28 @@ module Pcloud
|
|
22
22
|
destination = params[:destination] || '.'
|
23
23
|
filename = params[:filename] || nil
|
24
24
|
if !filename
|
25
|
-
stat = request(:get, "stat", {fileid: params[:fileid]})
|
25
|
+
stat = @client.request(:get, "stat", {fileid: params[:fileid]})
|
26
|
+
raise NotFoundError.new(:fileid, params[:fileid]) if stat[:error]
|
26
27
|
filename = stat[:metadata][:name]
|
27
28
|
end
|
28
|
-
File.write("#{destination}/#{filename}", request(:get, "gettextfile", {fileid: params[:fileid], raw: true}))
|
29
|
-
end
|
29
|
+
File.write("#{destination}/#{filename}", @client.request(:get, "gettextfile", {fileid: params[:fileid], raw: true}))
|
30
|
+
end
|
30
31
|
|
31
32
|
def download_folder(params)
|
32
|
-
data = request(:get, "listfolder", {folderid: params[:folderid]})
|
33
|
+
data = @client.request(:get, "listfolder", {folderid: params[:folderid]})
|
34
|
+
raise NotFoundError.new(:folderid, params[:folderid]) if data[:error]
|
35
|
+
|
33
36
|
destination = params[:destination] || '.'
|
34
37
|
folder_name = params[:filename] || data[:metadata][:name] << ".zip"
|
35
38
|
stringio = Zip::OutputStream::write_buffer do |zio|
|
36
39
|
data[:metadata][:contents].each do |content|
|
37
40
|
zio.put_next_entry(content[:name])
|
38
|
-
zio.write(request(:get, "gettextfile", {fileid: content[:fileid], raw: true}))
|
41
|
+
zio.write(@client.request(:get, "gettextfile", {fileid: content[:fileid], raw: true}))
|
39
42
|
end
|
40
43
|
end
|
41
44
|
stringio.rewind #reposition buffer pointer to the beginning
|
42
45
|
File.new("#{destination}/#{folder_name}","wb").write(stringio.sysread) #write buffer to zipfile
|
43
46
|
end
|
44
47
|
|
45
|
-
private
|
46
|
-
|
47
|
-
def request(verb, path, params, payload = {})
|
48
|
-
Pcloud::Request.call(@client, verb, path, params, payload)
|
49
|
-
end
|
50
48
|
end
|
51
49
|
end
|
data/lib/pcloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rovshen Gurdov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -30,28 +30,34 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: '2.6'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.6.3
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
43
|
+
version: '2.6'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.6.3
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: forwardable
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.3.
|
53
|
+
version: 1.3.3
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.3.
|
60
|
+
version: 1.3.3
|
55
61
|
description: Pcloud is cloud storage upload/download/share from pcloud.com. Please,
|
56
62
|
check available methods in Github Doc...
|
57
63
|
email:
|
@@ -87,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
93
|
requirements:
|
88
94
|
- - ">="
|
89
95
|
- !ruby/object:Gem::Version
|
90
|
-
version: '2.
|
96
|
+
version: '2.3'
|
91
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
98
|
requirements:
|
93
99
|
- - ">="
|