Skip to content
Snippets Groups Projects
Commit e62c27ca authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Start splitting separate protocols from the API

parent 5e3cabea
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,13 @@ module MatrixSdk
autoload :MatrixConnectionError, 'matrix_sdk/errors'
autoload :MatrixUnexpectedResponseError, 'matrix_sdk/errors'
module Protocols
autoload :AS, 'matrix_sdk/protocols/as'
autoload :CS, 'matrix_sdk/protocols/cs'
autoload :IS, 'matrix_sdk/protocols/is'
autoload :SS, 'matrix_sdk/protocols/ss'
end
def self.debug!
logger.level = :debug
end
......
......@@ -21,6 +21,7 @@ module MatrixSdk
# @param homeserver [String,URI] The URL to the Matrix homeserver, without the /_matrix/ part
# @param params [Hash] Additional parameters on creation
# @option params [Symbol[]] :protocols The protocols to include (:AS, :CS, :IS, :SS), defaults to :CS
# @option params [String] :address The connection address to the homeserver, if different to the HS URL
# @option params [Integer] :port The connection port to the homeserver, if different to the HS URL
# @option params [String] :access_token The access token to use for the connection
......@@ -39,6 +40,11 @@ module MatrixSdk
@homeserver.path.gsub!(/\/?_matrix\/?/, '') if @homeserver.path =~ /_matrix\/?$/
raise 'Please use the base URL for your HS (without /_matrix/)' if @homeserver.path.include? '/_matrix/'
@protocols = params.fetch(:protocols, %i[CS])
@protocols.sort.reverse.each do |prot|
extend MatrixSdk::Protocols.const_get(prot)
end
@connection_address = params.fetch(:address, nil)
@connection_port = params.fetch(:port, nil)
@access_token = params.fetch(:access_token, nil)
......
module MatrixSdk::Protocols::AS
raise 'Not implemented yet'
end
module MatrixSdk::Protocols::CS
end
module MatrixSdk::Protocols::IS
raise 'Not implemented yet'
end
module MatrixSdk::Protocols::SS
raise 'Not implemented yet'
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment