lib/syncano/resources/user.rb in syncano-3.1.1.beta vs lib/syncano/resources/user.rb in syncano-3.1.1.beta2
- old
+ new
@@ -10,10 +10,20 @@
def self.count(client, scope_parameters = {}, conditions = {})
response = perform_count(client, scope_parameters, conditions)
response.data if response.status
end
+ # Wrapper for api "login" method
+ # @param [Syncano::Clients::Base] client
+ # @param [String] username
+ # @param [String] password
+ # @return [Integer]
+ def self.login(client, username, password)
+ response = perform_login(client, user_name: username, password: password)
+ response.data
+ end
+
private
self.scope_parameters = [:project_id, :collection_id]
# Prepares hash with attributes used in synchronization with Syncano
@@ -39,9 +49,17 @@
# @param [Hash] scope_parameters
# @param [Hash] conditions
# @return [Syncano::Response]
def self.perform_count(client, scope_parameters, conditions)
make_request(client, nil, :count, conditions.merge(scope_parameters))
+ end
+
+ # Executes proper login request
+ # @param [Syncano::Clients::Base] client
+ # @param [Hash] parameters
+ # @return [Syncano::Response]
+ def self.perform_login(client, parameters = {})
+ make_request(client, nil, :login, parameters, :auth_key)
end
end
end
end
\ No newline at end of file