Class: Fog::Google::Pubsub::Topics
- Inherits:
-
Collection
- Object
- Collection
- Fog::Google::Pubsub::Topics
- Defined in:
- lib/fog/google/models/pubsub/topics.rb
Instance Method Summary collapse
-
#all ⇒ Array<Fog::Google::Pubsub::Topic>
Lists all topics that exist on the project.
-
#get(topic_name) ⇒ Fog::Google::Pubsub::Topic
Retrieves a topic by name.
Instance Method Details
#all ⇒ Array<Fog::Google::Pubsub::Topic>
Lists all topics that exist on the project.
13 14 15 16 |
# File 'lib/fog/google/models/pubsub/topics.rb', line 13 def all data = service.list_topics.to_h[:topics] || [] load(data) end |
#get(topic_name) ⇒ Fog::Google::Pubsub::Topic
Retrieves a topic by name
22 23 24 25 26 27 28 |
# File 'lib/fog/google/models/pubsub/topics.rb', line 22 def get(topic_name) topic = service.get_topic(topic_name).to_h new(topic) rescue ::Google::Apis::ClientError => e raise e unless e.status_code == 404 nil end |