Class: Zaikio::Webhooks::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/zaikio/webhooks/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
# File 'lib/zaikio/webhooks/configuration.rb', line 10

def initialize
  @client_configurations = {}
end

Instance Attribute Details

#client_configurationsObject (readonly)

Returns the value of attribute client_configurations.



8
9
10
# File 'lib/zaikio/webhooks/configuration.rb', line 8

def client_configurations
  @client_configurations
end

#loggerObject



14
15
16
# File 'lib/zaikio/webhooks/configuration.rb', line 14

def logger
  @logger ||= Logger.new($stdout)
end

Instance Method Details

#all_client_namesObject



27
28
29
# File 'lib/zaikio/webhooks/configuration.rb', line 27

def all_client_names
  client_configurations.keys
end

#find!(name) ⇒ Object



23
24
25
# File 'lib/zaikio/webhooks/configuration.rb', line 23

def find!(name)
  @client_configurations[name.to_s] or raise ActiveRecord::RecordNotFound
end

#register_client(name) {|| ... } ⇒ Object

Yields:

  • ()


18
19
20
21
# File 'lib/zaikio/webhooks/configuration.rb', line 18

def register_client(name)
  @client_configurations[name.to_s] ||= ClientConfiguration.new
  yield(@client_configurations[name.to_s])
end