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

#attributes, #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

#initialize, #path, #persisted?, #to_json

Class Method Details

.from_json(payload) ⇒ Object



23
24
25
# File 'lib/moneybird/webhook.rb', line 23

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

Instance Method Details

#build_entityObject



15
16
17
# File 'lib/moneybird/webhook.rb', line 15

def build_entity
  entity_resource_class.new(entity)
end

#entity_resource_classObject



19
20
21
# File 'lib/moneybird/webhook.rb', line 19

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