Class: NetworkManager

Inherits:
Object
  • Object
show all
Defined in:
app/services/network_manager.rb

Overview

Network manager for interaction with central site

Defined Under Namespace

Classes: CampaignHandler, CandidateHandler, PoliticalForceHandler, PostAttachmentHandler, PostHandler, PostTypeHandler, RegionHandler, UserHandler

Constant Summary collapse

MAIN_HOST =
'https://comunit.online'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data.



7
8
9
# File 'app/services/network_manager.rb', line 7

def data
  @data
end

#entityObject

Returns the value of attribute entity.



7
8
9
# File 'app/services/network_manager.rb', line 7

def entity
  @entity
end

Class Method Details

.ignored_attributesObject



22
23
24
# File 'app/services/network_manager.rb', line 22

def self.ignored_attributes
  %w[data id image]
end

.permitted_attributesObject



26
27
28
# File 'app/services/network_manager.rb', line 26

def self.permitted_attributes
  i[created_at sync_state]
end

.relationship_data(entity, wrap = true) ⇒ Object

Parameters:



11
12
13
14
15
16
17
18
19
20
# File 'app/services/network_manager.rb', line 11

def self.relationship_data(entity, wrap = true)
  return nil if entity.nil?

  data = {
    id: entity.uuid,
    type: entity.class.table_name
  }

  wrap ? { data: data } : data
end