pcloud_api 0.2.2 → 0.2.4

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: 9fc8c976ed07fce0322907df07ed86d464b5924e6fb465aaa2bc5154b5fe95e8
4
- data.tar.gz: e86aaee5ef4453da35281d3d3840078dfc639552c8913de6f4389a571e862256
3
+ metadata.gz: 45e0e46ad9b58dd65f1ce2674c247fd72377fcb376bec9bdc29b3cb285216519
4
+ data.tar.gz: 25a81544a107633c7c3c4459a1ab0f3e7c1a4c6092d5231b59a22ccbce55bb9b
5
5
  SHA512:
6
- metadata.gz: a75daa528c2c263b4f5e1e2f57e81090a440c391860ef5bfc714967156cfe5b289c1b3d644428f5213e13c60fabca6745263d7cc6c7ba77c800d6177d8e1a888
7
- data.tar.gz: 520875db136cfb2961b8bdee6f9948af3701aaef3eb318860ec7b7b018fd7ac500edc27ea0581765ce5e63e948dea842bd7a94a85ba3279323ec14fa21d91915
6
+ metadata.gz: dd0a131f94f7aec6ec700ad46ade522d37248d5475a23290d46b20f51025a5fd4043ccaf642fecdaeb387ef3cc85811282d0a52436dca6bdab1d8cbf23927211
7
+ data.tar.gz: 7597d199d6795c480d0b346ed021845993ad3f0bdd01fa9e6df1b129324c12c61dc181fa36f8990d85916016330d389413e6b6bdbeabb373c455e1ff4f3a1dfb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.2.3 2021-12-14
2
+
3
+ **Changes**
4
+ 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.
5
+ 2. You can now configure the pCloud API read and connect timeouts via a new `timeout_seconds` argument to `Pcloud::Client.configure()`. The previous way to set this value via a `PCLOUD_API_TIMEOUT_SECONDS` environment variable continues to work as before.
6
+
7
+ ## 0.2.3 2021-12-14
8
+
9
+ **Changes**
10
+ 1. `Pcloud::File`'s `upload` method no longer requires a `:filename` param, since pCloud just reads it off of the file object and ignores the param anyway
11
+ 2. Both `Pcloud::File` and `Pcloud::Folder`'s `update` and `update!` methods now allow either partial paths _(starting and ending with slashes)_ or full paths. This is a little more dangerous if you specify a full path and you meant partial, but it's a reasonable use case to support.
12
+
1
13
  ## 0.2.2 2021-10-09
2
14
 
3
15
  **Changes**
data/README.md CHANGED
@@ -1,15 +1,17 @@
1
1
  # pCloud API
2
2
 
