Sha256: 1e8ef565a672f9bff25209e283ff6309ffd7c1deb02c368e5c930be51b16892a

Contents?: true

Size: 802 Bytes

Versions: 4

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

module TwilioBase
  module Fake
    module Chat
      class Message
        Message = Struct.new(:attributes) do
          def sid
            @sid ||= Time.now.to_i
          end

          def created_at
            Time.now
          end

          def date_created
            2.days.ago
          end

          def body
            attributes[:body]
          end

          def from
            attributes[:from]
          end

          def to
            attributes[:to]
          end
        end

        cattr_accessor :messages
        self.messages = []

        def create(attributes)
          self.class.messages << Message.new(attributes)
          self
        end

        def list
          self.class.messages
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twilio_base-1.11.1101 spec/support/twilio_base/fake/chat/message.rb
twilio_base-1.11.11 spec/support/twilio_base/fake/chat/message.rb
twilio_base-1.9.0 spec/support/twilio_base/fake/chat/message.rb
twilio_base-1.8.0 spec/support/twilio_base/fake/chat/message.rb