Sha256: d52f9677b28370a77f1abc3a956f98336626b2260004efdfb6586d60fae2719f

Contents?: true

Size: 1.65 KB

Versions: 2

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

module Arbetsformedlingen
  module API
    module Values
      Ad = KeyStruct.new(
        :id,
        :url,
        :title,
        :body,
        :occupation,
        :occupation_id,
        :published_at,
        :total_vacancies,
        :municipalities,
        :municipality_id,
        :total_vacancies_with_visa,
        :employment_type,
        :terms,
        :application,
        :workplace,
        :requirements,
        :response
      )
      class Ad
        def to_h
          hash = super.to_h
          hash.delete(:response) # don't return the raw response object
          hash[:terms] = hash[:terms].to_h
          hash[:application] = hash[:application].to_h
          hash[:workplace] = hash[:workplace].to_h
          hash[:requirements] = hash[:requirements].to_h
          hash
        end
      end

      Terms = KeyStruct.new(
        :duration,
        :working_hours,
        :working_hours_description,
        :salary_type,
        :salary_form
      )

      Application = KeyStruct.new(
        :reference,
        :application_url,
        :email,
        :last_application_at,
        :application_comment
      )

      Workplace = KeyStruct.new(
        :name,
        :postal,
        :country,
        :visit_address,
        :logotype_url,
        :website,
        :contacts
      )
      class Workplace
        def to_h
          data = super.to_h
          data[:postal] = data[:postal].to_h
          data
        end
      end

      Contact = KeyStruct.new(:name, :title, :phone)
      Postal = KeyStruct.new(:code, :address, :city, :country)
      Requirements = KeyStruct.new(:own_car)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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