lib/smsapi/server.rb in smsapi-client-0.3.1 vs lib/smsapi/server.rb in smsapi-client-1.0.0
- old
+ new
@@ -1,10 +1,9 @@
module Smsapi
class Server
- def initialize(username, password)
- @username = username
- @password = password
+ def initialize(token)
+ @token = token
@connection = setup_connection
end
def user(params = {})
api_response = make_request(Smsapi::API[:user_path], params)
@@ -19,20 +18,15 @@
private
def setup_connection
Smsapi::Server::Connection.new(
Smsapi::API[:uri],
- Smsapi::API[:port]
+ Smsapi::API[:port],
+ @token
)
end
def make_request(path, params)
- params = authorize_params(params)
- response = @connection.post(path, params)
- response.body
- end
-
- def authorize_params(params)
- params.merge(username: @username, password: @password)
+ @connection.post(path, params).body
end
end
end