Sha256: 3575b3f7550464ebf7459f5e977f7e8daa0cd390c3302236f3b7701e608dce5b

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

Contents

module RockRMS
  module Responses
    class Person
      MAP = {
        id:         'Id',
        name:       'FullName',
        email:      'Email',
        first_name: 'FirstName',
        last_name:  'LastName',
        giving_id:  'GivingId',
        alias_id:   'PrimaryAliasId',
        connection_status_value_id: 'ConnectionStatusValueId'
      }.freeze

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

      private

      def self.format_single(data)
        MAP.each.with_object({}) do |(l,r), object|
          object[l] = data[r]
        end
      end
    end
  end

  # for backwards compatibility
  Person = Responses::Person
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rock_rms-1.2.0 lib/rock_rms/responses/person.rb
rock_rms-1.1.0 lib/rock_rms/responses/person.rb