Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Add hosts config option
Browse files Browse the repository at this point in the history
  • Loading branch information
timcraft committed Feb 3, 2020
1 parent c3a0946 commit e06bf8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/nexmo/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def initialize
self.api_key = ENV['NEXMO_API_KEY']
self.api_secret = ENV['NEXMO_API_SECRET']
self.application_id = nil
self.hosts = {}
self.logger = (defined?(Rails.logger) && Rails.logger) || ::Logger.new(nil)
self.private_key = nil
self.signature_secret = ENV['NEXMO_SIGNATURE_SECRET']
Expand Down Expand Up @@ -86,6 +87,8 @@ def application_id

attr_accessor :app_version

attr_accessor :hosts

# Returns the value of attribute http.
#
# @return [Nexmo::HTTP::Options]
Expand Down
2 changes: 1 addition & 1 deletion lib/nexmo/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(config)

@logger = config.logger

@host = self.class.host
@host = @config.hosts[self.class.host] || self.class.host

@http = Net::HTTP.new(@host, Net::HTTP.https_default_port, p_addr = nil)
@http.use_ssl = true
Expand Down

0 comments on commit e06bf8f

Please sign in to comment.