Class: Fog::Google::Pubsub::Mock

Inherits:
Object
  • Object
show all
Includes:
Shared
Defined in:
lib/fog/google/pubsub/mock.rb,
lib/fog/google/requests/pubsub/get_topic.rb,
lib/fog/google/requests/pubsub/list_topics.rb,
lib/fog/google/requests/pubsub/create_topic.rb,
lib/fog/google/requests/pubsub/delete_topic.rb,
lib/fog/google/requests/pubsub/publish_topic.rb,
lib/fog/google/requests/pubsub/get_subscription.rb,
lib/fog/google/requests/pubsub/pull_subscription.rb,
lib/fog/google/requests/pubsub/list_subscriptions.rb,
lib/fog/google/requests/pubsub/create_subscription.rb,
lib/fog/google/requests/pubsub/delete_subscription.rb,
lib/fog/google/requests/pubsub/acknowledge_subscription.rb

Instance Attribute Summary

Attributes included from Shared

#api_url, #api_version, #project

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Shared

#apply_client_options, #build_excon_response, #initialize_google_client, #request, #shared_initialize

Constructor Details

#initialize(options) ⇒ Mock

Returns a new instance of Mock.



7
8
9
# File 'lib/fog/google/pubsub/mock.rb', line 7

def initialize(options)
  shared_initialize(options[:google_project], GOOGLE_PUBSUB_API_VERSION, GOOGLE_PUBSUB_BASE_URL)
end

Class Method Details

.dataObject



11
12
13
14
15
16
17
18
# File 'lib/fog/google/pubsub/mock.rb', line 11

def self.data
  @data ||= Hash.new do |hash, key|
    hash[key] = {
      :topics => {},
      :subscriptions => {}
    }
  end
end

.resetObject



20
21
22
# File 'lib/fog/google/pubsub/mock.rb', line 20

def self.reset
  @data = nil
end

Instance Method Details

#acknowledge_subscription(_subscription, _ack_ids) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


23
24
25
# File 'lib/fog/google/requests/pubsub/acknowledge_subscription.rb', line 23

def acknowledge_subscription(_subscription, _ack_ids)
  raise Fog::Errors::MockNotImplemented
end

#create_subscription(_subscription_name, _topic, _push_config = {}, _ack_deadline_seconds = nil) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


31
32
33
# File 'lib/fog/google/requests/pubsub/create_subscription.rb', line 31

def create_subscription(_subscription_name, _topic, _push_config = {}, _ack_deadline_seconds = nil)
  raise Fog::Errors::MockNotImplemented
end

#create_topic(_topic_name) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


17
18
19
# File 'lib/fog/google/requests/pubsub/create_topic.rb', line 17

def create_topic(_topic_name)
  raise Fog::Errors::MockNotImplemented
end

#dataObject



24
25
26
# File 'lib/fog/google/pubsub/mock.rb', line 24

def data
  self.class.data[project]
end

#delete_subscription(_subscription_name) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


15
16
17
# File 'lib/fog/google/requests/pubsub/delete_subscription.rb', line 15

def delete_subscription(_subscription_name)
  raise Fog::Errors::MockNotImplemented
end

#delete_topic(_topic_name) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


15
16
17
# File 'lib/fog/google/requests/pubsub/delete_topic.rb', line 15

def delete_topic(_topic_name)
  raise Fog::Errors::MockNotImplemented
end

#get_subscription(_subscription_name) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


15
16
17
# File 'lib/fog/google/requests/pubsub/get_subscription.rb', line 15

def get_subscription(_subscription_name)
  raise Fog::Errors::MockNotImplemented
end

#get_topic(_topic_name) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


15
16
17
# File 'lib/fog/google/requests/pubsub/get_topic.rb', line 15

def get_topic(_topic_name)
  raise Fog::Errors::MockNotImplemented
end

#list_subscriptions(_project = nil) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


23
24
25
# File 'lib/fog/google/requests/pubsub/list_subscriptions.rb', line 23

def list_subscriptions(_project = nil)
  raise Fog::Errors::MockNotImplemented
end

#list_topics(_project = nil) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


23
24
25
# File 'lib/fog/google/requests/pubsub/list_topics.rb', line 23

def list_topics(_project = nil)
  raise Fog::Errors::MockNotImplemented
end

#publish_topic(_topic, _messages) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


22
23
24
# File 'lib/fog/google/requests/pubsub/publish_topic.rb', line 22

def publish_topic(_topic, _messages)
  raise Fog::Errors::MockNotImplemented
end

#pull_subscription(_subscription, _options = { :return_immediately => true, :max_messages => 10 }) ⇒ Object

Raises:

  • (Fog::Errors::MockNotImplemented)


34
35
36
# File 'lib/fog/google/requests/pubsub/pull_subscription.rb', line 34

def pull_subscription(_subscription, _options = { :return_immediately => true, :max_messages => 10 })
  raise Fog::Errors::MockNotImplemented
end

#reset_dataObject



28
29
30
# File 'lib/fog/google/pubsub/mock.rb', line 28

def reset_data
  self.class.data.delete(project)
end