Sha256: cb7e22c8aee4ed5be618233d9d262453cc97f25e0c2a3ff0198c6ae8f765341e
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true require_relative '../utils/query_builder' module FinApps module REST class Operators < FinAppsCore::REST::Resources include FinApps::Utils::QueryBuilder def list(params=nil) return super if params.nil? raise FinAppsCore::InvalidArgumentsError.new '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) not_blank(params, :params) super params, path end def update(id, params) not_blank(id, :operator_id) not_blank(params, :params) path = "#{end_point}/#{ERB::Util.url_encode(id)}" super params, path 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 path = "#{end_point}/password/change" create params, path end def destroy(id) not_blank(id, :operator_id) super id end private def validates(params) params.key?(:password) && params[:password] && params.key?(:password_confirm) && params[:password_confirm] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
finapps-2.3.3 | lib/finapps/rest/operators.rb |
finapps-2.3.2 | lib/finapps/rest/operators.rb |
finapps-2.3.1 | lib/finapps/rest/operators.rb |