Class: LucidShopify::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)


39
40
41
# File 'lib/lucid_shopify/webhook.rb', line 39

def [](key)
  data_hash[key]
end

#as_jsonHash

Returns:

  • (Hash)


48
49
50
# File 'lib/lucid_shopify/webhook.rb', line 48

def as_json(*)
  to_h
end

#dataString

Returns:

  • (String)


16
# File 'lib/lucid_shopify/webhook.rb', line 16

param :data

#data_hashHash Also known as: to_h

Returns:

  • (Hash)


21
22
23
24
25
# File 'lib/lucid_shopify/webhook.rb', line 21

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

#each(&block) ⇒ Object

See Also:

  • Hash#each


30
31
32
# File 'lib/lucid_shopify/webhook.rb', line 30

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

#myshopify_domainString

Returns:

  • (String)


12
# File 'lib/lucid_shopify/webhook.rb', line 12

param :myshopify_domain

#to_json(*args) ⇒ String

Returns:

  • (String)


55
56
57
# File 'lib/lucid_shopify/webhook.rb', line 55

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

#topicString

Returns:

  • (String)


14
# File 'lib/lucid_shopify/webhook.rb', line 14

param :topic