lib/finapps/rest/operators.rb in finapps-4.0.3 vs lib/finapps/rest/operators.rb in finapps-4.0.4
- old
+ new
@@ -5,23 +5,24 @@
module FinApps
module REST
class Operators < FinAppsCore::REST::Resources
include FinApps::Utils::QueryBuilder
- def list(params=nil)
+ def list(params = nil)
return super if params.nil?
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params' unless params.is_a? Hash
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
+
super build_query_path(end_point, params)
end
def show(id)
not_blank(id, :operator_id)
super id
end
- def create(params, path=nil)
+ def create(params, path = nil)
not_blank(params, :params)
super params, path
end
def update(id, params)
@@ -33,11 +34,12 @@
end
def update_password(params)
# update password for current operator, need authorization session in header
not_blank(params, :params)
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.' unless validates params
+ raise FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params
+
path = "#{end_point}/password/change"
create params, path
end
@@ -58,14 +60,14 @@
filter.merge!(role_query(params[:role])) if params[:role]
filter
end
def search_query(term)
- {"last_name": term}
+ { "last_name": term }
end
def role_query(role)
- role.is_a?(Array) ? {"role": {"$in": role.map(&:to_i)}} : {"role": role.to_i}
+ role.is_a?(Array) ? { "role": { "$in": role.map(&:to_i) } } : { "role": role.to_i }
end
end
end
end