class Tep::ContactService < Tep::ApplicationService
  def call
    rest_client_request(:post, url, contact, :contact, body: body)
  end

  private
    def endpoint
      :contact
    end

    def contact
      @contact ||= @school.contacts.find_by(id: @id)
    end

    def body
      {
        message_id: SecureRandom.uuid,
        contact_id: contact.id,
        first_name: contact.first_name,
        last_name: contact.last_name,
        email: contact.email.strip,
        address: contact.address,
        city: contact.city,
        state: contact.state,
        zip: contact.zip,
        country: contact.country.alpha2,
        phone: contact.home_phone
      }
    end
end
