Forum: Ruby Can't get method to accept username/password

Posted by Pierre-Andre M. (pierreandre_m)
on 2012-12-02 00:56
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/BbMobs/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 by Chris Hulan (Guest)
on 2012-12-02 01:29
(Received via mailing list)
string interpolation (the #{...} syntax) only works inside double quotes
Posted by Pierre-Andre M. (pierreandre_m)
on 2012-12-02 02:03
Thank you!!
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.