Sha256: 933a32e99730b4551d4a4db6885b925231a6f4db1660625fd7f3a0a9f58c7dea

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

module TwilioBase
  module Fake
    module Sync
      module Services
        module Lists
          class Item
            Item = Struct.new(:data) do
              attr_accessor :sid

              def create(data: {}, date_expires: '')
                self.data = data
                self.date_expires = date_expires
              end

              def date_expires
                data[:date_expires]
              end
            end

            cattr_accessor :items
            self.items = []

            def initialize(sid = nil)
              self.sid = sid
            end

            def create(data: {}, ttl: 0)
              item = Item.new(
                data: data,
                date_expires: Time.current + ttl
              )
              self.class.items << item
              item
            end

            private

            attr_accessor :sid

            def method_missing(_name)
              self || super
            end

            def respond_to_missing?(method_name)
              super
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twilio_base-1.11.1101 spec/support/twilio_base/fake/sync/services/lists/item.rb
twilio_base-1.11.11 spec/support/twilio_base/fake/sync/services/lists/item.rb