Class: VAProfile::Communication::Service
- Inherits:
-
Service
- Object
- Common::Client::Base
- Service
- VAProfile::Communication::Service
- 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
- #get_communication_items ⇒ Object
- #get_communication_permissions ⇒ Object
- #get_items_and_permissions ⇒ Object
- #get_path_ids ⇒ Object private
- #update_communication_permission(communication_item) ⇒ Object
Methods included from Common::Client::Concerns::Monitoring
#increment, #increment_failure, #increment_total, #with_monitoring
Methods inherited from Service
breakers_service, #final_failure?, #handle_error, #initialize, #log_dates, #parse_messages, #perform, #person_transaction?, #person_transaction_failure?, #raise_backend_exception, #raise_invalid_body, #report_stats_on, #save_error_details
Methods inherited from Common::Client::Base
#config, configuration, #connection, #delete, #get, #perform, #post, #put, #raise_backend_exception, #raise_not_authenticated, #request, #sanitize_headers!, #service_name
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Constructor Details
This class inherits a constructor from VAProfile::Service
Instance Method Details
#get_communication_items ⇒ Object
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_permissions ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/va_profile/communication/service.rb', line 35 def with_monitoring do perform(:get, "#{get_path_ids}communication-permissions").body end rescue => e handle_error(e) end |
#get_items_and_permissions ⇒ Object
28 29 30 31 32 33 |
# File 'lib/va_profile/communication/service.rb', line 28 def VAProfile::Models::CommunicationItemGroup.create_groups( get_communication_items, ) end |
#get_path_ids ⇒ Object (private)
53 54 55 56 57 |
# File 'lib/va_profile/communication/service.rb', line 53 def get_path_ids id_with_aaid = ERB::Util.url_encode("#{@user.vet360_id}#{VA_PROFILE_ID_POSTFIX}") "#{OID}/#{id_with_aaid}/" 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 (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 |