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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/lib/cdnconnect_api.rb +29 -18
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c28429da3abb529aacec571e7da9527e2dd06cf
4
- data.tar.gz: f5fdbb59e89f3b6aafc1a942d43cf32b8bbe97ee
3
+ metadata.gz: b6b1028c11c95a10a423d91d02d7355f2521c09c
4
+ data.tar.gz: 93c36127d3c3036ffb4c22f14d04b7170fc66a02
5
5
  SHA512:
6
- metadata.gz: 3c49d32e1f6a796f7ce104d8f06e2c3425d4e3fb6c52c0fe9494b8aad0dd26ae328f7642fe3245291250eabdd6b8d0a65709211fabbfdbca14ff505bb060c9bd
7
- data.tar.gz: ed852974c26388f86a7c80054d4d2f66f4ac277567bf49de6b0e8fa58902d95b149d3aa91f3097710b82f3f03cb13fa59d83a18281f610f554c7d2c9ca306166
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.3
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
- - `async` : A true or false value indicating if the processing of the data should be asynchronous or not. The default value is false meaning that the processing of the data will be synchronous. An async response will be faster because the resposne doesn't wait on the system to complete processing the data. However, because an async 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 async only if you do not need to know the details of the upload.
47
- - `webhook_url` : A URL which the system should `POST` the response to. This works for both synchronous and asynchronous 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.
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`
@@ -25,7 +25,7 @@ module CDNConnect
25
25
  class APIClient
26
26
 
27
27
  @@application_name = 'cdnconnect-api-ruby'
28
- @@application_version = '0.2.3'
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>:async</code> -
144
- # A true or false value indicating if the processing of the data should be asynchronous
145
- # or not. The default value is false. An async response will be faster because
146
- # the resposne doesn't wait on the system to complete processing the data. However,
147
- # because an async response does not wait for the data to complete processing then the
148
- # response will not contain any information about the data which was just uploaded.
149
- # Use async only if you do not need to know the details of the upload.
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 synchronous
152
- # and asynchronous calls. The data sent to the `webhook_url` will be the same as the
153
- # data that is responded in a synchronous response, and is sent within the `data`
154
- # parameter. The format sent can be in either `json` or `xml` by using the
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
- async = options.fetch(:async, false),
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, async = false, webhook_url = nil, webhook_format = nil)
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
- # Processing of the data can be async. However, an async response will
269
- # not contain any information about the data uploaded.
270
- post_data[:async] = async
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.3
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-07-20 00:00:00.000000000 Z
11
+ date: 2013-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday