Class: Amiando::Sync::Event
- Inherits:
-
Object
- Object
- Amiando::Sync::Event
- Includes:
- Attributes
- Defined in:
- lib/amiando/sync.rb
Overview
A synchronization event aka ‘Something that happened’.
You should use mainly 4 attributes:
-
obj_type and returned_obj_type will allow you to know what kind of object you should be dealing with. Read through the official docs to know the difference between them.
-
obj_id is the id of whichever object you’re dealing with.
-
operation is what happened to that object. Typically ‘create’, ‘delete’ and ‘update’. But beware the ‘resync’ one.
Please note that the original api returns object_id, object_type and returned_object_type, but ruby 1.9 throws warnings if defining a method called object_id. All three have been ranemd for consistency.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Event
constructor
A new instance of Event.
- #obj_id ⇒ Object
- #obj_type ⇒ Object
- #returned_obj_type ⇒ Object
Methods included from Attributes
#[], #id, included, #method_missing, #respond_to?, #type
Constructor Details
#initialize(hash) ⇒ Event
Returns a new instance of Event.
68 69 70 |
# File 'lib/amiando/sync.rb', line 68 def initialize(hash) set_attributes(hash) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Amiando::Attributes
Instance Method Details
#obj_id ⇒ Object
72 73 74 |
# File 'lib/amiando/sync.rb', line 72 def obj_id attributes[:object_id] end |
#obj_type ⇒ Object
76 77 78 |
# File 'lib/amiando/sync.rb', line 76 def obj_type attributes[:object_type] end |
#returned_obj_type ⇒ Object
80 81 82 |
# File 'lib/amiando/sync.rb', line 80 def returned_obj_type attributes[:returned_object_type] end |