Module: Subserver::Pubsub

Defined in:
lib/subserver/pubsub.rb

Class Method Summary collapse

Class Method Details

.clientObject



5
6
7
# File 'lib/subserver/pubsub.rb', line 5

def self.client
  defined?(@client) ? @client : initialize_client
end

.client=(client) ⇒ Object



9
10
11
# File 'lib/subserver/pubsub.rb', line 9

def self.client=(client)
  @client = client
end

.initialize_clientObject



13
14
15
16
17
18
# File 'lib/subserver/pubsub.rb', line 13

def self.initialize_client
  @client = Google::Cloud::Pubsub.new(
    project_id: options[:project_id] || ENV['PUBSUB_PROJECT_ID'],
    credentials: ( File.expand_path(options[:credentials]) if options[:credentials] )
  )
end

.optionsObject



20
21
22
# File 'lib/subserver/pubsub.rb', line 20

def self.options
  Subserver.options
end