Sha256: 69f4835e51083906e598cf37b5de028d52ee08eaa4e78daee1f69da3a25b4560

Contents?: true

Size: 832 Bytes

Versions: 4

Compression:

Stored size: 832 Bytes

Contents

# frozen_string_literal: true

module TwilioBase
  module Fake
    module Notify
      class Binding
        attr_accessor :sid
        cattr_accessor :bindings
        BindingObject = Struct.new(
          :address,
          :binding_type,
          :identity,
          :tag,
          :sid
        )

        self.bindings = []

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

        def create(attributes)
          attributes[:sid] = SecureRandom.hex(16)
          object = BindingObject.new(*attributes.values)
          bindings << object
          TwilioBase::Fake::Notify::User.users << object
          object
        end

        def delete
          bindings.delete_if { |binding| binding.sid == sid }
        end

        def list(*)
          bindings
        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/notify/binding.rb
twilio_base-1.11.11 spec/support/twilio_base/fake/notify/binding.rb
twilio_base-1.9.0 spec/support/twilio_base/fake/notify/binding.rb
twilio_base-1.8.0 spec/support/twilio_base/fake/notify/binding.rb