pcloud_api 0.2.4 → 0.2.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 +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +1 -1
- data/lib/pcloud/folder/parser.rb +34 -1
- data/lib/pcloud/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8ed06d335251156478a9586f19c12ecb73cd3dd11a2ad2383cafdb3383210ad
|
4
|
+
data.tar.gz: 24e8bd133fb1f66e01293d06bc9eb1aa074849f7b51fbd16b6fe834437e52964
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9b4602cd3f54dd51914921c821c6c6fb916b7db2b64c76f88252b788ebd77f446d16e3bbc59f7ec6903f51267e38cdd0ca3418304f7064449cea923c00d914e
|
7
|
+
data.tar.gz: b752ef69113418aa2e2480f858173fb24e2721d75721a0518e44eb5cc548e970ebfb732f2095339acc361955be8d32d6af620280e4b8d4e4d03d71a9c9b4199b
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
## 0.2.
|
1
|
+
## 0.2.5 2023-05-05
|
2
|
+
|
3
|
+
**Bugfix**
|
4
|
+
1. When passing the optipnal `recursive: true` on `Pcloud::Folder#find` or `Pcloud::Folder#find_by` methods to load all the folders contents recursively in v0.2.4, recursive contents were not correctly parsed into objects. This release fixes that bug so that the recursive file tree is all `Pcloud::File` and `Pcloud::Folder` objects.
|
5
|
+
|
6
|
+
## 0.2.4 2023-05-05
|
2
7
|
|
3
8
|
**Changes**
|
4
9
|
1. You can now specify `recursive: true` on `Pcloud::Folder#find` and `Pcloud::Folder#find_by` methods to load all the folders contents recursively. Note that this may result in long request times for folders with many items in them.
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ The `Pcloud::Client` can be configured by directly calling the `Pcloud::Client.c
|
|
40
40
|
```ruby
|
41
41
|
Pcloud::Client.configure(
|
42
42
|
access_token: "your-pcloud-app-access-token",
|
43
|
-
data_region: "EU"
|
43
|
+
data_region: "EU",
|
44
44
|
timeout_seconds: 8 # optional integer, defaults to 8 seconds if not specified
|
45
45
|
)
|
46
46
|
```
|
data/lib/pcloud/folder/parser.rb
CHANGED
@@ -23,7 +23,7 @@ module Pcloud
|
|
23
23
|
path: content_item["path"], # no path comes back from this api
|
24
24
|
name: content_item["name"],
|
25
25
|
parent_folder_id: content_item["parentfolderid"],
|
26
|
-
contents: content_item["contents"], #
|
26
|
+
contents: recursively_parse_contents(content_item["contents"]), # this can be `nil` if recursive is false
|
27
27
|
is_deleted: content_item["isdeleted"],
|
28
28
|
created_at: content_item["created"],
|
29
29
|
modified_at: content_item["modified"]
|
@@ -45,6 +45,39 @@ module Pcloud
|
|
45
45
|
end
|
46
46
|
)
|
47
47
|
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def recursively_parse_contents(contents)
|
52
|
+
return nil if contents.nil?
|
53
|
+
contents.map do |content_item|
|
54
|
+
if content_item["isfolder"]
|
55
|
+
Pcloud::Folder.new(
|
56
|
+
id: content_item["folderid"],
|
57
|
+
path: content_item["path"], # no path comes back from this api
|
58
|
+
name: content_item["name"],
|
59
|
+
parent_folder_id: content_item["parentfolderid"],
|
60
|
+
contents: recursively_parse_contents(content_item["contents"]),
|
61
|
+
is_deleted: content_item["isdeleted"],
|
62
|
+
created_at: content_item["created"],
|
63
|
+
modified_at: content_item["modified"]
|
64
|
+
)
|
65
|
+
else
|
66
|
+
Pcloud::File.new(
|
67
|
+
id: content_item["fileid"],
|
68
|
+
path: content_item["path"],
|
69
|
+
name: content_item["name"],
|
70
|
+
content_type: content_item["contenttype"],
|
71
|
+
category_id: content_item["category"],
|
72
|
+
size: content_item["size"],
|
73
|
+
parent_folder_id: content_item["parentfolderid"],
|
74
|
+
is_deleted: content_item["isdeleted"],
|
75
|
+
created_at: content_item["created"],
|
76
|
+
modified_at: content_item["modified"]
|
77
|
+
)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
48
81
|
end
|
49
82
|
end
|
50
83
|
end
|
data/lib/pcloud/version.rb
CHANGED