dncrht / imgur

Ruby interface to the Imgur's authenticated API
MIT License
35 stars 13 forks source link

wrong number of arguments (0 for 1) #5

Closed mldoscar closed 8 years ago

mldoscar commented 8 years ago

Hello, i'm using imgurapi-3.0.0, ruby 2.1.0, rails 4.2.4

I've linked my imgur account to my rails project successfully, but now I have the following issue:

The only problem I have is that I can't upload an image to Imgur server. Once I write this code (pretty similar to imgurapi documentation):

img_url = "#{Rails.root}/public/images/user.jpg" #this is a valid and existent image file
@my_image = @imgur_session.image.image.upload(img_url) #line where exception is thrown

This Exception is thrown:

It seems like a parameter must be set on the second '.image' property, like this:

@imgur_session.image.image(A_PARAMETER_HERE_IS_OBLIGATORY).upload(img_url)

but even if i set it as an empty string like: @imgur_session.image.image('') it will throw another exception like Please provide a valid image identificator, because what I want is to upload a picture, not showing an existent file.

I think there might be a way to correct this allowing no parameters in order to upload an image, Please feel free to correct me, or help me,

Regards, my friends.

mldoscar commented 8 years ago

Oh, shh... Never mind. I've found another post with the solution: https://github.com/dncrht/imgur/issues/3#issue-118429741

Regards