Sha256: cfa35bbf5733f763f8378925d0deb5e25fe436d67cfc0fbef9f7fcbee34171c7

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

# frozen_string_literal: true

module Talkbird
  module Entity
    # SendBird message
    class Message

      attr_reader :sender
      attr_reader :receiver
      attr_reader :body

      class << self

        def build(response)
          response
        end

      end

      def initialize(from, to, body)
        @sender = User.find_or_create(from)
        @receiver = User.find_or_create(to)
        @body = body
      end

      def deliver
        return false if !sender || !receiver

        channel = Entity::Channel.find_or_create(sender.id, receiver.id)
        puts channel.inspect
        channel.update(self)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
talkbird-0.0.2 lib/talkbird/entity/message.rb