Class: Lucid::Shopify::WebhookList
- Inherits:
-
Object
- Object
- Lucid::Shopify::WebhookList
- Includes:
- Enumerable
- Defined in:
- lib/lucid/shopify/webhook_list.rb
Instance Method Summary collapse
- #each {|Hash| ... } ⇒ Object
-
#initialize ⇒ WebhookList
constructor
A new instance of WebhookList.
- #register(topic, fields: nil) ⇒ Object
Constructor Details
#initialize ⇒ WebhookList
Returns a new instance of WebhookList.
8 9 10 |
# File 'lib/lucid/shopify/webhook_list.rb', line 8 def initialize @webhooks = [] end |
Instance Method Details
#each {|Hash| ... } ⇒ Object
13 14 15 |
# File 'lib/lucid/shopify/webhook_list.rb', line 13 def each(&block) @webhooks.each(&block) end |
#register(topic, fields: nil) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/lucid/shopify/webhook_list.rb', line 19 def register(topic, fields: nil) @webhooks << {}.tap do |webhook| webhook[:topic] = topic webhook[:fields] = fields if fields end nil end |