Class: Moneybird::Webhook

Inherits:
Object
  • Object
show all
Extended by:
Resource::ClassMethods
Includes:
Resource
Defined in:
lib/moneybird/webhook.rb

Instance Attribute Summary

Attributes included from Resource::ClassMethods

#attributes, #logger, #nillable_attributes

Attributes included from Resource

#client, #errors

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resource::ClassMethods

build, has_attributes, has_boolean_attributes, has_datetime_attributes, has_integer_attributes, has_nillable_attributes, resource

Methods included from Resource

#attributes, #attributes=, #custom_fields=, #initialize, #link_booking, #path, #persisted?, #to_json

Class Method Details

.from_json(payload) ⇒ Object



25
26
27
# File 'lib/moneybird/webhook.rb', line 25

def self.from_json(payload)
  build(JSON.parse(payload))
end

Instance Method Details

#build_entityObject



17
18
19
# File 'lib/moneybird/webhook.rb', line 17

def build_entity
  entity_resource_class.new(entity) if entity
end

#entity_resource_classObject



21
22
23
# File 'lib/moneybird/webhook.rb', line 21

def entity_resource_class
  Object.const_get "Moneybird::Resource::#{entity_type}"
end