cdnconnect-api 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/cdnconnect_api.rb +29 -18
- 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: b6b1028c11c95a10a423d91d02d7355f2521c09c
|
4
|
+
data.tar.gz: 93c36127d3c3036ffb4c22f14d04b7170fc66a02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 309a6d775ae6332989764f153a4e4f51a7a96369046afe0798229915925ff7058a36ffb597fae35f17523288446181e512dd87918cf6b3496e2d11089697cdc0
|
7
|
+
data.tar.gz: 450d413018afe9699e79e3f1c85cb9e1f08b5a63c301e0fc6b28a352ad60df32bd719e75ade5dc4c538c4a1f60c6d3ba9eb2f8c47f61f9f81e17870a22fae949
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# CDN Connect API Ruby Client, v0.2.
|
1
|
+
# CDN Connect API Ruby Client, v0.2.4
|
2
2
|
|
3
3
|
CDN Connect makes it easier to manage production assets for teams of developers and designers, all while serving files from a fast content delivery network. Features include image optimization, resizing, cropping, filters, changing output formats, convert to WebP image format, etc. The CDN Connect API Ruby Client makes it easier to upload files and interact with the API with only a few lines of code.
|
4
4
|
|
@@ -43,8 +43,9 @@ Below are the possible parameters for the `upload` method. You must set `destina
|
|
43
43
|
- `source_folder_path` : A string of a source folder's local path to upload. This will upload all of the files in this source folder to the destination url. By using the `valid_extensions` parameter you can also restrict which files should be uploaded according to extension.
|
44
44
|
- `valid_extensions` : An array of valid extensions which should be uploaded. This is only applied when the `source_folder_path` options is used. If nothing is provided, which is the default, all files within the folder are uploaded. The extensions should be in all lower case, and they should not contain a period or asterisks. Example `valid_extensions => ['js', 'css', 'jpg', jpeg', 'png', 'gif', 'webp']`
|
45
45
|
- `recursive_local_folders` : A true or false value indicating if this call should recursively upload all of the local folder's sub-folders, and their sub-folders, etc. This option is only used when the `source_folder_path` option is used.
|
46
|
-
- `
|
47
|
-
- `
|
46
|
+
- `destination_file_name` : The name which the uploaded file should be renamed to. By default the file name will be the same as the file being uploaded. The `destination_file_name` option is only used for a single file upload, it does not work for multiple file requests.
|
47
|
+
- `queue_processing` : A true or false value indicating if the processing of the data should be queued or processed immediately. A response with "queued_processing" will be faster because the resposne doesn't wait on the system to complete processing the data. However, because an queued processing response does not wait for the data to complete processing then the response will not contain any information about the data which was just uploaded. Use queued processing only if you do not need to know the details of the upload. Additionally you can use the `webhook_url` to post back the uploads details once it's processed. Default is false.
|
48
|
+
- `webhook_url` : A URL which the system should `POST` the response to. This works for both immediate processing or queued processing calls. The data sent to the `webhook_url` will be the same as the data that is responded in a synchronous response, and is sent within the `data` parameter. The format sent can be in either `json` or `xml` by using the `webhook_format` parameter. By default there is no webhook URL.
|
48
49
|
- `webhook_format` : When a `webhook_url` is provided, you can have the data formatted as either `json` or `xml`. The defautl format is `json`.
|
49
50
|
|
50
51
|
### Upload One File: `source_file_path`
|
data/lib/cdnconnect_api.rb
CHANGED
@@ -25,7 +25,7 @@ module CDNConnect
|
|
25
25
|
class APIClient
|
26
26
|
|
27
27
|
@@application_name = 'cdnconnect-api-ruby'
|
28
|
-
@@application_version = '0.2.
|
28
|
+
@@application_version = '0.2.4'
|
29
29
|
@@user_agent = @@application_name + ' v' + @@application_version
|
30
30
|
@@api_host = 'https://api.cdnconnect.com'
|
31
31
|
@@api_version = 'v1'
|
@@ -140,19 +140,25 @@ module CDNConnect
|
|
140
140
|
# A true or false value indicating if this call should recursively upload all of the
|
141
141
|
# local folder's sub-folders, and their sub-folders, etc. This option is only used
|
142
142
|
# when the `source_folder_path` option is used. Default is true.
|
143
|
-
# - <code>:
|
144
|
-
#
|
145
|
-
#
|
146
|
-
#
|
147
|
-
#
|
148
|
-
#
|
149
|
-
#
|
143
|
+
# - <code>:destination_file_name</code> -
|
144
|
+
# The name which the uploaded file should be renamed to. By default the file name
|
145
|
+
# will be the same as the file being uploaded. The `destination_file_name` option is
|
146
|
+
# only used for a single file upload, it does not work for multiple file requests.
|
147
|
+
# - <code>queue_processing/code> -
|
148
|
+
# A true or false value indicating if the processing of the data should be queued or
|
149
|
+
# processed immediately. A response with "queued_processing"
|
150
|
+
# will be faster because the resposne doesn't wait on the system to complete
|
151
|
+
# processing the data. However, because an queued processing response does not wait
|
152
|
+
# for the data to complete processing then the response will not contain any information
|
153
|
+
# about the data which was just uploaded. Use queued processing only if you do not
|
154
|
+
# need to know the details of the upload. Additionally you can use the `webhook_url`
|
155
|
+
# to post back the uploads details once it's processed. Default is false.
|
150
156
|
# - <code>:webhook_url</code> -
|
151
|
-
# A URL which the system should `POST` the response to. This works for both
|
152
|
-
#
|
153
|
-
# data that is responded in a synchronous response, and is sent
|
154
|
-
# parameter. The format sent can be in either `json` or `xml` by
|
155
|
-
# `webhook_format` parameter. By default there is no webhook URL.
|
157
|
+
# A URL which the system should `POST` the response to. This works for both immediate
|
158
|
+
# processing or queued processing calls. The data sent to the `webhook_url` will be
|
159
|
+
# the same as the data that is responded in a synchronous response, and is sent
|
160
|
+
# within the `data` parameter. The format sent can be in either `json` or `xml` by
|
161
|
+
# using the `webhook_format` parameter. By default there is no webhook URL.
|
156
162
|
# - <code>:webhook_format</code> -
|
157
163
|
# When a `webhook_url` is provided, you can have the data formatted as either `json`
|
158
164
|
# or `xml`. The defautl format is `json`.
|
@@ -200,9 +206,10 @@ module CDNConnect
|
|
200
206
|
|
201
207
|
# Build the data that gets sent in the POST request
|
202
208
|
post_data = build_post_data(destination_path,
|
209
|
+
destination_file_name = options[:destination_file_name],
|
203
210
|
max_files_per_request = 25,
|
204
211
|
max_request_size = 25165824,
|
205
|
-
|
212
|
+
queue_processing = options.fetch(:queue_processing, false),
|
206
213
|
webhook_url = options[:webhook_url],
|
207
214
|
webhook_format = options[:webhook_format])
|
208
215
|
|
@@ -254,7 +261,7 @@ module CDNConnect
|
|
254
261
|
##
|
255
262
|
# Build the POST data that gets sent in the request
|
256
263
|
# @!visibility private
|
257
|
-
def build_post_data(destination_path, max_files_per_request = 25, max_request_size = 25165824,
|
264
|
+
def build_post_data(destination_path, destination_file_name = nil, max_files_per_request = 25, max_request_size = 25165824, queue_processing = false, webhook_url = nil, webhook_format = nil)
|
258
265
|
# @active_uploads will hold all of the upload keys
|
259
266
|
# which are actively being uploaded.
|
260
267
|
@active_uploads = []
|
@@ -265,9 +272,13 @@ module CDNConnect
|
|
265
272
|
# have the API also create the next upload url
|
266
273
|
post_data[:create_upload_url] = 'true'
|
267
274
|
|
268
|
-
#
|
269
|
-
#
|
270
|
-
post_data[:
|
275
|
+
# the set what the file name will be. By default it will be named the same as
|
276
|
+
# the uploaded file. This will only work for single file uploads.
|
277
|
+
post_data[:destination_file_name] = destination_file_name
|
278
|
+
|
279
|
+
# Processing of the data can be queued. However, an `queue_processing` response
|
280
|
+
# will not contain any information about the data uploaded.
|
281
|
+
post_data[:queue_processing] = queue_processing
|
271
282
|
|
272
283
|
# send with the post data the webhook_url if there is one
|
273
284
|
if webhook_url != nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cdnconnect-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Bradley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|