I am quite new to ruby and am programming an application to send sms
using rest_client gem. I so far have code on one of my modules which
tries to send an sms to a number. It gives the 403 error -
My code in the module looks as follows - before adding this code i had a
simple enter number and enter message text boxes with the usual
edit/add/delete options.
I am quite new to ruby and am programming an application to send sms
using rest_client gem. I so far have code on one of my modules which
tries to send an sms to a number. It gives the 403 error -
My code in the module looks as follows - before adding this code i had a
simple enter number and enter message text boxes with the usual
edit/add/delete options.
:number => '079945460812', :nested => { :message => 'working from
inside' }
RestClient.get 'https://...@gmail.com:password@API_URL'
end
My user name is in the form of an email. let me what you think the
problem would be. thanks
First off, it's a bit odd to be making those calls to restclient where
you're making them - they'll happen when the class gets loaded, which
isn't really under your control.
Secondly you don't seem to be using ruby's interpolation properly -
API_URL isn't getting replaced by the value of that constant
Lastly, @ is a special character in a url (since it marks the
separation between the end of the password and the rest of the url),
so you'll need to escape the literal @ in your username (I'd be
surprised if there wasn't a way in rest client to just supply a
username and password rather than have to do that mangling yourself)