Class: LighthouseBRDProvider
- Inherits:
-
Object
- Object
- LighthouseBRDProvider
- Includes:
- BRDProvider
- Defined in:
- lib/disability_compensation/providers/brd/lighthouse_brd_provider.rb
Instance Method Summary collapse
- #get_separation_locations ⇒ Object
-
#initialize(_current_user) ⇒ LighthouseBRDProvider
constructor
A new instance of LighthouseBRDProvider.
- #transform(data) ⇒ Object private
Methods included from BRDProvider
Constructor Details
#initialize(_current_user) ⇒ LighthouseBRDProvider
Returns a new instance of LighthouseBRDProvider.
10 11 12 |
# File 'lib/disability_compensation/providers/brd/lighthouse_brd_provider.rb', line 10 def initialize(_current_user) @service = BenefitsReferenceData::Service.new end |
Instance Method Details
#get_separation_locations ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/disability_compensation/providers/brd/lighthouse_brd_provider.rb', line 14 def get_separation_locations response = @service.get_data(path: 'intake-sites') if response.status != 200 return DisabilityCompensation::ApiProvider::IntakeSitesResponse.new(status: response.status) end transform(response.body) end |
#transform(data) ⇒ Object (private)
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/disability_compensation/providers/brd/lighthouse_brd_provider.rb', line 25 def transform(data) separation_locations = data['items'].map do |intake_site| DisabilityCompensation::ApiProvider::SeparationLocation.new( code: intake_site['id'], description: intake_site['description'] ) end DisabilityCompensation::ApiProvider::IntakeSitesResponse.new(separation_locations:, status: 200) end |