Module: Jive::Webhook::ClassMethods

Defined in:
lib/jive/webhook/class_methods.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/jive/webhook/class_methods.rb', line 4

def self.extended(base)
	base.send(:attr_accessor, :configuration)
	base.belongs_to :add_on, :class_name => "Jive::AddOn", :foreign_key => :jive_add_on_id
	base.belongs_to :oauth_token, :class_name => "Jive::OauthToken", :foreign_key => :jive_oauth_token_id
	base.validates :add_on, presence: true
	base.validates :oauth_token, presence: true
	base.validates :callback, presence: true
	base.before_create :register_webhook
	base.before_destroy :unregister_webhook
	base.before_validation :ensure_callback_from_configuration
end

Instance Method Details

#configurationObject



16
17
18
# File 'lib/jive/webhook/class_methods.rb', line 16

def configuration
	@configuration
end

#configure {|@configuration| ... } ⇒ Object

Yields:



20
21
22
23
# File 'lib/jive/webhook/class_methods.rb', line 20

def configure
	@configuration ||= Jive::Webhook::Configuration.new
	yield(@configuration)
end