Class: Lucid::Shopify::Webhook

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/lucid/shopify/webhook.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object

Parameters:

  • key (String)

Returns:

  • (Object)


34
35
36
# File 'lib/lucid/shopify/webhook.rb', line 34

def [](key)
  data_hash[key]
end

#as_jsonHash

Returns:

  • (Hash)


41
42
43
# File 'lib/lucid/shopify/webhook.rb', line 41

def as_json(*)
  to_h
end

#dataString

Returns:

  • (String)


17
# File 'lib/lucid/shopify/webhook.rb', line 17

param :data

#data_hashHash Also known as: to_h

Returns:

  • (Hash)


20
21
22
23
24
# File 'lib/lucid/shopify/webhook.rb', line 20

def data_hash
  @data_hash ||= JSON.parse(data)
rescue JSON::ParserError
  {}
end

#each(&block) ⇒ Object

See Also:

  • Hash#each


27
28
29
# File 'lib/lucid/shopify/webhook.rb', line 27

def each(&block)
  data_hash.each(&block)
end

#myshopify_domainString

Returns:

  • (String)


13
# File 'lib/lucid/shopify/webhook.rb', line 13

param :myshopify_domain

#to_json(*args) ⇒ String

Returns:

  • (String)


46
47
48
# File 'lib/lucid/shopify/webhook.rb', line 46

def to_json(*args)
  as_json.to_json(*args)
end

#topicString

Returns:

  • (String)


15
# File 'lib/lucid/shopify/webhook.rb', line 15

param :topic