Class: ShopifyClient::Webhook
- Inherits:
-
Struct
- Object
- Struct
- ShopifyClient::Webhook
- Defined in:
- lib/shopify-client/webhook.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #data ⇒ Hash (also: #to_h)
- #inspect ⇒ String
- #to_json(*args) ⇒ String
Instance Attribute Details
#myshopify_domain ⇒ String
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/shopify-client/webhook.rb', line 12 Webhook = Struct.new(:myshopify_domain, :topic, :raw_data) do # @return [Hash] def data @data ||= JSON.parse(raw_data) rescue JSON::ParserError {} end alias_method :to_h, :data # @return [String] def to_json(*args) to_h.to_json(*args) end # @return [String] def inspect "#<ShopifyClient::Webhook (#{myshopify_domain}, #{topic})>" end end |
#raw_data ⇒ String
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/shopify-client/webhook.rb', line 12 Webhook = Struct.new(:myshopify_domain, :topic, :raw_data) do # @return [Hash] def data @data ||= JSON.parse(raw_data) rescue JSON::ParserError {} end alias_method :to_h, :data # @return [String] def to_json(*args) to_h.to_json(*args) end # @return [String] def inspect "#<ShopifyClient::Webhook (#{myshopify_domain}, #{topic})>" end end |
#topic ⇒ String
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/shopify-client/webhook.rb', line 12 Webhook = Struct.new(:myshopify_domain, :topic, :raw_data) do # @return [Hash] def data @data ||= JSON.parse(raw_data) rescue JSON::ParserError {} end alias_method :to_h, :data # @return [String] def to_json(*args) to_h.to_json(*args) end # @return [String] def inspect "#<ShopifyClient::Webhook (#{myshopify_domain}, #{topic})>" end end |
Instance Method Details
#data ⇒ Hash Also known as: to_h
14 15 16 17 18 |
# File 'lib/shopify-client/webhook.rb', line 14 def data @data ||= JSON.parse(raw_data) rescue JSON::ParserError {} end |
#inspect ⇒ String
28 29 30 |
# File 'lib/shopify-client/webhook.rb', line 28 def inspect "#<ShopifyClient::Webhook (#{myshopify_domain}, #{topic})>" end |
#to_json(*args) ⇒ String
23 24 25 |
# File 'lib/shopify-client/webhook.rb', line 23 def to_json(*args) to_h.to_json(*args) end |