Class: LucidShopify::Webhook
- Inherits:
-
Object
- Object
- LucidShopify::Webhook
- Extended by:
- Dry::Initializer
- Defined in:
- lib/lucid_shopify/webhook.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #as_json ⇒ Hash
- #data ⇒ String
- #data_hash ⇒ Hash (also: #to_h)
- #each(&block) ⇒ Object
- #myshopify_domain ⇒ String
- #to_json(*args) ⇒ String
- #topic ⇒ String
Instance Method Details
#[](key) ⇒ Object
39 40 41 |
# File 'lib/lucid_shopify/webhook.rb', line 39 def [](key) data_hash[key] end |
#as_json ⇒ Hash
48 49 50 |
# File 'lib/lucid_shopify/webhook.rb', line 48 def as_json(*) to_h end |
#data ⇒ String
16 |
# File 'lib/lucid_shopify/webhook.rb', line 16 param :data |
#data_hash ⇒ Hash Also known as: to_h
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
30 31 32 |
# File 'lib/lucid_shopify/webhook.rb', line 30 def each(&block) data_hash.each(&block) end |
#myshopify_domain ⇒ String
12 |
# File 'lib/lucid_shopify/webhook.rb', line 12 param :myshopify_domain |
#to_json(*args) ⇒ String
55 56 57 |
# File 'lib/lucid_shopify/webhook.rb', line 55 def to_json(*args) as_json.to_json(*args) end |
#topic ⇒ String
14 |
# File 'lib/lucid_shopify/webhook.rb', line 14 param :topic |