Sha256: 5b0b5fbec63af00e93440a5931f2572910b61ad81d661b6affc1a8bc413bae26

Contents?: true

Size: 979 Bytes

Versions: 20

Compression:

Stored size: 979 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 create(params)
        not_blank(params, :params)
        super params
      end

      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

20 entries across 20 versions & 1 rubygems

Version Path
finapps-5.0.24 lib/finapps/rest/consumers.rb
finapps-5.0.23 lib/finapps/rest/consumers.rb
finapps-5.0.22 lib/finapps/rest/consumers.rb
finapps-5.0.21 lib/finapps/rest/consumers.rb
finapps-5.0.20 lib/finapps/rest/consumers.rb
finapps-5.0.19 lib/finapps/rest/consumers.rb
finapps-5.0.17 lib/finapps/rest/consumers.rb
finapps-5.0.16 lib/finapps/rest/consumers.rb
finapps-5.0.15 lib/finapps/rest/consumers.rb
finapps-5.0.14 lib/finapps/rest/consumers.rb
finapps-5.0.13 lib/finapps/rest/consumers.rb
finapps-5.0.12 lib/finapps/rest/consumers.rb
finapps-5.0.11 lib/finapps/rest/consumers.rb
finapps-5.0.10 lib/finapps/rest/consumers.rb
finapps-5.0.9 lib/finapps/rest/consumers.rb
finapps-5.0.8 lib/finapps/rest/consumers.rb
finapps-5.0.7 lib/finapps/rest/consumers.rb
finapps-5.0.6 lib/finapps/rest/consumers.rb
finapps-5.0.5 lib/finapps/rest/consumers.rb
finapps-5.0.4 lib/finapps/rest/consumers.rb