Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default API endpoint switched #840

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/travis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module Travis
autoload :Pro, 'travis/pro'
autoload :Version, 'travis/version'

include Client::Namespace.new(Client::ORG_URI)
include Client::Namespace.new(Client::COM_URI)
end
4 changes: 2 additions & 2 deletions lib/travis/cli/api_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ def default_endpoint
end

def detected_endpoint
default_endpoint || Travis::Client::ORG_URI
default_endpoint || Travis::Client::COM_URI
end

def endpoint_option
return "" if org? and detected_endpoint?
return "" if pro? and detected_endpoint?
return " --org" if org?
return " --pro" if pro?

Expand Down
3 changes: 2 additions & 1 deletion lib/travis/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@

module Travis
module Client

ORG_URI = 'https://api.travis-ci.org/'
COM_URI = 'https://api.travis-ci.com/'

def self.new(options = {})
options[:uri] ||= ORG_URI if options.is_a? Hash and not options['uri']
options[:uri] ||= COM_URI if options.is_a?(Hash) && !(options['uri'])
Session.new(options)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/travis/client/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Session
attr_reader :connection, :headers, :access_token, :instruments, :faraday_adapter, :agent_info, :ssl
attr_accessor :debug_http

def initialize(options = Travis::Client::ORG_URI)
def initialize(options = Travis::Client::COM_URI)
@headers = {}
@cache = {}
@instruments = []
Expand Down