Sha256: 0a4a17a47318d03e65ce852f0d5d4048dd202b315a6ef01bacc526f2567bc757

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

#
# Abstraction over WebMock to reduce duplication
#
# @author Mikael Henriksson <mikael@zoolutions.se>
# @since 0.1.0
#
module StubRequests
  #
  # Module Observable handles listening to endpoint invocations
  #
  # @author Mikael Henriksson <mikael@zoolutions.se>
  # @since 0.1.3
  #
  module Observable
    #
    # Class Subscription contains information about a subscription
    #
    # @author Mikael Henriksson <mikael@zoolutions.se>
    # @since 0.1.3
    #
    class Subscription
      include Property
      #
      # @!attribute [rw] service_id
      #   @return [Symbol] the id of a service
      property :service_id, type: Symbol
      #
      # @!attribute [rw] endpoint_id
      #   @return [Symbol] the id of an endpoint
      property :endpoint_id, type: Symbol
      #
      # @!attribute [rw] verb
      #   @return [Symbol] the HTTP verb/method
      property :verb, type: Symbol, default: :any
      #
      # @!attribute [rw] callback
      #   @return [Proc] a proc to callback on notify
      property :callback, type: Proc

      #
      # Initialize a new Subscription
      #
      # @param [Symbol] service_id the id of a service
      # @param [Symbol] endpoint_id the id of an endpoint
      # @param [Symbol] verb the HTTP verb/method
      # @param [Proc] callback a proc to callback on notify
      #
      def initialize(service_id, endpoint_id, verb, callback)
        self.service_id  = service_id
        self.endpoint_id = endpoint_id
        self.verb        = verb
        self.callback    = callback
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stub_requests-0.1.3 lib/stub_requests/observable/subscription.rb