cdnconnect-api 0.3.0 → 0.3.1
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 +6 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c769230e6585f7cf8e4a9cb4693c3d2f4cde3c13
|
4
|
+
data.tar.gz: 030324b9ac21ba79b319885bce287c4326abd3bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c996b2f72c90dd2b0233ba26caac1b8c99ab46505323f8ad8447769a5420417117f8bfd51a5538320601a62d30ae12f4d96938c4431c3f2dd08fb3863434d478
|
7
|
+
data.tar.gz: 5d783487d3aa20eed0831e930fd265b377411812dbf8f79ab5bc33e397d68a88c93db4b3f64a4f07c8ff370f8b532bb2b4b758cc277f185e4e3daed24280e205
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# CDN Connect API Ruby Client, v0.3.
|
1
|
+
# CDN Connect API Ruby Client, v0.3.1
|
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
|
|
@@ -44,7 +44,7 @@ Below are the possible parameters for the `upload` method. You must set `destina
|
|
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
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
|
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 true.
|
48
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.
|
49
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`.
|
50
50
|
|
@@ -114,7 +114,7 @@ In the example below, if the folders `images` or `movies` did not already exist
|
|
114
114
|
|
115
115
|
## API Response
|
116
116
|
|
117
|
-
HTTP responses will be formatted in json, but the library takes the HTTP response and decodes into a hash for the `APIResponse` class. The `APIResponse` class is used to simpilfy things by using helper functions to read response data. Responses from the API are all structured the same way, and this class is used as a small wrapper to make it easier to get data from it.
|
117
|
+
HTTP responses will be formatted in json, but the library takes the HTTP response and decodes into a hash for the `APIResponse` class. The `APIResponse` class is used to simpilfy things by using helper functions to read response data. Responses from the API are all structured the same way, and this class is used as a small wrapper to make it easier to get data from it. Note: Be sure to set the :queue_processing => false upload option if you would like to get the upload info the upload's response.
|
118
118
|
|
119
119
|
|
120
120
|
- `files` : `array` : A list of all the files that were uploaded. Each file in the array is a hash.
|
@@ -133,6 +133,7 @@ HTTP responses will be formatted in json, but the library takes the HTTP respons
|
|
133
133
|
|
134
134
|
if response.is_success
|
135
135
|
|
136
|
+
# Be sure to set the :queue_processing => false upload option if you would like to get the upload info like the response below
|
136
137
|
for file in response.files
|
137
138
|
puts "Uploaded " + file["name"]
|
138
139
|
end
|
data/lib/cdnconnect_api.rb
CHANGED
@@ -26,7 +26,7 @@ module CDNConnect
|
|
26
26
|
class APIClient
|
27
27
|
|
28
28
|
@@application_name = 'cdnconnect-api-ruby'
|
29
|
-
@@application_version = '0.3.
|
29
|
+
@@application_version = '0.3.1'
|
30
30
|
@@user_agent = @@application_name + ' v' + @@application_version
|
31
31
|
@@api_host = 'https://api.cdnconnect.com'
|
32
32
|
@@api_version = 'v1'
|
@@ -250,6 +250,9 @@ module CDNConnect
|
|
250
250
|
# put the upload url back in the list
|
251
251
|
# of prefetched urls so it can be reused
|
252
252
|
set_prefetched_upload_url(destination_path, upload_url)
|
253
|
+
|
254
|
+
# take a breath
|
255
|
+
sleep 1.5
|
253
256
|
else
|
254
257
|
# successful upload, clear out the active upload queue
|
255
258
|
# and remove uploaded files from the upload queue
|
@@ -609,6 +612,8 @@ module CDNConnect
|
|
609
612
|
return response
|
610
613
|
end
|
611
614
|
@logger.error(response.body)
|
615
|
+
# take a breath
|
616
|
+
sleep 1.5
|
612
617
|
i += 1
|
613
618
|
end while i <= 3
|
614
619
|
end
|
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.3.
|
4
|
+
version: 0.3.1
|
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-09-
|
11
|
+
date: 2013-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.5
|
33
|
+
version: 0.4.5
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.5
|
40
|
+
version: 0.4.5
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|