Class: LucidShopify::CreateWebhook

Inherits:
Object
  • Object
show all
Defined in:
lib/lucid_shopify/create_webhook.rb

Instance Method Summary collapse

Constructor Details

#initialize(client: Container[:client]) ⇒ CreateWebhook

Returns a new instance of CreateWebhook.

Parameters:

  • client (#post_json) (defaults to: Container[:client])


10
11
12
# File 'lib/lucid_shopify/create_webhook.rb', line 10

def initialize(client: Container[:client])
  @client = client
end

Instance Method Details

#call(credentials, webhook) ⇒ Hash

Returns response data.

Parameters:

Returns:

  • (Hash)

    response data



20
21
22
23
24
# File 'lib/lucid_shopify/create_webhook.rb', line 20

def call(credentials, webhook)
  data = {**webhook, address: LucidShopify.config.webhook_uri}

  @client.post_json(credentials, 'webhooks', webhook: data)
end