Sha256: 527b2ec3a00d2a21c3d2ac27b17460469affb9a1e44172f76e69ec2f8a11d637

Contents?: true

Size: 935 Bytes

Versions: 4

Compression:

Stored size: 935 Bytes

Contents

# frozen_string_literal: true
module FinApps
  module REST
    class Consumers < FinAppsCore::REST::Resources # :nodoc:
      using ObjectExtensions
      using StringExtensions

      # @param [String] public_id
      # @return [FinApps::REST::User, Array<String>]
      def show(public_id)
        not_blank(public_id, :public_id)
        super public_id
      end

      # @param [Hash] params
      # @return [Array<String>]
      def update(public_id, params)
        not_blank(public_id, :public_id)
        not_blank(params, :params)

        path = "#{end_point}/#{ERB::Util.url_encode(public_id)}#{'/password' if password_update?(params)}"
        super params, path
      end

      def destroy(public_id)
        not_blank(public_id, :public_id)
        super public_id
      end

      private

      def password_update?(params)
        params.key?(:password) && params.key?(:password_confirm)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
finapps-2.2.7 lib/finapps/rest/consumers.rb
finapps-2.2.6 lib/finapps/rest/consumers.rb
finapps-2.2.5 lib/finapps/rest/consumers.rb
finapps-2.2.4 lib/finapps/rest/consumers.rb