messagebird / ruby-rest-api

MessageBird's REST API for Ruby
BSD 2-Clause "Simplified" License
37 stars 46 forks source link

Allowing loading of access token from ENV file #1

Closed mylescc closed 9 years ago

mylescc commented 9 years ago

Allowing the access_token to be loaded directly from an env file, rather than always having to pass it in each time.

prep commented 9 years ago

Hey Miles,

Thank you for your pull request.

Could you give an example on why you'd want this and why not use something like the following?

client = MessageBird::Client.new(ENV['MESSAGE_BIRD_ACCESS_KEY'])
mylescc commented 9 years ago

Hey,

I guess its just to keep code clean. Other clients like yours that I've used allow you to just initialise the client like:

client = MessageBird::Client.new

for example: https://github.com/amro/gibbon/blob/master/lib/gibbon/api.rb and https://github.com/timcraft/nexmo/blob/master/lib/nexmo.rb

This update at least gives you the option to use both.

mylescc commented 9 years ago

Hey, do you think you might merge this PR? I'm about to put our code that uses the message bird gem into production, but I'm using my fork at the moment, but would obviously prefer to use yours, just to make sure its always up to date. Cheers!

prep commented 9 years ago

Hey Miles,

Sure, but before I do, could you change the environment variable from MESSAGE_BIRD_ACCESS_KEY to MESSAGEBIRD_ACCESS_KEY?

mylescc commented 9 years ago

Awesome thanks! Done!