pcloud_api 0.2.4 → 0.2.6

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
  SHA256:
3
- metadata.gz: 45e0e46ad9b58dd65f1ce2674c247fd72377fcb376bec9bdc29b3cb285216519
4
- data.tar.gz: 25a81544a107633c7c3c4459a1ab0f3e7c1a4c6092d5231b59a22ccbce55bb9b
3
+ metadata.gz: ddb7ab4e9ddf45d66ead43518d8861e5191bbdfad4e7d09a9eda71454e26551b
4
+ data.tar.gz: b9c8a06e55cf0e964f6350e914dd0639e0cc0e1e1222cef15cb4bf695bdf32e3
5
5
  SHA512:
6
- metadata.gz: dd0a131f94f7aec6ec700ad46ade522d37248d5475a23290d46b20f51025a5fd4043ccaf642fecdaeb387ef3cc85811282d0a52436dca6bdab1d8cbf23927211
7
- data.tar.gz: 7597d199d6795c480d0b346ed021845993ad3f0bdd01fa9e6df1b129324c12c61dc181fa36f8990d85916016330d389413e6b6bdbeabb373c455e1ff4f3a1dfb
6
+ metadata.gz: e159b3d7a59bee451e7fd56d28eb0970e4bb07457fd6769d9c2d64cb95f0dba609b893b870ab2374e6562ecb9d8f45d455c51e2efc7beb8c1345f7f3b1ecbd31
7
+ data.tar.gz: 1aafb9f267c8f899e6241d102c3d14a5121863c9a99b82f7eeebbec2e2fdc57c9f9557278a1219913b9e50d7e55165731261ec55dc1dd7fea051fb4aa09022a1
data/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
- ## 0.2.3 2021-12-14
1
+ ## 0.2.6 2024-06-09
2
+
3
+ **Bugfix**
4
+ 1. Added a missing `require "time"` statement that resulted in errors for folks building and testing the gem locally. This should not affect production behavior.
5
+
6
+ ## 0.2.5 2023-05-05
7
+
8
+ **Bugfix**
9
+ 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.
10
+
11
+ ## 0.2.4 2023-05-05
2
12
 
3
13
  **Changes**
4
14
  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/RELEASEING.md CHANGED
@@ -4,4 +4,5 @@
4
4
  3. Tag a new release in GitHub and summarize the changes since the last release.
5
5
  4. Build the gem locally: `gem build pcloud_api.gemspec`.
6
6
  * To test the gem in a local project, you can install it with `gem install --local pcloud_api-<VERSION>.gem`
7
+ * Make sure to update your `Gemfile` to point at the path where you built the gem, i.e. `gem "pcloud_api", path: "~/src/pcloud_api/"`
7
8
  5. Publish the gem to rubygems.org: `gem push pcloud_api-<VERSION>.gem`.
@@ -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"], # no content comes back from this api
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
@@ -1,3 +1,3 @@
1
1
  module Pcloud
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.6"
3
3
  end
data/lib/pcloud_api.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "httparty"
2
2
  require "tzinfo"
3
3
  require "json"
4
+ require "time"
4
5
 
5
6
  require "pcloud/version"
6
7
  require "pcloud/time_helper"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pcloud_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hunsche Jones
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-05 00:00:00.000000000 Z
11
+ date: 2024-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.3.26
152
+ rubygems_version: 3.5.3
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: A Ruby library for interacting with the pCloud API