Sha256: 4cb54b9829614bb6c6ce7633794ce2e642123c3dcfc96596257bf4debe62f8cd

Contents?: true

Size: 669 Bytes

Versions: 4

Compression:

Stored size: 669 Bytes

Contents

require 'arbetsformedlingen/response'

module Arbetsformedlingen
  class Client
    BASE_URL = 'http://api.arbetsformedlingen.se/ledigtarbete'.freeze
    ROUTES = {
      post_job_url: "#{BASE_URL}/apiledigtarbete/hrxml",
      test_post_job_url: "#{BASE_URL}/apiledigtarbete/test/hrxml"
    }.freeze

    HEADERS = {
      'Content-type' => 'text/xml'
    }.freeze

    def self.post_job(xml)
      response = HTTParty.post(post_job_url, body: xml, headers: HEADERS)
      Response.new(response, xml)
    end

    def self.post_job_url
      return ROUTES.fetch(:test_post_job_url) if Arbetsformedlingen.config.test
      ROUTES.fetch(:post_job_url)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
arbetsformedlingen-0.2.0 lib/arbetsformedlingen/client.rb
arbetsformedlingen-0.1.2 lib/arbetsformedlingen/client.rb
arbetsformedlingen-0.1.1 lib/arbetsformedlingen/client.rb
arbetsformedlingen-0.1.0 lib/arbetsformedlingen/client.rb