Class: BreweryDB::WebHook

Inherits:
Object
  • Object
show all
Defined in:
lib/brewery_db/web_hook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ WebHook

Returns a new instance of WebHook.



14
15
16
17
18
19
20
21
22
23
# File 'lib/brewery_db/web_hook.rb', line 14

def initialize(args)
  @action = args[:action]
  @attribute = args[:attribute]
  @attribute_id = args[:attributeId]
  @key = args[:key]
  @nonce = args[:nonce]
  @sub_action = args[:subAction]
  @sub_attribute_id = args[:subAttributeId]
  @timestamp = args[:timestamp]
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



5
6
7
# File 'lib/brewery_db/web_hook.rb', line 5

def action
  @action
end

#attributeObject (readonly)

Returns the value of attribute attribute.



6
7
8
# File 'lib/brewery_db/web_hook.rb', line 6

def attribute
  @attribute
end

#attribute_idObject (readonly)

Returns the value of attribute attribute_id.



7
8
9
# File 'lib/brewery_db/web_hook.rb', line 7

def attribute_id
  @attribute_id
end

#keyObject (readonly)

Returns the value of attribute key.



8
9
10
# File 'lib/brewery_db/web_hook.rb', line 8

def key
  @key
end

#nonceObject (readonly)

Returns the value of attribute nonce.



9
10
11
# File 'lib/brewery_db/web_hook.rb', line 9

def nonce
  @nonce
end

#sub_actionObject (readonly)

Returns the value of attribute sub_action.



10
11
12
# File 'lib/brewery_db/web_hook.rb', line 10

def sub_action
  @sub_action
end

#sub_attribute_idObject (readonly)

Returns the value of attribute sub_attribute_id.



11
12
13
# File 'lib/brewery_db/web_hook.rb', line 11

def sub_attribute_id
  @sub_attribute_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



12
13
14
# File 'lib/brewery_db/web_hook.rb', line 12

def timestamp
  @timestamp
end

Instance Method Details

#valid?(api_key) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/brewery_db/web_hook.rb', line 25

def valid?(api_key)
  hash(api_key) == key
end