Sha256: 2cedd8266ac55406e1b68d4997e15b307307b74c3a6302e203cba90223c4a49a
Contents?: true
Size: 975 Bytes
Versions: 1
Compression:
Stored size: 975 Bytes
Contents
# frozen_string_literal: true require 'arbetsformedlingen/api/request' require 'arbetsformedlingen/api/values/create_ad_page' module Arbetsformedlingen module API # API client for ledigtarbete class LedigtarbeteClient # Base URL for ledigtarbete BASE_URL = 'http://api.arbetsformedlingen.se/ledigtarbete'.freeze # HTTP headers HEADERS = { 'Content-type' => 'text/xml', }.freeze # Post ad to API # @param [Arbetsformedlingen::Packet, #to_xml] packet the data to be sent # @return [Values::CreateAdPage] the API result def create_ad(packet) xml = packet.to_xml url = if Arbetsformedlingen.config.test 'apiledigtarbete/test/hrxml' else 'apiledigtarbete/hrxml' end response = HTTParty.post("#{BASE_URL}/#{url}", body: xml, headers: HEADERS) Values::CreateAdPage.new(response, xml) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arbetsformedlingen-0.7.0 | lib/arbetsformedlingen/api/ledigtarbete_client.rb |