Sha256: 0e8da46eb33bc0ae40c8d8f4d1bdbc9279479d90424154302cd5375cacff88ec

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module Arbetsformedlingen
  module API
    module Values
      MatchningPage = KeyStruct.new(
        :list_name,
        :total_ads,
        :total_ads_exact,
        :total_ads_nearby,
        :total_vacancies_on_page,
        :total_places_total,
        :total_pages,
        :data,
        :raw_data,
        :response
      )
      class MatchningPage
        include Enumerable

        def each(&block)
          data.each(&block)
        end

        def to_h
          hash = super.to_h
          hash.delete(:response) # don't return the raw response object
          hash[:data].map!(&:to_h)
          hash
        end

        def success?
          success
        end
      end

      MatchningAd = KeyStruct.new(
        :id,
        :title,
        :occupation,
        :occupation_id,
        :company,
        :municipalities,
        :municipality_id,
        :published_at,
        :last_application_at,
        :url,
        :relevance,
        :total_vacancies,
        :total_vacancies_with_visa,
        :duration_id,
        :counties,
        :country_id,
        :employment_type
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arbetsformedlingen-0.7.0 lib/arbetsformedlingen/api/values/matchning_result_values.rb
arbetsformedlingen-0.6.0 lib/arbetsformedlingen/api/values/matchning_result_values.rb