Sha256: b2a3acfd3e622d773d9b51e25d58d44709b0aef174ffeff7bd718a8dd9e64603

Contents?: true

Size: 815 Bytes

Versions: 3

Compression:

Stored size: 815 Bytes

Contents

require 'arbetsformedlingen/api/values/soklista_values'

module Arbetsformedlingen
  module API
    module SoklistaResult
      def self.build(response_data)
        data = response_data.fetch('soklista')

        Values::SoklistaPage.new(
          list_name: data.fetch('listnamn'),
          total_ads: data.fetch('totalt_antal_platsannonser'),
          total_vacancies: data.fetch('totalt_antal_ledigajobb'),
          raw_data: response_data,
          data: data.fetch('sokdata').map do |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
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arbetsformedlingen-0.4.1 lib/arbetsformedlingen/api/results/soklista_result.rb
arbetsformedlingen-0.4.0 lib/arbetsformedlingen/api/results/soklista_result.rb
arbetsformedlingen-0.3.0 lib/arbetsformedlingen/api/results/soklista_result.rb