Skip to content

Commit 387f52d

Browse files
authored
Merge pull request #144 from cloudinary/feature/misc_and_params_completion
Feature/misc and params completion
2 parents 291851b + 819912e commit 387f52d

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

src/api.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ exports.create_upload_mapping = (name, callback, options = {})->
250250
call_api("post", 'upload_mappings', params, callback, options)
251251

252252
publishResource = (byKey, value, callback, options={})->
253-
params = api.only(options, "invalidate", "overwrite")
253+
params = api.only(options, "type", "invalidate", "overwrite")
254254
params[byKey] = value
255255
resource_type = options.resource_type ? "image"
256256
uri = ["resources", resource_type, "publish_resources"]

src/utils.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ exports.generate_transformation_string = (options) ->
351351
e: normalize_expression(effect)
352352
fl: flags
353353
h: normalize_expression(height)
354+
ki: normalize_expression(utils.option_consume(options, "keyframe_interval"))
354355
l: overlay
355356
o: normalize_expression(utils.option_consume(options, "opacity"))
356357
q: normalize_expression(utils.option_consume(options, "quality"))

test/api_spec.coffee

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -838,9 +838,9 @@ describe "api", ->
838838
return done(new Error error.message) if error?
839839
done()
840840
true
841-
it "by public id", (done)->
841+
it "should publish by public id", (done)->
842842
@timeout helper.TIMEOUT_LONG
843-
cloudinary.v2.api.publish_by_ids [publishTestId], (error, result)->
843+
cloudinary.v2.api.publish_by_ids [publishTestId], type: "authenticated", (error, result)->
844844
return done(new Error error.message) if error?
845845
published = result.published
846846
expect(published).not.to.be(null)
@@ -849,7 +849,7 @@ describe "api", ->
849849
expect(published[0].url).to.match(/\/upload\//)
850850
done()
851851
true
852-
it "by prefix", (done)->
852+
it "should publish by prefix", (done)->
853853
@timeout helper.TIMEOUT_LONG
854854
cloudinary.v2.api.publish_by_prefix publishTestId[0..-2], (error, result)->
855855
return done(new Error error.message) if error?
@@ -860,7 +860,7 @@ describe "api", ->
860860
expect(published[0].url).to.match(/\/upload\//)
861861
done()
862862
true
863-
it "by tag", (done)->
863+
it "should publish by tag", (done)->
864864
@timeout helper.TIMEOUT_LONG
865865
cloudinary.v2.api.publish_by_tag publishTestTag, (error, result)->
866866
return done(new Error error.message) if error?
@@ -871,6 +871,16 @@ describe "api", ->
871871
expect(published[0].url).to.match(/\/upload\//)
872872
done()
873873
true
874+
it "should return empty when explicit given type doesn't match resource", (done)->
875+
@timeout helper.TIMEOUT_LONG
876+
cloudinary.v2.api.publish_by_ids [publishTestId], type: "private", (error, result)->
877+
return done(new Error error.message) if error?
878+
published = result.published
879+
expect(published).not.to.be(null)
880+
expect(published.length).to.be(0)
881+
done()
882+
true
883+
874884
describe "access_mode", ->
875885
i = 0
876886
@timeout helper.TIMEOUT_LONG

test/video_spec.coffee

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ describe "video tag helper", ->
3333
html_width : "200",
3434
video_codec : {codec: "h264"},
3535
audio_codec : "acc",
36-
start_offset: 3
36+
start_offset: 3,
37+
keyframe_interval: "2.0"
3738
}
38-
expected_url = VIDEO_UPLOAD_PATH + "ac_acc,so_3,vc_h264/movie"
39+
expected_url = VIDEO_UPLOAD_PATH + "ac_acc,ki_2.0,so_3,vc_h264/movie"
3940
expect(cloudinary.video("movie", options)).to.eql(
4041
"<video height='100' poster='#{expected_url}.jpg' src='#{expected_url}.mp4' width='200'></video>")
4142

@@ -51,15 +52,15 @@ describe "video tag helper", ->
5152
delete options['html_width']
5253
options['width'] = 250
5354
options['crop'] = 'scale'
54-
expected_url = VIDEO_UPLOAD_PATH + "ac_acc,c_scale,so_3,vc_h264,w_250/movie"
55+
expected_url = VIDEO_UPLOAD_PATH + "ac_acc,c_scale,ki_2.0,so_3,vc_h264,w_250/movie"
5556
expect(cloudinary.video("movie", options)).to.eql(
5657
"<video poster='#{expected_url}.jpg' width='250'>" +
5758
"<source src='#{expected_url}.webm' type='video/webm'>" +
5859
"<source src='#{expected_url}.mp4' type='video/mp4'>" +
5960
"<source src='#{expected_url}.ogv' type='video/ogg'>" +
6061
"</video>")
6162

62-
expected_url = VIDEO_UPLOAD_PATH + "ac_acc,c_fit,so_3,vc_h264,w_250/movie"
63+
expected_url = VIDEO_UPLOAD_PATH + "ac_acc,c_fit,ki_2.0,so_3,vc_h264,w_250/movie"
6364
options['crop'] = 'fit'
6465
expect(cloudinary.video("movie", options)).to.eql(
6566
"<video poster='#{expected_url}.jpg'>" +

0 commit comments

Comments
 (0)