mojfile-uploader-api-client 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +22 -0
- data/lib/mojfile_uploader_api_client/add_file.rb +6 -4
- data/lib/mojfile_uploader_api_client/delete_file.rb +4 -3
- data/lib/mojfile_uploader_api_client/list_files.rb +4 -3
- data/lib/mojfile_uploader_api_client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebc75d73079201879712a90261fb8c0a2e1d64e9
|
4
|
+
data.tar.gz: 50628c0c85917510259cbe8c9a8b1f6b3115940f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ee5567ac519f4d76d1be20cbcd08bbc5e79369bfd77e3e8ec94fc1d2291f080ba2fd8708f3d736658f8ebcdf298f89de2104bdddec6a0e6389b60184e52536d
|
7
|
+
data.tar.gz: 0a5a5856cfc7574275ecd3f8eba6ab0a4a69ef7e90109556d9b5201e4f7466ebf7a33d916d47598225efc0506e9e9840482496d1238dfad207c6a646645c74e9
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mojfile-uploader-api-client (0.
|
4
|
+
mojfile-uploader-api-client (0.3)
|
5
5
|
rest-client (~> 2.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
rspec-core (>= 3.4.0, < 3.6.0)
|
69
69
|
netrc (0.11.0)
|
70
70
|
parallel (1.10.0)
|
71
|
-
parser (2.3.
|
71
|
+
parser (2.3.3.1)
|
72
72
|
ast (~> 2.2)
|
73
73
|
powerpack (0.1.1)
|
74
74
|
procto (0.0.3)
|
@@ -112,7 +112,7 @@ GEM
|
|
112
112
|
simplecov-html (~> 0.10.0)
|
113
113
|
simplecov-html (0.10.0)
|
114
114
|
slop (3.6.0)
|
115
|
-
thread_safe (0.3.
|
115
|
+
thread_safe (0.3.6)
|
116
116
|
unf (0.1.4)
|
117
117
|
unf_ext
|
118
118
|
unf_ext (0.0.7.2)
|
data/README.md
CHANGED
@@ -25,6 +25,13 @@ MojFileUploaderApiClient.add_file(title: 'test', filename: 'test.txt', data: 'bl
|
|
25
25
|
=> {:collection=>"a45c556f-a628-41d3-8c29-351f84e63757", :key=>"7c6aca2c-eb7a-4194-8166-9fd6ac82127b.test.txt"}
|
26
26
|
```
|
27
27
|
|
28
|
+
With a folder name:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
MojFileUploaderApiClient.add_file(folder: 'subfolder', title: 'test', filename: 'test.txt', data: 'bla bla bla', collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757')
|
32
|
+
=> {:collection=>"a45c556f-a628-41d3-8c29-351f84e63757", :folder=>"subfolder", :key=>"7c6aca2c-eb7a-4194-8166-9fd6ac82127b.test.txt"}
|
33
|
+
```
|
34
|
+
|
28
35
|
Or you can use the `AddFile` client directly:
|
29
36
|
|
30
37
|
```ruby
|
@@ -59,6 +66,13 @@ MojFileUploaderApiClient.delete_file(collection_ref: 'a45c556f-a628-41d3-8c29-35
|
|
59
66
|
=> RequestError
|
60
67
|
```
|
61
68
|
|
69
|
+
With a folder:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
MojFileUploaderApiClient.delete_file(collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757', folder: 'subfolder', filename: 'test1.txt')
|
73
|
+
=> RequestError
|
74
|
+
```
|
75
|
+
|
62
76
|
Or you can use the `DeleteFile` client directly:
|
63
77
|
|
64
78
|
```ruby
|
@@ -74,6 +88,14 @@ MojFileUploaderApiClient.list_files(collection_ref: 'a45c556f-a628-41d3-8c29-351
|
|
74
88
|
:files=>[{:key=>"a45c556f-a628-41d3-8c29-351f84e63757/test1.txt", :title=>"test1.txt", :last_modified=>"2016-11-30T15:30:52.000Z"}]}
|
75
89
|
```
|
76
90
|
|
91
|
+
With a folder:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
MojFileUploaderApiClient.list_files(collection_ref: 'a45c556f-a628-41d3-8c29-351f84e63757', folder: 'subfolder')
|
95
|
+
=> {:collection=>"a45c556f-a628-41d3-8c29-351f84e63757", :folder=>"subfolder",
|
96
|
+
:files=>[{:key=>"a45c556f-a628-41d3-8c29-351f84e63757/subfolder/test1.txt", :title=>"test1.txt", :last_modified=>"2016-11-30T15:30:52.000Z"}]}
|
97
|
+
```
|
98
|
+
|
77
99
|
Or you can use the `ListFiles` client directly:
|
78
100
|
|
79
101
|
```ruby
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module MojFileUploaderApiClient
|
2
2
|
class AddFile < MojFileUploaderApiClient::HttpClient
|
3
|
-
attr_accessor :collection_ref, :
|
3
|
+
attr_accessor :collection_ref, :folder, :filename, :data
|
4
4
|
|
5
|
-
def initialize(collection_ref: nil,
|
5
|
+
def initialize(collection_ref: nil, folder: nil, filename:, data:)
|
6
6
|
self.collection_ref = collection_ref
|
7
|
-
self.
|
7
|
+
self.folder = folder
|
8
8
|
self.filename = filename
|
9
9
|
self.data = data
|
10
10
|
end
|
@@ -14,7 +14,9 @@ module MojFileUploaderApiClient
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def payload
|
17
|
-
|
17
|
+
payload = {file_filename: filename, file_data: data}
|
18
|
+
payload[:folder] = folder if folder
|
19
|
+
payload
|
18
20
|
end
|
19
21
|
|
20
22
|
def endpoint
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module MojFileUploaderApiClient
|
2
2
|
class DeleteFile < MojFileUploaderApiClient::HttpClient
|
3
|
-
attr_accessor :collection_ref, :filename
|
3
|
+
attr_accessor :collection_ref, :folder, :filename
|
4
4
|
|
5
|
-
def initialize(collection_ref:, filename:)
|
5
|
+
def initialize(collection_ref:, folder: nil, filename:)
|
6
6
|
self.collection_ref = collection_ref
|
7
|
+
self.folder = folder
|
7
8
|
self.filename = filename
|
8
9
|
end
|
9
10
|
|
@@ -12,7 +13,7 @@ module MojFileUploaderApiClient
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def endpoint
|
15
|
-
[collection_ref, filename].join('/')
|
16
|
+
[collection_ref, folder, filename].compact.join('/')
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module MojFileUploaderApiClient
|
2
2
|
class ListFiles < MojFileUploaderApiClient::HttpClient
|
3
|
-
attr_accessor :collection_ref
|
3
|
+
attr_accessor :collection_ref, :folder
|
4
4
|
|
5
|
-
def initialize(collection_ref:)
|
5
|
+
def initialize(collection_ref:, folder: nil)
|
6
6
|
self.collection_ref = collection_ref
|
7
|
+
self.folder = folder
|
7
8
|
end
|
8
9
|
|
9
10
|
def verb
|
@@ -11,7 +12,7 @@ module MojFileUploaderApiClient
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def endpoint
|
14
|
-
collection_ref
|
15
|
+
[collection_ref, folder].compact.join('/')
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mojfile-uploader-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesus Laiz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-02-
|
12
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
175
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.6.
|
176
|
+
rubygems_version: 2.6.10
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: API client for integration with the MOJ File Uploader
|