Sha256: 3c041c438824fbe51349ff032f30a7564889369442c41153350c09eb6bb206ac

Contents?: true

Size: 465 Bytes

Versions: 1

Compression:

Stored size: 465 Bytes

Contents

module Atethechon
  class ContactsSerializer
    attr_reader :contacts, :organization_identifier

    def initialize(contacts:, organization_identifier:)
      @contacts = contacts
      @organization_identifier = organization_identifier
    end

    def to_yaml
      to_h.to_yaml
    end

    def to_h
      {
        organization_identifier.to_s => {
          "contacts" => contacts.map { |c| c.to_h.transform_keys(&:to_s) }
        }
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
atethechon-0.1.0 lib/atethechon/serializers/contacts_serializer.rb