Class: Transactionable::RemoteEntity

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/transactionable/remote_entity.rb

Instance Method Summary collapse

Instance Method Details

#build_or_update_remoteObject



7
8
9
# File 'app/models/transactionable/remote_entity.rb', line 7

def build_or_update_remote
  raise "Not Implemented"
end

#build_remoteObject



15
16
17
# File 'app/models/transactionable/remote_entity.rb', line 15

def build_remote
  raise "Not Implemented"
end

#destroy_remoteObject



37
38
39
40
# File 'app/models/transactionable/remote_entity.rb', line 37

def destroy_remote
  re = self.fetch
  re.unstore if re
end

#fetchObject



27
28
29
30
31
# File 'app/models/transactionable/remote_entity.rb', line 27

def fetch
  if synced?
    "#{self.service_name}::#{remote_entity_type}".constantize.find(self.uri)
  end
end

#remote_entity_typeObject



33
34
35
# File 'app/models/transactionable/remote_entity.rb', line 33

def remote_entity_type
  "#{self.class.name.gsub("Transactionable::Remote","")}"
end

#service_nameObject



11
12
13
# File 'app/models/transactionable/remote_entity.rb', line 11

def service_name
  read_attribute(:service_name) || "Balanced"
end

#synced?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/transactionable/remote_entity.rb', line 23

def synced?
  !!self.uri
end

#update_remoteObject



19
20
21
# File 'app/models/transactionable/remote_entity.rb', line 19

def update_remote
  raise "Not Implemented"
end