Class: VAProfile::Communication::Service

Inherits:
Service show all
Includes:
Common::Client::Concerns::Monitoring
Defined in:
lib/va_profile/communication/service.rb

Constant Summary collapse

STATSD_KEY_PREFIX =
"#{VAProfile::Service::STATSD_KEY_PREFIX}.communication".freeze
OID =
'2.16.840.1.113883.4.349'
VA_PROFILE_ID_POSTFIX =
'^PI^200VETS^USDVA'

Instance Method Summary collapse

Methods included from Common::Client::Concerns::Monitoring

#with_monitoring

Methods inherited from Service

breakers_service, #initialize, #perform

Methods inherited from Common::Client::Base

configuration, #raise_backend_exception

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Constructor Details

This class inherits a constructor from VAProfile::Service

Instance Method Details

#get_communication_itemsObject



43
44
45
46
47
48
49
# File 'lib/va_profile/communication/service.rb', line 43

def get_communication_items
  with_monitoring do
    perform(:get, 'communication-items').body
  end
rescue => e
  handle_error(e)
end

#get_communication_permissionsObject



35
36
37
38
39
40
41
# File 'lib/va_profile/communication/service.rb', line 35

def get_communication_permissions
  with_monitoring do
    perform(:get, "#{get_path_ids}communication-permissions").body
  end
rescue => e
  handle_error(e)
end

#get_items_and_permissionsObject



28
29
30
31
32
33
# File 'lib/va_profile/communication/service.rb', line 28

def get_items_and_permissions
  VAProfile::Models::CommunicationItemGroup.create_groups(
    get_communication_items,
    get_communication_permissions
  )
end

#update_communication_permission(communication_item) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/va_profile/communication/service.rb', line 17

def update_communication_permission(communication_item)
  with_monitoring do
    perform(
      communication_item.http_verb,
      "#{get_path_ids}communication-permissions", communication_item.in_json(@user.vet360_id)
    ).body
  end
rescue => e
  handle_error(e)
end