class LucidShopify::WebhookList

Public Class Methods

new() click to toggle source
# File lib/lucid_shopify/webhook_list.rb, line 7
def initialize
  @webhooks = []
end

Public Instance Methods

each(&block) click to toggle source

@yield [Hash]

# File lib/lucid_shopify/webhook_list.rb, line 14
def each(&block)
  @webhooks.each(&block)
end
register(topic, fields: nil) click to toggle source

@param topic [String] @param fields [String] e.g. 'id,tags'

# 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