Sha256: 46d5ef4d9987f969eec9597a56970b125681e6f30077ee52894301f435cd14fe

Contents?: true

Size: 1.67 KB

Versions: 11

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true
module FinApps
  module REST
    class UserInstitutions < FinApps::REST::Resources # :nodoc:
      END_POINT = 'institutions/user'

      using ObjectExtensions
      using StringExtensions

      def list
        path = 'institutions/user'
        super path
      end

      def create(site_id, params)
        raise MissingArgumentsError.new 'Missing argument: site_id.' if site_id.blank?
        raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?

        path = "institutions/site/#{ERB::Util.url_encode(site_id)}/add"

        super params, path
      end

      def show(id)
        raise MissingArgumentsError.new 'Missing Argument: id.' if id.blank?

        path = "#{END_POINT}/#{ERB::Util.url_encode(id)}"
        super id, path
      end

      def credentials_update(id, params)
        raise MissingArgumentsError.new 'Missing Argument: id.' if id.blank?
        raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?

        path = "#{END_POINT}/#{ERB::Util.url_encode(id)}/credentials"
        update params, path
      end

      def mfa_update(id, params)
        raise MissingArgumentsError.new 'Missing Argument: id.' if id.blank?
        raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?

        path = "#{END_POINT}/#{ERB::Util.url_encode(id)}/mfa"
        update params, path
      end

      def destroy(id)
        raise MissingArgumentsError.new 'Missing Argument: id.' if id.blank?

        path = "#{END_POINT}/#{ERB::Util.url_encode(id)}"
        super id, path
      end

      private

      def update(params, path)
        super params, path
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
finapps-2.1.4 lib/finapps/rest/user_institutions.rb
finapps-2.1.3 lib/finapps/rest/user_institutions.rb
finapps-2.1.2 lib/finapps/rest/user_institutions.rb
finapps-2.1.1 lib/finapps/rest/user_institutions.rb
finapps-2.0.30 lib/finapps/rest/user_institutions.rb
finapps-2.0.29 lib/finapps/rest/user_institutions.rb
finapps-2.0.28 lib/finapps/rest/user_institutions.rb
finapps-2.0.27 lib/finapps/rest/user_institutions.rb
finapps-2.0.26 lib/finapps/rest/user_institutions.rb
finapps-2.0.25 lib/finapps/rest/user_institutions.rb
finapps-2.0.24 lib/finapps/rest/user_institutions.rb