-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathservice.rb
More file actions
42 lines (34 loc) · 1.08 KB
/
service.rb
File metadata and controls
42 lines (34 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true
require 'common/client/base'
require 'dgi/automation/configuration'
require 'dgi/service'
require 'dgi/automation/claimant_response'
require 'authentication_token_service'
module MebApi
module DGI
module Automation
class Service < MebApi::DGI::Service
configuration MebApi::DGI::Automation::Configuration
STATSD_KEY_PREFIX = 'api.dgi.automation'
def get_claimant_info(type)
type ||= 'Chapter33'
with_monitoring do
headers = request_headers
options = { timeout: 60 }
raw_response = perform(:post, end_point(type), { ssn: @user.ssn.to_s }.to_json, headers, options)
MebApi::DGI::Automation::ClaimantResponse.new(raw_response.status, raw_response)
end
end
private
def end_point(type)
"claimType/#{normalize_claim_type(type)}/claimants"
end
def request_headers
{
Authorization: "Bearer #{MebApi::AuthenticationTokenService.call}"
}
end
end
end
end
end