Sha256: 5566c7d80fb8ec854bdab5722e7349224e8f360bb101b85cd5c71c86cdb742f3

Contents?: true

Size: 969 Bytes

Versions: 21

Compression:

Stored size: 969 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

21 entries across 21 versions & 1 rubygems

Version Path
finapps-5.0.3 lib/finapps/rest/consumers.rb
finapps-5.0.2 lib/finapps/rest/consumers.rb
finapps-5.0.1 lib/finapps/rest/consumers.rb
finapps-5.0.0 lib/finapps/rest/consumers.rb
finapps-4.0.16 lib/finapps/rest/consumers.rb
finapps-4.0.15 lib/finapps/rest/consumers.rb
finapps-4.0.14 lib/finapps/rest/consumers.rb
finapps-4.0.12 lib/finapps/rest/consumers.rb
finapps-4.0.11 lib/finapps/rest/consumers.rb
finapps-4.0.10 lib/finapps/rest/consumers.rb
finapps-4.0.9 lib/finapps/rest/consumers.rb
finapps-4.0.8 lib/finapps/rest/consumers.rb
finapps-4.0.7 lib/finapps/rest/consumers.rb
finapps-4.0.6 lib/finapps/rest/consumers.rb
finapps-4.0.5 lib/finapps/rest/consumers.rb
finapps-4.0.4 lib/finapps/rest/consumers.rb
finapps-4.0.3 lib/finapps/rest/consumers.rb
finapps-4.0.2 lib/finapps/rest/consumers.rb
finapps-4.0.1 lib/finapps/rest/consumers.rb
finapps-3.0.7 lib/finapps/rest/consumers.rb