kloudless 0.2.0 → 0.2.1
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 +3 -1
- data/README.md +5 -2
- data/lib/kloudless/file.rb +7 -0
- data/lib/kloudless/version.rb +1 -1
- data/test/kloudless/file_test.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42bbe34d180e3416514fad0b2fefc28ffaa0804e
|
4
|
+
data.tar.gz: 6074095b58159c86c87f9fb749c0721815e6a581
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51dec12e2e4a7b610b5678d7696a841d358a3661df8eaec4109c2a21da158c2bb91106491659db8718c5c30131ec8a8c0b35a39d50b873a0f08f0d14f726dee6
|
7
|
+
data.tar.gz: 1f0f9dea225f7e4ca64611f6bc63338af9fbcd69b89ee564df2d1025458b68fcbdddc6667dff2e135c392812431d71a6641c9e3de6e34fdfa583be6c1857f451
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -23,8 +23,11 @@ official reference. You can obtain an API Key at the [Developer
|
|
23
23
|
Portal](https://developers.kloudless.com/).
|
24
24
|
|
25
25
|
```ruby
|
26
|
-
# Authentication
|
27
|
-
Kloudless.authorize(
|
26
|
+
# Authentication using a Bearer Token obtained by authenticating a user.
|
27
|
+
Kloudless.authorize(token: "abc")
|
28
|
+
|
29
|
+
# Alternatively, use the line below for API Keys:
|
30
|
+
# Kloudless.authorize(api_key: "abc")
|
28
31
|
|
29
32
|
accounts = Kloudless::Account.list
|
30
33
|
account = accounts.first
|
data/lib/kloudless/file.rb
CHANGED
@@ -59,5 +59,12 @@ module Kloudless
|
|
59
59
|
path = "/accounts/#{account_ids.join(',')}/search"
|
60
60
|
Kloudless::Collection.new(self, http.get(path, params: params))
|
61
61
|
end
|
62
|
+
|
63
|
+
def self.convert_id(account_id:, raw_id:, type:, params: {}, **data)
|
64
|
+
path = "/accounts/#{account_id}/convert_id"
|
65
|
+
data[:raw_id] = raw_id
|
66
|
+
data[:type] = type
|
67
|
+
http.post(path, params: params, data: data)
|
68
|
+
end
|
62
69
|
end
|
63
70
|
end
|
data/lib/kloudless/version.rb
CHANGED
data/test/kloudless/file_test.rb
CHANGED
@@ -76,4 +76,13 @@ class Kloudless::FileTest < Minitest::Test
|
|
76
76
|
assert_kind_of Kloudless::File, files.first
|
77
77
|
end
|
78
78
|
end
|
79
|
+
|
80
|
+
def test_convert_id
|
81
|
+
response = {"id" => "foo"}
|
82
|
+
data = {raw_id: "bar", type: "file"}
|
83
|
+
Kloudless.http.expect(:post, returns: response, args:["/accounts/1/convert_id", params: {}, data: data ]) do
|
84
|
+
new_id_data = Kloudless::File.convert_id(account_id: 1, raw_id: data[:raw_id], type: data[:type])
|
85
|
+
assert_equal "foo", new_id_data["id"]
|
86
|
+
end
|
87
|
+
end
|
79
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kloudless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerry Cheung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|