Class: Smyte::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/smyte/notification.rb

Defined Under Namespace

Classes: Item, Label

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, options = {}) ⇒ Notification

Returns a new instance of Notification.



12
13
14
15
# File 'lib/smyte/notification.rb', line 12

def initialize(response, options = {})
  @response = response
  @options = options || {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/smyte/notification.rb', line 10

def options
  @options
end

#responseObject (readonly)

Returns the value of attribute response.



10
11
12
# File 'lib/smyte/notification.rb', line 10

def response
  @response
end

Class Method Details

.parse(webhook_secret, response, options = {}) ⇒ Object



3
4
5
6
7
8
# File 'lib/smyte/notification.rb', line 3

def self.parse(webhook_secret, response, options = {})
  if webhook_secret != Smyte.webhook_secret
    raise "invalid webhook_secret: #{webhook_secret}"
  end
  Smyte::Notification.new(response, options)
end

Instance Method Details

#itemsObject



17
18
19
# File 'lib/smyte/notification.rb', line 17

def items
  @items ||= parse_items
end