Sha256: f0eb426fb5f0554bfd13bf10e29376ed8a8b5783cf10b66decc0658f213dc1c8

Contents?: true

Size: 876 Bytes

Versions: 15

Compression:

Stored size: 876 Bytes

Contents

# frozen_string_literal: true
module FinApps
  module REST
    class Consumers < FinAppsCore::REST::Resources # :nodoc:
      # @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

15 entries across 15 versions & 1 rubygems

Version Path
finapps-2.2.22 lib/finapps/rest/consumers.rb
finapps-2.2.21 lib/finapps/rest/consumers.rb
finapps-2.2.20 lib/finapps/rest/consumers.rb
finapps-2.2.19 lib/finapps/rest/consumers.rb
finapps-2.2.18 lib/finapps/rest/consumers.rb
finapps-2.2.17 lib/finapps/rest/consumers.rb
finapps-2.2.16 lib/finapps/rest/consumers.rb
finapps-2.2.15 lib/finapps/rest/consumers.rb
finapps-2.2.14 lib/finapps/rest/consumers.rb
finapps-2.2.13 lib/finapps/rest/consumers.rb
finapps-2.2.12 lib/finapps/rest/consumers.rb
finapps-2.2.11 lib/finapps/rest/consumers.rb
finapps-2.2.10 lib/finapps/rest/consumers.rb
finapps-2.2.9 lib/finapps/rest/consumers.rb
finapps-2.2.8 lib/finapps/rest/consumers.rb