Class: Lucid::Shopify::WebhookList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/lucid/shopify/webhook_list.rb

Instance Method Summary collapse

Constructor Details

#initializeWebhookList

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

Yields:

  • (Hash)


13
14
15
# File 'lib/lucid/shopify/webhook_list.rb', line 13

def each(&block)
  @webhooks.each(&block)
end

#register(topic, fields: nil) ⇒ Object

Parameters:

  • topic (String)
  • fields (String) (defaults to: nil)

    e.g. ‘id,tags’



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