I don't think that it makes a lot of sense use constants this way. URI looks good, but USERNAME and PASSWORD should be changed by developer who uses your gem, constants should be immutable. In your case they are not immutable and it's bad practice. Also I don't see a lot of reasons to set default values to username and password. They should be nil if they were not provided yet.