Class: Fog::Google::Pubsub::Subscriptions

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/google/models/pubsub/subscriptions.rb

Instance Method Summary collapse

Instance Method Details

#allArray<Fog::Google::Pubsub::Subscription>

Lists all subscriptions that exist on the project.

Returns:



14
15
16
17
# File 'lib/fog/google/models/pubsub/subscriptions.rb', line 14

def all
  data = service.list_subscriptions.to_h[:subscriptions] || []
  load(data)
end

#get(subscription_name) ⇒ Fog::Google::Pubsub::Topic

Retrieves a subscription by name

Parameters:

  • subscription_name (String)

    name of subscription to retrieve

Returns:



23
24
25
26
27
28
29
# File 'lib/fog/google/models/pubsub/subscriptions.rb', line 23

def get(subscription_name)
  subscription = service.get_subscription(subscription_name).to_h
  new(subscription)
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  nil
end