summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/phone_book_entry_serializer.rb14
-rw-r--r--app/serializers/sip_account_serializer.rb10
-rw-r--r--app/serializers/switchboard_entry_serializer.rb2
-rw-r--r--app/serializers/switchboard_serializer.rb3
4 files changed, 26 insertions, 3 deletions
diff --git a/app/serializers/phone_book_entry_serializer.rb b/app/serializers/phone_book_entry_serializer.rb
new file mode 100644
index 0000000..ac25832
--- /dev/null
+++ b/app/serializers/phone_book_entry_serializer.rb
@@ -0,0 +1,14 @@
+class PhoneBookEntrySerializer < ActiveModel::Serializer
+ embed :ids, :include => true
+
+ attributes :id, :first_name, :last_name, :organization, :search_result_display
+ has_many :phone_numbers
+
+ def search_result_display
+ result = "#{object.last_name}, #{object.first_name}".strip.gsub(/^, /,'').gsub(/,$/,'')
+ if result.blank?
+ result = "#{object.organization}"
+ end
+ return result
+ end
+end
diff --git a/app/serializers/sip_account_serializer.rb b/app/serializers/sip_account_serializer.rb
index aa749b0..7465a17 100644
--- a/app/serializers/sip_account_serializer.rb
+++ b/app/serializers/sip_account_serializer.rb
@@ -1,7 +1,15 @@
class SipAccountSerializer < ActiveModel::Serializer
embed :ids, :include => true
- attributes :id, :auth_name, :caller_name, :sip_accountable_id
+ attributes :id, :auth_name, :caller_name, :sip_accountable_id, :is_registrated
has_many :phone_numbers
has_many :calls
+
+ def is_registrated
+ if object.registration
+ true
+ else
+ false
+ end
+ end
end
diff --git a/app/serializers/switchboard_entry_serializer.rb b/app/serializers/switchboard_entry_serializer.rb
index 1b6c761..5d76e16 100644
--- a/app/serializers/switchboard_entry_serializer.rb
+++ b/app/serializers/switchboard_entry_serializer.rb
@@ -1,5 +1,5 @@
class SwitchboardEntrySerializer < ActiveModel::Serializer
- attributes :id, :name, :path_to_user, :avatar_src, :callstate
+ attributes :id, :name, :path_to_user, :avatar_src, :callstate, :switchable
has_one :sip_account, embed: :ids
has_one :switchboard, embed: :ids
diff --git a/app/serializers/switchboard_serializer.rb b/app/serializers/switchboard_serializer.rb
index 6d39667..8a8bd42 100644
--- a/app/serializers/switchboard_serializer.rb
+++ b/app/serializers/switchboard_serializer.rb
@@ -1,9 +1,10 @@
class SwitchboardSerializer < ActiveModel::Serializer
embed :ids, :include => true
- attributes :id, :name
+ attributes :id, :name, :show_avatars, :blind_transfer_activated, :attended_transfer_activated, :search_activated
has_many :switchboard_entries
has_many :sip_accounts, :through => :switchboard_entries
has_many :phone_numbers
has_many :active_calls
+ has_many :dispatchable_incoming_calls
end