Class: LucidShopify::WebhookList
- Inherits:
-
Object
- Object
- LucidShopify::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.
7 8 9 |
# File 'lib/lucid_shopify/webhook_list.rb', line 7 def initialize @webhooks = [] end |
Instance Method Details
#each {|Hash| ... } ⇒ Object
14 15 16 |
# File 'lib/lucid_shopify/webhook_list.rb', line 14 def each(&block) @webhooks.each(&block) end |
#register(topic, fields: nil) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/lucid_shopify/webhook_list.rb', line 22 def register(topic, fields: nil) @webhooks << {}.tap do |webhook| webhook[:topic] = topic webhook[:fields] = fields if fields end nil end |