3
3
  [![CI](https://github.com/jhunschejones/pcloud_api/actions/workflows/ci.yml/badge.svg)](https://github.com/jhunschejones/pcloud_api/actions/workflows/ci.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/pcloud_api.svg)](https://badge.fury.io/rb/pcloud_api)
5
+ [![Gem Downloads](https://badgen.net/rubygems/dt/pcloud_api)](https://rubygems.org/gems/pcloud_api)
4
6
 
5
- The `pcloud_api` gem provides an intuitive Ruby interface for interacting with the [pCloud API](https://docs.pcloud.com/) using OAuth2. This gem does not attempt to replicate the entire functionality of the pCloud API but rather to provide quick and easy access for its most basic and common functionality. If you are looking for a lower-level pCloud API wrapper, [`pcloud`](https://github.com/7urkm3n/pcloud) might be a better fit for you.
7
+ The `pcloud_api` gem provides an intuitive Ruby interface for interacting with the [pCloud API](https://docs.pcloud.com/) using OAuth2. This gem does not attempt to replicate the entire functionality of the pCloud API but rather to provide quick and easy access for its most important functionality. If you are looking for a lower-level pCloud API wrapper, [`pcloud`](https://github.com/7urkm3n/pcloud) might be a better fit for you.
6
8
 
7
9
  ## Installation
8
10
 
9
11
  Add this line to your application's Gemfile:
10
12
 
11
13
  ```ruby
12
- gem 'pcloud_api'
14
+ gem "pcloud_api"
13
15
  ```
14
16
 
15
17
  And then execute:
@@ -28,6 +30,10 @@ Or install it yourself as:
28
30
 
29
31
  ## Usage
30
32
 
33
+ ### Generating an access token
34
+
35
+ To use the `pcloud_api` client, you will need to first generate an access token. You may do this by cloning and running the script in [`./bin/generate_access_token`](https://github.com/jhunschejones/pcloud_api/blob/master/bin/generate_access_token). It will take you through the process of setting up a pCloud app and completing the OAuth2 flow in the browser.
36
+
31
37
  ### Configuration
32
38
 
33
39
  The `Pcloud::Client` can be configured by directly calling the `Pcloud::Client.configure` method in an initializer or somewhere else in your code at startup:
@@ -35,6 +41,7 @@ The `Pcloud::Client` can be configured by directly calling the `Pcloud::Client.c
35
41
  Pcloud::Client.configure(
36
42
  access_token: "your-pcloud-app-access-token",
37
43
  data_region: "EU"
44
+ timeout_seconds: 8 # optional integer, defaults to 8 seconds if not specified
38
45
  )
39
46
  ```
40
47
 
@@ -46,43 +53,54 @@ There are two main objects represented in the library, `Pcloud::File` and `Pclou
46
53
 
47
54
  The `Pcloud::File` API includes:
48
55
  ```ruby
49
- # Find files by file id or path:
56
+ # Find files by file :id or :path:
50
57
  Pcloud::File.find(1)
51
58
  Pcloud::File.find_by(path: "/images/jack_the_cat.jpg")
52
- # NOTE: find_by can also be used with :id, though this will take precedence
53
- # over :path so just pick one or the other
54
-
55
- # Check if a file exists by id
59
+ # NOTES:
60
+ # - `find_by` can also be used with :id, though this will take precedence over
61
+ # :path so pick only one or the other
62
+ # - Both `find` and `find_by` take an optional `recursive: true` argument which
63
+ # will recursively load all the folders contents. NOTE: this may result in
64
+ # long request times for folders with many items in them.
65
+
66
+ # Check if a file exists by :id
56
67
  Pcloud::File.exists?(1)
57
68
 
58
69
  # Upload a new file, rename if one already exists with this name:
59
70
  Pcloud::File.upload(
60
- folder_id: 1,
61
- filename: "jack_goes_swimming.mp4",
71
+ path: "/Jack",
62
72
  file: File.open("/Users/joshua/Downloads/jack_goes_swimming.mp4")
63
73
  )
64
- # NOTE: the upload method will allow you to specify the :path or the :folder_id
65
- # or you can choose to pass neither paramenter and your files will be placed
66
- # in your root pCloud directory.
67
74
 
68
- # Upload a file, force overwrite of existing file:
75
+ # Upload a file, force overwrite if a file already exists with this name:
69
76
  Pcloud::File.upload!(
70
- folder_id: 1,
71
- filename: "jack_goes_swimming.mp4",
77
+ path: "/Jack",
72
78
  file: File.open("/Users/joshua/Downloads/jack_goes_swimming.mp4")
73
79
  )
74
80
 
81
+ # NOTE:
82
+ # The `upload` and `upload!` methods will allow you to specify either the :path
83
+ # or the :folder_id of the target parent directory, or you can choose to pass
84
+ # neither paramenter and your files will be placed in your root pCloud
85
+ # directory by default.
86
+
75
87
  # Rename a file:
76
88
  jack_goes_swimming.update(name: "That's one wet cat.mp4")
77
89
 
78
- # Move a file by updating the parent_folder_id or path:
90
+ # Move a file by updating the :parent_folder_id:
79
91
  jack_goes_swimming.update(parent_folder_id: 9000)
80
92
 
93
+ # Move a file by specifying the parent folder part of the path:
94
+ jack_goes_swimming.update(path: "/photos/") # NOTE: needs to start and end with slashes
95
+
96
+ # Move a file by specifying the entire new file path:
97
+ jack_goes_swimming.update(path: "/photos/jack_goes_swimming.mp4")
98
+
81
99
  # Delete a file:
82
100
  jack_goes_swimming.delete
83
101
 
84
102
  # Get a link to download a file:
85
- jack_goes_swimming.download_link
103
+ jack_goes_swimming.download_url
86
104
 
87
105
  # Access the parent folder of a file:
88
106
  jack_goes_swimming.parent_folder
@@ -90,27 +108,38 @@ jack_goes_swimming.parent_folder
90
108
 
91
109
  The `Pcloud::Folder` API is very similar:
92
110
  ```ruby
93
- # Find folders by folder id or path:
111
+ # Find folders by folder :id or :path:
94
112
  Pcloud::Folder.find(1)
95
113
  Pcloud::Folder.find_by(path: "/images")
96
- # NOTE: find_by can also be used with :id, though this will take precedence
97
- # over :path so just pick one or the other
114
+ # NOTES:
115
+ # - `find_by` can also be used with :id, though this will take precedence over :path so pick only one or the other
116
+ # - When using :path the folder object will have a `path` value, when finding by :id, `path` will be `nil`
98
117
 
99
118
  # Check if a folder exists by id
100
119
  Pcloud::Folder.exists?(1)
101
120
 
102
- # Create a new folder by parent_folder_id and name:
121
+ # Create a new folder by :parent_folder_id and :name:
103
122
  Pcloud::Folder.first_or_create(parent_folder_id: 9000, name: "jack")
104
123
 
105
- # Create a new folder by path:
124
+ # Create a new folder by :path (parent directory must already exist):
106
125
  Pcloud::Folder.first_or_create(path: "/images/jack")
107
126
 
108
127
  # Rename a folder:
109
128
  jack_images.update(name: "Jack's Photo Library")
110
129
 
111
- # Move a folder by updating the parent_folder_id or path:
130
+ # Move a folder by updating the :parent_folder_id:
112
131
  jack_images.update(parent_folder_id: 9000)
113
132
 
133
+ # Move a folder by specifying the parent folder part of the path:
134
+ jack_images.update(path: "/photos/")
135
+ # NOTES:
136
+ # - Partial paths must start and end with slashes
137
+ # - All refrenced parent directories in the path must already exist
138
+
139
+ # Move a folder by specifying the entire new file path:
140
+ jack_images.update(path: "/photos/images/jack")
141
+ # NOTE: All refrenced parent directories in the path must already exist
142
+
114
143
  # Delete an empty folder:
115
144
  jack_images.delete
116
145
 
@@ -124,12 +153,12 @@ jack_images.parent_folder
124
153
  jack_images.contents
125
154
  ```
126
155
 
127
- **Aside: path vs id**
156
+ **Params: path vs id**
128
157
 
129
- pCloud recommends using the `folder_id`, `parent_folder_id` or `file_id` params for API calls whenever possible, rather using an exact path. Folder and file ids are static, so this will make your code less brittle to changes in the file/folder tree. You can simply look up the id for a folder in the console ahead of time and then set it in your code, similar to how you would specify an AWS S3 bucket.
158
+ pCloud recommends using the `folder_id`, `parent_folder_id` or `file_id` params for API calls whenever possible, rather than using an exact path. Folder and file ids are static, so this will make your code less brittle to changes in the file/folder tree. You can simply look up the id for a folder in the console ahead of time and then set it in your code, similar to how you would specify an AWS S3 bucket. Note that when finding by one of these id values, the `path` value of a folder will come back as `nil`.
130
159
 
131
160
 
132
- **Aside: off-label client use**
161
+ **Off-label client use**
133
162
 
134
163
  The `Pcloud::File` and `Pcloud::Folder` APIs cover the most important, common functionality developers will want to access in a way that is easy to use without much onboarding. If you find that you still need to access other parts of the pCloud API that are not included in this gem yet, you can try calling other methods specified in [the pCloud API docs](https://docs.pcloud.com/) by interacting directly with the `Pcloud::Client`:
135
164
  ```ruby
@@ -137,9 +166,77 @@ Pcloud::Client.execute("listrevisions", query: { fileid: 90000 })
137
166
  ```
138
167
  _(There are a few methods on the raw pCloud API that require manual login, which this gem does not yet support. If you find that you need access to these methods you may wish to look at using the [`pcloud`](https://github.com/7urkm3n/pcloud) gem instead.)_
139
168
 
140
- ### Generating an access token
169
+ ### Example uses
141
170
 
142
- To use the `pcloud_api` client, you will need to first generate an access token. You may do this by cloning and running the script in `./bin/generate_access_token`. It will take you through the process of setting up a pCloud app and completing the OAuth2 flow in the browser.
171
+ In addition to the API docs above, here are some real-world ideas of how you might use the `pcloud_api` gem in a project. Feel free to submit a PR if you have an example that you think others would benefit from as well!
172
+
173
+ Upload a file from form params in Rails:
174
+ ```ruby
175
+ Pcloud::File.upload(
176
+ path: "/Jack",
177
+ file: File.open(params[:file].path)
178
+ )
179
+ ```
180
+
181
+ Backup a database for a local script:
182
+ ```ruby
183
+ Pcloud::File.upload(
184
+ folder_id: PCLOUD_FOLDER_ID,
185
+ filename: LOCAL_DB_FILENAME,
186
+ file: File.open("./#{LOCAL_DB_FILENAME}")
187
+ )
188
+ ```
189
+
190
+ Archive old state files and upload a new file for today:
191
+ ```ruby
192
+ # NOTE: This will overwrite existing archive files for each day such that
193
+ # there is only ever one database file stored per day.
194
+ Pcloud::Folder.find(PCLOUD_FOLDER_ID)
195
+ .contents
196
+ .filter { |item| item.is_a?(Pcloud::File) }
197
+ .filter { |file| file.name.match?(PCLOUD_STATE_FILE_REGEX) }
198
+ .each do |file|
199
+ file.update(
200
+ name: "#{file.created_at.strftime("%Y_%m_%d")}_#{file.name}",
201
+ parent_folder_id: PCLOUD_ARCHIVE_FOLDER_ID
202
+ )
203
+ end
204
+
205
+ Pcloud::File.upload(
206
+ folder_id: PCLOUD_FOLDER_ID,
207
+ filename: LOCAL_DB_FILENAME,
208
+ file: File.open("./#{LOCAL_DB_FILENAME}")
209
+ )
210
+ ```
211
+
212
+ Safely download previous state files for a local script:
213
+ ```ruby
214
+ Pcloud::Folder.find(PCLOUD_FOLDER_ID)
215
+ .contents
216
+ .filter { |item| item.is_a?(Pcloud::File) }
217
+ .filter { |file| file.name.match?(PCLOUD_STATE_FILE_REGEX) }
218
+ .each do |state_file|
219
+ filename = "./db/#{state_file.name}"
220
+ # prompt if local file is newer than cloud state file
221
+ if ::File.exist?(filename) && ::File.ctime(filename) > state_file.created_at
222
+ puts "Local #{filename} is newer than the version in pCloud. Are you sure you want to overwrite the local file with an older copy? [Y/N]".red
223
+ print "> ".red
224
+ unless ["yes", "y"].include?($stdin.gets.chomp.downcase)
225
+ puts "Skipping download of #{filename}...".yellow
226
+ next
227
+ end
228
+ end
229
+ # Only proceed with file download after confirmation or if cloud file is
230
+ # not older than local file.
231
+ ::File.open(filename, "w") do |file|
232
+ file.binmode
233
+ puts "Downloading #{filename} from pCloud...".yellow
234
+ HTTParty.get(state_file.download_url, stream_body: true) do |fragment|
235
+ file.write(fragment)
236
+ end
237
+ end
238
+ end
239
+ ```
143
240
 
144
241
  ## Development
145
242
 
data/RELEASEING.md CHANGED
@@ -3,5 +3,5 @@
3
3
  2. Make any documentation updates.
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
- * To test the gem in a local project, you can install it with `gem install --local pcloud_api-<VERSION>.gem`
6
+ * To test the gem in a local project, you can install it with `gem install --local pcloud_api-<VERSION>.gem`
7
7
  5. Publish the gem to rubygems.org: `gem push pcloud_api-<VERSION>.gem`.
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/lib/pcloud/client.rb CHANGED
@@ -9,23 +9,24 @@ module Pcloud
9
9
  ].freeze
10
10
  US_API_BASE = "api.pcloud.com".freeze
11
11
  EU_API_BASE = "eapi.pcloud.com".freeze
12
- TIMEOUT_SECONDS = ENV.fetch("PCLOUD_API_TIMEOUT_SECONDS", "8").to_i.freeze
12
+ DEFAULT_TIMEOUT_SECONDS = 8.freeze
13
13
 
14
14
  class << self
15
- def configure(access_token: nil, data_region: nil)
15
+ def configure(access_token: nil, data_region: nil, timeout_seconds: nil)
16
16
  @@access_token = access_token
17
17
  @@data_region = data_region
18
+ @@timeout_seconds = timeout_seconds.nil? ? nil : timeout_seconds.to_i
18
19
  true # Don't accidentally return any secrets from the configure method
19
20
  end
20
21
 
21
22
  def execute(method, query: {}, body: {})
22
23
  verb = ["uploadfile"].include?(method) ? :post : :get
23
24
  options = {
24
- headers: { "Authorization" => "Bearer #{access_token}" },
25
- timeout: TIMEOUT_SECONDS # this sets both the open and read timeouts to the same value
25
+ headers: { "Authorization" => "Bearer #{access_token_from_config_or_env}" },
26
+ timeout: timeout_seconds_from_config_or_env # this sets both the open and read timeouts to the same value
26
27
  }
27
- options.merge!({ query: query }) unless query.empty?
28
- options.merge!({ body: body }) unless body.empty?
28
+ options[:query] = query unless query.empty?
29
+ options[:body] = body unless body.empty?
29
30
  response = HTTParty.public_send(verb, "https://#{closest_server}/#{method}", options)
30
31
  json_response = JSON.parse(response.body)
31
32
  raise ErrorResponse.new(json_response["error"]) if json_response["error"]
@@ -34,17 +35,23 @@ module Pcloud
34
35
 
35
36
  private
36
37
 
37
- def data_region
38
+ def data_region_from_config_or_env
38
39
  @@data_region ||= ENV["PCLOUD_API_DATA_REGION"]
39
40
  return @@data_region if VALID_DATA_REGIONS.include?(@@data_region)
40
41
  raise ConfigurationError.new("Missing pCloud data region") if @@data_region.nil?
41
42
  raise ConfigurationError.new("Invalid pCloud data region, must be one of #{VALID_DATA_REGIONS}")
42
43
  end
43
44
 
44
- def access_token
45
+ def access_token_from_config_or_env
45
46
  @@access_token ||= ENV["PCLOUD_API_ACCESS_TOKEN"]
46
47
  return @@access_token unless @@access_token.nil?
47
- raise ConfigurationError.new("Missing bearer token")
48
+ raise ConfigurationError.new("Missing pCloud API access token")
49
+ end
50
+
51
+ def timeout_seconds_from_config_or_env
52
+ @@timeout_seconds ||= ENV.fetch("PCLOUD_API_TIMEOUT_SECONDS", DEFAULT_TIMEOUT_SECONDS).to_i
53
+ return @@timeout_seconds unless @@timeout_seconds.zero?
54
+ raise ConfigurationError.new("Invalid pCloud API timeout seconds: cannot be set to 0")
48
55
  end
49
56
 
50
57
  # You can manually hit "https://<default_server_for_your_region>/getapiserver"
@@ -53,7 +60,7 @@ module Pcloud
53
60
  def closest_server
54
61
  @@closest_server ||= begin
55
62
  return ENV["PCLOUD_API_BASE_URI"] if ENV["PCLOUD_API_BASE_URI"]
56
- case data_region
63
+ case data_region_from_config_or_env
57
64
  when US_DATA_REGION
58
65
  US_API_BASE
59
66
  when EU_DATA_REGION
data/lib/pcloud/file.rb CHANGED
@@ -39,8 +39,8 @@ module Pcloud
39
39
  unless (params.keys - SUPPORTED_UPDATE_PARAMS).empty?
40
40
  raise InvalidParameters.new("Must be one of #{SUPPORTED_UPDATE_PARAMS}")
41
41
  end
42
- if params[:path] && is_invalid_path_update_param?(params[:path])
43
- raise InvalidParameter.new(":path param must start and end with `/`")
42
+ if params[:path] && params[:path][0] != "/"
43
+ raise InvalidParameter.new(":path param must start with `/`")
44
44
  end
45
45
  query = {
46
46
  fileid: id,
@@ -73,13 +73,6 @@ module Pcloud
73
73
  "#{@download_url}/#{URI.encode_www_form_component(name)}"
74
74
  end
75
75
 
76
- private
77
-
78
- def is_invalid_path_update_param?(path_param)
79
- # Path params have to start and end with `/` when used with .update
80
- [path_param[0], path_param[-1]] != ["/", "/"]
81
- end
82
-
83
76
  class << self
84
77
  def exists?(id)
85
78
  find(id)
@@ -127,7 +120,7 @@ module Pcloud
127
120
  renameifexists: params[:overwrite] ? 0 : 1,
128
121
  path: params[:path],
129
122
  folderid: params[:folder_id],
130
- filename: params.fetch(:filename),
123
+ filename: params[:filename],
131
124
  file: file,
132
125
  }.compact,
133
126
  )
@@ -136,7 +129,7 @@ module Pcloud
136
129
  # so we return just one file out of this method.
137
130
  uploaded_file = parse_many(response).first
138
131
  raise UploadFailed if uploaded_file.nil?
139
- return uploaded_file
132
+ uploaded_file
140
133
  rescue KeyError => e
141
134
  missing_param = e.message.gsub("key not found: ", "")
142
135
  raise MissingParameter.new("#{missing_param} is required")
data/lib/pcloud/folder.rb CHANGED
@@ -8,7 +8,7 @@ module Pcloud
8
8
  include Pcloud::TimeHelper
9
9
 
10
10
  SUPPORTED_UPDATE_PARAMS = [:name, :parent_folder_id, :path].freeze
11
- SUPPORTED_FIND_BY_PARAMS = [:id, :path].freeze
11
+ SUPPORTED_FIND_BY_PARAMS = [:id, :path, :recursive].freeze
12
12
 
13
13
  attr_reader :id, :path, :name, :parent_folder_id, :is_deleted, :created_at,
14
14
  :modified_at
@@ -34,8 +34,8 @@ module Pcloud
34
34
  unless (params.keys - SUPPORTED_UPDATE_PARAMS).empty?
35
35
  raise InvalidParameters.new("Must be one of #{SUPPORTED_UPDATE_PARAMS}")
36
36
  end
37
- if params[:path] && is_invalid_path_param?(params[:path])
38
- raise InvalidParameter.new(":path parameter must start and end with `/`")
37
+ if params[:path] && params[:path][0] != "/"
38
+ raise InvalidParameter.new(":path parameter must start with `/`")
39
39
  end
40
40
  query = {
41
41
  folderid: id,
@@ -72,13 +72,6 @@ module Pcloud
72
72
  @contents
73
73
  end
74
74
 
75
- private
76
-
77
- def is_invalid_path_param?(path_param)
78
- # Path params have to start and end with `/`
79
- [path_param[0], path_param[-1]] != ["/", "/"]
80
- end
81
-
82
75
  class << self
83
76
  def first_or_create(params)
84
77
  if params[:parent_folder_id] && params[:name]
@@ -98,8 +91,8 @@ module Pcloud
98
91
  raise e
99
92
  end
100
93
 
101
- def find(id)
102
- parse_one(Client.execute("listfolder", query: { folderid: id }))
94
+ def find(id, opts={})
95
+ parse_one(Client.execute("listfolder", query: { folderid: id, recursive: opts[:recursive] == true }))
103
96
  end
104
97
 
105
98
  def find_by(params)
@@ -107,7 +100,7 @@ module Pcloud
107
100
  raise InvalidParameters.new("Must be one of #{SUPPORTED_FIND_BY_PARAMS}")
108
101
  end
109
102
  raise InvalidParameters.new(":id takes precedent over :path, please only use one or the other") if params[:path] && params[:id]
110
- query = { path: params[:path], folderid: params[:id] }.compact
103
+ query = { path: params[:path], folderid: params[:id], recursive: params[:recursive] == true }.compact
111
104
  parse_one(Client.execute("listfolder", query: query))
112
105
  end
113
106
  end
@@ -1,3 +1,3 @@
1
1
  module Pcloud
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
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.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hunsche Jones
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-09 00:00:00.000000000 Z
11
+ date: 2023-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,7 +100,7 @@ dependencies:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
- description:
103
+ description:
104
104
  email:
105
105
  - joshua@hunschejones.com
106
106
  executables: []
@@ -134,7 +134,7 @@ metadata:
134
134
  homepage_uri: https://github.com/jhunschejones/pcloud_api
135
135
  source_code_uri: https://github.com/jhunschejones/pcloud_api
136
136
  changelog_uri: https://github.com/jhunschejones/pcloud_api/blob/master/CHANGELOG.md
137
- post_install_message:
137
+ post_install_message:
138
138
  rdoc_options: []
139
139
  require_paths:
140
140
  - lib
@@ -149,8 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.2.28
153
- signing_key:
152
+ rubygems_version: 3.3.26
153
+ signing_key:
154
154
  specification_version: 4
155
155
  summary: A Ruby library for interacting with the pCloud API
156
156
  test_files: []