Class: Caseflow::Service
- Inherits:
-
Common::Client::Base
- Object
- Common::Client::Base
- Caseflow::Service
- Defined in:
- lib/caseflow/service.rb
Overview
Proxy Service for appeals in Caseflow.
Constant Summary collapse
- STATSD_KEY_PREFIX =
'api.appeals'
- CASEFLOW_V2_API_PATH =
'/api/v2/appeals'
- CASEFLOW_V3_API_PATH =
'/api/v3/decision_reviews'
- DEFAULT_HEADERS =
{ 'Authorization' => "Token token=#{Settings.caseflow.app_token}" }.freeze
Instance Method Summary collapse
- #authorized_perform(method, path, params, additional_headers = nil, options = nil) ⇒ Object private
-
#create_higher_level_review(body) ⇒ Hash
Create a HLR in Caseflow.
-
#get_appeals(user, additional_headers = {}) ⇒ Caseflow::Responses::Caseflow
Returns caseflow data for a user by their SSN.
-
#get_contestable_issues(headers:, benefit_type:, decision_review_type:) ⇒ Hash
Returns contestable issues for a veteran.
-
#get_legacy_appeals(headers:) ⇒ Object
Returns caseflow data for a user via their SSN or file_number passed as headers.
-
#healthcheck ⇒ Faraday::Response
Pings the Caseflow health check endpoint.
Methods included from Common::Client::Concerns::Monitoring
#increment, #increment_failure, #increment_total, #with_monitoring
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
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
Instance Method Details
#authorized_perform(method, path, params, additional_headers = nil, options = nil) ⇒ Object (private)
98 99 100 |
# File 'lib/caseflow/service.rb', line 98 def (method, path, params, additional_headers = nil, = nil) perform(method, path, params, DEFAULT_HEADERS.merge(additional_headers || {}), ) end |
#create_higher_level_review(body) ⇒ Hash
Create a HLR in Caseflow.
79 80 81 82 83 |
# File 'lib/caseflow/service.rb', line 79 def create_higher_level_review(body) with_monitoring do (:post, "#{CASEFLOW_V3_API_PATH}/higher_level_reviews", body) end end |
#get_appeals(user, additional_headers = {}) ⇒ Caseflow::Responses::Caseflow
Returns caseflow data for a user by their SSN.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/caseflow/service.rb', line 31 def get_appeals(user, additional_headers = {}) with_monitoring do response = ( :get, CASEFLOW_V2_API_PATH, {}, additional_headers.merge('ssn' => user.ssn) ) Caseflow::Responses::Caseflow.new(response.body, response.status) end end |
#get_contestable_issues(headers:, benefit_type:, decision_review_type:) ⇒ Hash
Returns contestable issues for a veteran.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/caseflow/service.rb', line 62 def get_contestable_issues(headers:, benefit_type:, decision_review_type:) with_monitoring do ( :get, "#{CASEFLOW_V3_API_PATH}/#{decision_review_type}/contestable_issues/#{benefit_type}".chomp('/'), {}, headers ) end end |
#get_legacy_appeals(headers:) ⇒ Object
Returns caseflow data for a user via their SSN or file_number passed as headers
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/caseflow/service.rb', line 44 def get_legacy_appeals(headers:) with_monitoring do ( :get, "#{CASEFLOW_V3_API_PATH}/legacy_appeals".chomp('/'), {}, headers ) end end |
#healthcheck ⇒ Faraday::Response
Pings the Caseflow health check endpoint.
90 91 92 93 94 |
# File 'lib/caseflow/service.rb', line 90 def healthcheck with_monitoring do perform(:get, '/health-check', nil) end end |