Sha256: 73e75b64bc8c08d1d0d6e58af633db15861ec2b15e613640d69c00998ea1517e

Contents?: true

Size: 659 Bytes

Versions: 3

Compression:

Stored size: 659 Bytes

Contents

module RockRMS
  class RecurringDonation
    MAP = {
      id: 'Id',
      person_id: 'AuthorizedPersonAliasId',
      transaction_details: 'ScheduledTransactionDetails'
    }.freeze

    def self.format(data)
      if data.is_a?(Array)
        data.map { |object| format_single(object) }
      else
        format_single(data)
      end
    end

    def self.format_single(data)
      MAP.each.with_object({}) do |(l, r), object|
        object[l] = if l == :transaction_details
                      RockRMS::RecurringDonationDetails.format(data[r])
                    else
                      data[r]
                    end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rock_rms-1.1.0 lib/rock_rms/responses/recurring_donation.rb
rock_rms-1.0.1 lib/rock_rms/responses/recurring_donation.rb
rock_rms-1.0.0 lib/rock_rms/responses/recurring_donation.rb