From: Chris Hulan Date: 2012-12-02T09:27:28+09:00 Subject: Re: Can't get method to accept username/password --bcaec50162bd78fdbe04cfd3b22b Content-Type: text/plain; charset=ISO-8859-1 string interpolation (the #{...} syntax) only works inside double quotes On Sat, Dec 1, 2012 at 6:56 PM, Pierre-Andre M. wrote: > I'm new to Ruby... > > Trying to write a method that accepts username and password string. > > # My method > def getRepos(username, password) > github = Github.new do |config| > config.basic_auth = '#{username}:#{password}' > end > github.repos.list :org => 'MyOrg' > > end > > > # My Call > repos_json = getRepos("jstew","spankyDooLittle") > > # My Response: > Github::Error::Unauthorized: GET > https://api.github.com/orgs/BbMobile/repos: 401 Bad credentials > > FYI, when I put the credentials directly into the method it works. I > have tried with and without quotes...any suggestions? > > -- > Posted via http://www.ruby-forum.com/. > > --bcaec50162bd78fdbe04cfd3b22b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable string interpolation (the #{...} syntax) only works inside double quotes

On Sat, Dec 1, 2= 012 at 6:56 PM, Pierre-Andre M. <lists@ruby-forum.com> wr= ote:
I'm new to Ruby...

Trying to write a method that accepts username and password string.

# My method
def getRepos(username, password)
=A0 github =3D Github.new do |config|
=A0 =A0 config.basic_auth =3D '#{username}:#{password}'
=A0 end
=A0 github.repos.list :org =3D> 'MyOrg'

end


# My Call
repos_json =3D getRepos("jstew","spankyDooLittle")

# My Response:
Github::Error::Unauthorized: GET
ht= tps://api.github.com/orgs/BbMobile/repos: 401 Bad credentials

FYI, when I put the credentials directly into the method it works. =A0I
have tried with and without quotes...any suggestions?

--
Posted via http://= www.ruby-forum.com/.


--bcaec50162bd78fdbe04cfd3b22b--