Lepozepo / cloudinary

MIT License
94 stars 42 forks source link

more methods #81

Open frankapimenta opened 8 years ago

frankapimenta commented 8 years ago

is it possible to have the remove_tag methods and so?

Lepozepo commented 8 years ago

That would be good. I need to give this package some love, I'll see what I can do over the week ^_^

nicooprat commented 8 years ago

What's more, looks like the official Cloudinary library has evolved a lot (v2): https://github.com/cloudinary/cloudinary_js/releases

Lepozepo many thanks for your work :)

frankapimenta commented 8 years ago

Are there new functions published?

Thank you for your work :)

Lepozepo commented 8 years ago

@frankapimenta I haven't added new helpers, I did upgrade dependencies though. I need to watch those packages to keep up with them. I'm going to try to give S3 some love too then I'll come back to this one to add some more helpers.

frankapimenta commented 8 years ago

@Lepozepo I would require to have the remove tag helper. If you tell me where to start with it would make things easier to me and I would do the pull request. I'm short in time ( like everybody else I guess :D )

Lepozepo commented 8 years ago

@frankapimenta Sounds like that would go somewhere around here: https://github.com/Lepozepo/cloudinary/blob/master/client/functions.coffee#L41 but build it however you want. If it works and doesn't break things I'll accept. I don't care much for code style so long as results are met. I'll move things around after ^_^

frankapimenta commented 8 years ago

Would this (from http://cloudinary.com/documentation/image_upload_api_reference#api_example_12) as meteor call:


"c.remove_tag": (tag, publicIds) ->
    @unblock()
    check tag, String
    check publicIds, Array

    if Cloudinary.rules.delete
      @public_id = public_id
      auth_function = _.bind Cloudinary.rules.delete,this
      if not auth_function()
        throw new Meteor.Error "Unauthorized", "Delete not allowed"

    future = new Future()

    Cloudinary.uploader.remove_tag tag, publicIds, (result) ->
      future.return result

    return future.wait()

and this as client side function:


remove_tag: (tag, publicIds, callback) ->

  Meteor.call "c.remove_tag", tag, publicIds, (error,result) ->
    if error
        return callback and callback error, null
    else
        if result.deleted[public_id] and result.deleted[public_id] is "not_found"
          return callback and callback result, null
        else
          return callback and callback null,result

be ok to you?

Lepozepo commented 8 years ago

Hmm, looking at the way all the other functions work maybe we can iterate over each and wrapAsync instead. Then we wouldn't need to do much extra work if they update their API.

frankapimenta commented 8 years ago

any news regarding this? :)