Module: MangoPay::ReadOnlyFields

Defined in:
lib/mangopay/common/read_only_fields.rb

Overview

Assures that no fields which are considered read-only remain in a hash meant to be sent as a request body.

Class Method Summary collapse

Class Method Details

.remove_from!(hash) ⇒ Hash

Checks whether any of the fields marked as read-only are present in the given hash. Removes those which are.

noinspection RubyResolve

Parameters:

  • +hash+ (Hash)

    hash to check for read-only fields

Returns:

  • (Hash)

    the given hash minus any read-only fields



20
21
22
23
24
# File 'lib/mangopay/common/read_only_fields.rb', line 20

def remove_from!(hash)
  @read_only_fields.each do |field|
    hash.delete field
  end
end