module Arbetsformedlingen::API::SoklistaResult
Public Class Methods
build(response, list_name: nil)
click to toggle source
Build API
result object for “soklista” @param [API::Response] response @param list_name [String] result list name @return [Values::SoklistaPage]
# File lib/arbetsformedlingen/api/results/soklista_result.rb, line 12 def self.build(response, list_name: nil) build_page(response, list_name) end
build_page(response, list_name)
click to toggle source
private
# File lib/arbetsformedlingen/api/results/soklista_result.rb, line 18 def self.build_page(response, list_name) response_data = response.json data = response_data.fetch('soklista', {}) Values::SoklistaPage.new( list_name: data.fetch('listnamn', list_name), total_ads: data.fetch('totalt_antal_platsannonser', 0), total_vacancies: data.fetch('totalt_antal_ledigajobb', 0), raw_data: response_data, data: data.fetch('sokdata', []).map do |result| build_search_result(result) end, response: response ) end
build_search_result(result)
click to toggle source
# File lib/arbetsformedlingen/api/results/soklista_result.rb, line 34 def self.build_search_result(result) Values::SoklistaResult.new( id: result.fetch('id'), name: result.fetch('namn'), total_ads: result.fetch('antal_platsannonser'), total_vacancies: result.fetch('antal_ledigajobb') ) end