Sha256: 005dd1803ec0ef919472ae67312a1ed6fdc1d3e9c5521b835a62029e1922787b

Contents?: true

Size: 639 Bytes

Versions: 3

Compression:

Stored size: 639 Bytes

Contents

module Contactually
  module Models
    class Task
      include Model

      field :assigned_to_id, :string
      field :contact_id, :string
      field :created_at, :datetime
      field :due_at, :datetime
      field :id, :string
      field :title, :string
      field :updated_at, :datetime

      field :extra_data, Hash

      def contact
        @contact ||= begin
          if contact_included?
            Contact.new(extra_data[CONTACT_KEY])
          end
        end
      end

      private

      CONTACT_KEY = 'contact'.freeze

      def contact_included?
        extra_data.has_key? CONTACT_KEY
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
contactually-rb-0.1.3 lib/contactually/models/task.rb
contactually-rb-0.1.2 lib/contactually/models/task.rb
contactually-rb-0.1.1 lib/contactually/models/task.rb