Skip to content

Allow different configs per client#43

Open
danielcooper wants to merge 2 commits into
traveltime-dev:mainfrom
getcomplete:allow-different-configs-per-client
Open

Allow different configs per client#43
danielcooper wants to merge 2 commits into
traveltime-dev:mainfrom
getcomplete:allow-different-configs-per-client

Conversation

@danielcooper

Copy link
Copy Markdown

The current implementation sets the configuration at a class level - this allows an optional instance level configuration so you can do things like:

# Default client
TravelTime.configure do |config|
  config.application_id = ENV.fetch('TRAVEL_TIME_APP_ID', '')
  config.api_key = ENV.fetch('TRAVEL_TIME_API_KEY', '')
  config.raise_on_failure = true
end

# Client for batch operations
TRAVEL_TIME_BATCH_CLIENT = TravelTime::Client.new.configure do |config|
  config.application_id = ENV.fetch('TRAVEL_TIME_BATCH_APP_ID', '')
  config.api_key = ENV.fetch('TRAVEL_TIME_BATCH_API_KEY', '')
  config.raise_on_failure = true
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant