filestack 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -3
- data/README.md +8 -4
- data/VERSION +1 -1
- data/filestack-ruby.gemspec +1 -1
- data/lib/filestack/models/filelink.rb +5 -5
- data/lib/filestack/models/filestack_av.rb +2 -2
- data/lib/filestack/models/filestack_client.rb +5 -5
- data/lib/filestack/models/filestack_transform.rb +2 -2
- data/lib/filestack/ruby/version.rb +1 -1
- data/lib/filestack/utils/utils.rb +3 -3
- metadata +4 -5
- data/Gemfile.lock +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aca602e4b1ed4c8301e92f48c720770f342b4bd
|
4
|
+
data.tar.gz: abaf50f6a4ee02a26d122d6276506a73ef29cdb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84fcb737a31a173e11858547521f33e3bff386f782e01e7434508e80847ee6f8a47fceaebb189ebdb1a8408593d03fb0e4c0558d1a003bd46dde3b254ee5df7f
|
7
|
+
data.tar.gz: 702dfee5fd7a8f1186b45802a48a5a7a27e9dad43e6539baceb82595f9aa8e38e547a014ad9f3b93cbc082bd85096a07082e62c5a9cdd01896867e37f344f527
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# Filestack-Ruby Changelog
|
2
2
|
|
3
|
-
## 2.
|
4
|
-
-
|
3
|
+
## 2.1.0 (August 4, 2017)
|
4
|
+
- FS-1452 Rename Client to FilestackClient, Filelink to FilestackFilelink
|
5
5
|
|
6
6
|
## 2.0.1 (July 11, 2017)
|
7
|
-
- FS-1389 Fix import error when calling './lib' in client class
|
7
|
+
- FS-1389 Fix import error when calling './lib' in client class
|
8
|
+
|
9
|
+
## 2.0.0
|
10
|
+
- First release, includes uploads, transformations, conversions and tagging
|
data/README.md
CHANGED
@@ -30,12 +30,16 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
## Usage
|
32
32
|
|
33
|
+
## IMPORTANT
|
34
|
+
|
35
|
+
A recent change (2.1.0) has renamed the Client to FilestackClient, and the Filelink to FilestackFilelink. Please make neccessary changes before upgrading to newest release if you run 2.0.1 or 2.0.0. This was to address namespace concerns by users with models and attributes named Client, and to be more consistent.
|
36
|
+
|
33
37
|
```ruby
|
34
38
|
require 'filestack'
|
35
39
|
```
|
36
40
|
Intialize the client using your API key, and security if you are using it.
|
37
41
|
```ruby
|
38
|
-
client =
|
42
|
+
client = FilestackClient.new('YOUR_API_KEY', security: security_object)
|
39
43
|
```
|
40
44
|
### Uploading
|
41
45
|
Filestack uses multipart uploading by default, which is faster for larger files. This can be turned off by passing in ```multipart: false```. Multipart is disabled when uploading external URLs.
|
@@ -52,11 +56,11 @@ If security is enabled on your account, or if you are using certain actions that
|
|
52
56
|
|
53
57
|
```ruby
|
54
58
|
security = FilestackSecurity.new('YOUR_APP_SECRET', options: {call: %w[read store pick]})
|
55
|
-
client =
|
59
|
+
client = FilestackClient.new('YOUR_API_KEY', security: security)
|
56
60
|
```
|
57
61
|
|
58
|
-
### Using
|
59
|
-
|
62
|
+
### Using FilestackFilelinks
|
63
|
+
FilestackFilelink objects are representation of a file handle. You can download, get raw file content, delete and overwrite file handles directly. Security is required for overwrite and delete methods.
|
60
64
|
|
61
65
|
### Transformations
|
62
66
|
Transforms can be initiated one of two ways. The first, by calling ```transform``` on a filelink:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0
|
1
|
+
2.1.0
|
data/filestack-ruby.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency "parallel", "~> 1.11.2"
|
27
27
|
spec.add_dependency "mimemagic", "~> 0.3.2"
|
28
28
|
|
29
|
-
spec.add_development_dependency "bundler", "~> 1.
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
30
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
31
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
32
32
|
spec.add_development_dependency "simplecov", "~> 0.14"
|
@@ -7,14 +7,14 @@ require 'filestack/mixins/filestack_common'
|
|
7
7
|
# This class represents a file stored on your Filestack
|
8
8
|
# storage. Once initialized, you may perform transformations, conversions,
|
9
9
|
# get metadata, update, or delete it.
|
10
|
-
class
|
10
|
+
class FilestackFilelink
|
11
11
|
include FilestackCommon
|
12
12
|
include UploadUtils
|
13
13
|
attr_reader :handle, :apikey, :security
|
14
14
|
|
15
|
-
# Initialize
|
15
|
+
# Initialize FilestackFilelink
|
16
16
|
#
|
17
|
-
# @param [String] file_handle The
|
17
|
+
# @param [String] file_handle The FilestackFilelink handle
|
18
18
|
# @param [String] apikey Your Filestack API Key (optional)
|
19
19
|
# @param [FilestackSecurity] security Filestack security object, if
|
20
20
|
# security is enabled.
|
@@ -31,7 +31,7 @@ class Filelink
|
|
31
31
|
send_get_content(url)
|
32
32
|
end
|
33
33
|
|
34
|
-
# Download
|
34
|
+
# Download FilestackFilelink
|
35
35
|
#
|
36
36
|
# @param [String] filepath The local destination of the
|
37
37
|
# downloaded filelink
|
@@ -78,7 +78,7 @@ class Filelink
|
|
78
78
|
send_tags('sfw', @handle, @security)
|
79
79
|
end
|
80
80
|
|
81
|
-
# Get the URL of the
|
81
|
+
# Get the URL of the FilestackFilelink
|
82
82
|
#
|
83
83
|
# @return [String]
|
84
84
|
def url
|
@@ -15,12 +15,12 @@ class AV
|
|
15
15
|
|
16
16
|
# Turns AV into filelink if video conversion is complete
|
17
17
|
#
|
18
|
-
# @return [Filestack::
|
18
|
+
# @return [Filestack::FilestackFilelink]
|
19
19
|
def to_filelink
|
20
20
|
return 'Video conversion incomplete' unless status == 'completed'
|
21
21
|
response = UploadUtils.make_call(@url, 'get').body
|
22
22
|
handle = response['data']['url'].split('/').last
|
23
|
-
|
23
|
+
FilestackFilelink.new(handle, apikey: @apikey, security: @security)
|
24
24
|
end
|
25
25
|
|
26
26
|
# Checks the status of the video conversion
|
@@ -2,16 +2,16 @@ require 'filestack/utils/multipart_upload_utils'
|
|
2
2
|
require 'filestack/models/filestack_transform'
|
3
3
|
require 'filestack/utils/utils'
|
4
4
|
|
5
|
-
# The Filestack
|
5
|
+
# The Filestack FilestackClient class acts as a hub for all
|
6
6
|
# Filestack actions that do not require a file handle, including
|
7
7
|
# uploading files (both local and external), initiating an external
|
8
8
|
# transformation, and other tasks
|
9
|
-
class
|
9
|
+
class FilestackClient
|
10
10
|
include MultipartUploadUtils
|
11
11
|
include UploadUtils
|
12
12
|
attr_reader :apikey, :security
|
13
13
|
|
14
|
-
# Initialize
|
14
|
+
# Initialize FilestackClient
|
15
15
|
#
|
16
16
|
# @param [String] apikey Your Filestack API key
|
17
17
|
# @param [FilestackSecurity] security A Filestack security object,
|
@@ -28,7 +28,7 @@ class Client
|
|
28
28
|
# (Default: true)
|
29
29
|
# @param [Hash] options User-supplied upload options
|
30
30
|
#
|
31
|
-
# return [Filestack::
|
31
|
+
# return [Filestack::FilestackFilelink]
|
32
32
|
def upload(filepath: nil, external_url: nil, multipart: true, options: nil, storage: 's3')
|
33
33
|
if filepath && external_url
|
34
34
|
return 'You cannot upload a URL and file at the same time'
|
@@ -45,7 +45,7 @@ class Client
|
|
45
45
|
storage: storage
|
46
46
|
)
|
47
47
|
end
|
48
|
-
|
48
|
+
FilestackFilelink.new(response['handle'], security: @security, apikey: @apikey)
|
49
49
|
end
|
50
50
|
|
51
51
|
def transform_external(external_url)
|
@@ -74,14 +74,14 @@ class Transform
|
|
74
74
|
|
75
75
|
# Stores a transformation URL and returns a filelink
|
76
76
|
#
|
77
|
-
# @return [Filestack::
|
77
|
+
# @return [Filestack::FilestackFilelink]
|
78
78
|
def store
|
79
79
|
@transform_tasks.push(
|
80
80
|
add_transform_task('store', {})
|
81
81
|
)
|
82
82
|
response = UploadUtils.make_call(url, 'get')
|
83
83
|
handle = response.body['url'].split('/').last
|
84
|
-
|
84
|
+
FilestackFilelink.new(handle, apikey: @apikey, security: @security)
|
85
85
|
end
|
86
86
|
|
87
87
|
# Override default method (best practice when overriding method_missing)
|
@@ -63,11 +63,11 @@ module UploadUtils
|
|
63
63
|
raise response.body
|
64
64
|
end
|
65
65
|
|
66
|
-
# Generates the URL for a
|
66
|
+
# Generates the URL for a FilestackFilelink object
|
67
67
|
# @param [String] base The base Filestack URL
|
68
|
-
# @param [String] handle The
|
68
|
+
# @param [String] handle The FilestackFilelink handle (optional)
|
69
69
|
# @param [String] path The specific API path (optional)
|
70
|
-
# @param [String] security Security for the
|
70
|
+
# @param [String] security Security for the FilestackFilelink (optional)
|
71
71
|
#
|
72
72
|
# return [String]
|
73
73
|
def get_url(base, handle: nil, path: nil, security: nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filestack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Filestack
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unirest
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.7'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.7'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,6 @@ files:
|
|
122
122
|
- CHANGELOG.md
|
123
123
|
- CONTRIBUTING.md
|
124
124
|
- Gemfile
|
125
|
-
- Gemfile.lock
|
126
125
|
- LICENSE.txt
|
127
126
|
- README.md
|
128
127
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
filestack (2.0.1)
|
5
|
-
mimemagic (~> 0.3.2)
|
6
|
-
parallel (~> 1.11.2)
|
7
|
-
unirest (~> 1.1.2)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
addressable (2.3.8)
|
13
|
-
coveralls (0.8.21)
|
14
|
-
json (>= 1.8, < 3)
|
15
|
-
simplecov (~> 0.14.1)
|
16
|
-
term-ansicolor (~> 1.3)
|
17
|
-
thor (~> 0.19.4)
|
18
|
-
tins (~> 1.6)
|
19
|
-
diff-lcs (1.3)
|
20
|
-
docile (1.1.5)
|
21
|
-
json (1.8.6)
|
22
|
-
mime-types (1.25.1)
|
23
|
-
mimemagic (0.3.2)
|
24
|
-
parallel (1.11.2)
|
25
|
-
rake (12.0.0)
|
26
|
-
rest-client (1.6.9)
|
27
|
-
mime-types (~> 1.16)
|
28
|
-
rspec (3.6.0)
|
29
|
-
rspec-core (~> 3.6.0)
|
30
|
-
rspec-expectations (~> 3.6.0)
|
31
|
-
rspec-mocks (~> 3.6.0)
|
32
|
-
rspec-core (3.6.0)
|
33
|
-
rspec-support (~> 3.6.0)
|
34
|
-
rspec-expectations (3.6.0)
|
35
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
-
rspec-support (~> 3.6.0)
|
37
|
-
rspec-mocks (3.6.0)
|
38
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.6.0)
|
40
|
-
rspec-support (3.6.0)
|
41
|
-
simplecov (0.14.1)
|
42
|
-
docile (~> 1.1.0)
|
43
|
-
json (>= 1.8, < 3)
|
44
|
-
simplecov-html (~> 0.10.0)
|
45
|
-
simplecov-html (0.10.1)
|
46
|
-
term-ansicolor (1.6.0)
|
47
|
-
tins (~> 1.0)
|
48
|
-
thor (0.19.4)
|
49
|
-
tins (1.15.0)
|
50
|
-
unirest (1.1.2)
|
51
|
-
addressable (~> 2.3.5)
|
52
|
-
json (~> 1.8.1)
|
53
|
-
rest-client (~> 1.6.7)
|
54
|
-
|
55
|
-
PLATFORMS
|
56
|
-
ruby
|
57
|
-
|
58
|
-
DEPENDENCIES
|
59
|
-
bundler (~> 1.15)
|
60
|
-
coveralls
|
61
|
-
filestack!
|
62
|
-
rake
|
63
|
-
rspec (~> 3.0)
|
64
|
-
simplecov (~> 0.14)
|
65
|
-
|
66
|
-
BUNDLED WITH
|
67
|
-
1.15.1
|