pcloud_api 0.2.1 → 0.2.2
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 +22 -4
- data/lib/pcloud/time_helper.rb +3 -1
- data/lib/pcloud/version.rb +1 -1
- data/pcloud_api.gemspec +3 -3
- metadata +5 -6
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fc8c976ed07fce0322907df07ed86d464b5924e6fb465aaa2bc5154b5fe95e8
|
4
|
+
data.tar.gz: e86aaee5ef4453da35281d3d3840078dfc639552c8913de6f4389a571e862256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a75daa528c2c263b4f5e1e2f57e81090a440c391860ef5bfc714967156cfe5b289c1b3d644428f5213e13c60fabca6745263d7cc6c7ba77c800d6177d8e1a888
|
7
|
+
data.tar.gz: 520875db136cfb2961b8bdee6f9948af3701aaef3eb318860ec7b7b018fd7ac500edc27ea0581765ce5e63e948dea842bd7a94a85ba3279323ec14fa21d91915
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
+
## 0.2.2 2021-10-09
|
2
|
+
|
3
|
+
**Changes**
|
4
|
+
1. After adding GitHub actions, I discovered that the gem did not in fact work on all the versions of Ruby that I had thought it supported. This update makes some small tweaks to bring support to Ruby 2.4 then updates the `.gemspec` to clarify that 2.3 is not in fact supported. All current users of the gem should see no behavior changes as a result of this update 👍🏻
|
5
|
+
|
1
6
|
## 0.2.1 2021-10-07
|
2
7
|
|
3
8
|
**Changes**
|
4
|
-
1. Simplifying
|
9
|
+
1. Simplifying the errors returned from `Pcloud::Folder` and `Pcloud::File`. This is purely a cleanup release, unless your client is explicitly checking error strings there should be no noticeable behavior change 👍🏻
|
5
10
|
|
6
11
|
## 0.2.0 2021-10-07
|
7
12
|
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# pCloud API
|
2
2
|
|
3
|
+
[](https://github.com/jhunschejones/pcloud_api/actions/workflows/ci.yml)
|
4
|
+
|
3
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.
|
4
6
|
|
5
7
|
## Installation
|
@@ -18,6 +20,12 @@ Or install it yourself as:
|
|
18
20
|
|
19
21
|
$ gem install pcloud_api
|
20
22
|
|
23
|
+
## Requirements
|
24
|
+
|
25
|
+
* Ruby 2.4.0 or higher
|
26
|
+
* `httparty`
|
27
|
+
* `tzinfo`
|
28
|
+
|
21
29
|
## Usage
|
22
30
|
|
23
31
|
### Configuration
|
@@ -41,16 +49,21 @@ The `Pcloud::File` API includes:
|
|
41
49
|
# Find files by file id or path:
|
42
50
|
Pcloud::File.find(1)
|
43
51
|
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
|
44
54
|
|
45
|
-
#
|
55
|
+
# Check if a file exists by id
|
56
|
+
Pcloud::File.exists?(1)
|
57
|
+
|
58
|
+
# Upload a new file, rename if one already exists with this name:
|
46
59
|
Pcloud::File.upload(
|
47
60
|
folder_id: 1,
|
48
61
|
filename: "jack_goes_swimming.mp4",
|
49
62
|
file: File.open("/Users/joshua/Downloads/jack_goes_swimming.mp4")
|
50
63
|
)
|
51
|
-
# NOTE: the upload method will allow you to specify
|
52
|
-
#
|
53
|
-
#
|
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.
|
54
67
|
|
55
68
|
# Upload a file, force overwrite of existing file:
|
56
69
|
Pcloud::File.upload!(
|
@@ -80,6 +93,11 @@ The `Pcloud::Folder` API is very similar:
|
|
80
93
|
# Find folders by folder id or path:
|
81
94
|
Pcloud::Folder.find(1)
|
82
95
|
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
|
98
|
+
|
99
|
+
# Check if a folder exists by id
|
100
|
+
Pcloud::Folder.exists?(1)
|
83
101
|
|
84
102
|
# Create a new folder by parent_folder_id and name:
|
85
103
|
Pcloud::Folder.first_or_create(parent_folder_id: 9000, name: "jack")
|
data/lib/pcloud/time_helper.rb
CHANGED
@@ -14,7 +14,9 @@ module Pcloud
|
|
14
14
|
return Time.at(time) if time.digits.size < 13
|
15
15
|
milliseconds = time.to_s[-3..-1].to_i
|
16
16
|
seconds = time.to_s[0..-4].to_i
|
17
|
-
|
17
|
+
# Older Ruby versions only support microseconds as the second
|
18
|
+
# argument to Time.at/2
|
19
|
+
Time.at(seconds, milliseconds * 1000)
|
18
20
|
elsif time.is_a?(Time)
|
19
21
|
time
|
20
22
|
else
|
data/lib/pcloud/version.rb
CHANGED
data/pcloud_api.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.summary = "A Ruby library for interacting with the pCloud API"
|
10
10
|
spec.homepage = "https://github.com/jhunschejones/pcloud_api"
|
11
11
|
spec.license = "MIT"
|
12
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
13
13
|
|
14
14
|
spec.metadata["homepage_uri"] = spec.homepage
|
15
15
|
spec.metadata["source_code_uri"] = "https://github.com/jhunschejones/pcloud_api"
|
@@ -18,14 +18,14 @@ Gem::Specification.new do |spec|
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
20
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|.github)/}) }
|
22
22
|
end
|
23
23
|
spec.bindir = "exe"
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", ">= 1.17", "< 3.0"
|
28
|
-
spec.add_development_dependency "rake", "~>
|
28
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
29
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
30
30
|
spec.add_development_dependency "pry", "~> 0.13"
|
31
31
|
|
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
|
+
version: 0.2.2
|
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: 2021-10-
|
11
|
+
date: 2021-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '13.0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '13.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,6 @@ extra_rdoc_files: []
|
|
109
109
|
files:
|
110
110
|
- ".gitignore"
|
111
111
|
- ".rspec"
|
112
|
-
- ".travis.yml"
|
113
112
|
- CHANGELOG.md
|
114
113
|
- Gemfile
|
115
114
|
- LICENSE.txt
|
@@ -143,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
142
|
requirements:
|
144
143
|
- - ">="
|
145
144
|
- !ruby/object:Gem::Version
|
146
|
-
version: 2.
|
145
|
+
version: 2.4.0
|
147
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
147
|
requirements:
|
149
148
|
- - ">="
|