Class: Arbetsformedlingen::API::WSOccupationClient

Inherits:
Object
  • Object
show all
Defined in:
lib/arbetsformedlingen/api/ws_occupation_client.rb

Overview

WsOccupation API client

Constant Summary collapse

SERVICE_URL =

Service URL

'https://api.arbetsformedlingen.se/af/v0/Occupation/wsoccupation.asmx'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWSOccupationClient

Initialize client



16
17
18
# File 'lib/arbetsformedlingen/api/ws_occupation_client.rb', line 16

def initialize
  @request = SOAPRequest.new(SERVICE_URL)
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



10
11
12
# File 'lib/arbetsformedlingen/api/ws_occupation_client.rb', line 10

def request
  @request
end

Instance Method Details

#find_occupations(name) ⇒ Response

Returns occupations response with specified name

Returns:

See Also:



38
39
40
41
42
43
44
45
46
# File 'lib/arbetsformedlingen/api/ws_occupation_client.rb', line 38

def find_occupations(name)
  soap_body = SOAPBuilder.wrap do |body|
    body.FindOccupation(xmlns: 'urn:ams.se:wsoccupation') do |node|
      node.name(name)
    end
  end

  request.post(soap_body.to_xml)
end

#occupation(id) ⇒ Response

Returns occupation response with specified id

Returns:

See Also:



24
25
26
27
28
29
30
31
32
# File 'lib/arbetsformedlingen/api/ws_occupation_client.rb', line 24

def occupation(id)
  soap_body = SOAPBuilder.wrap do |body|
    body.GetOccupationById(xmlns: 'urn:ams.se:wsoccupation') do |node|
      node.occupationId(id)
    end
  end

  request.post(soap_body.to_xml)
end

#occupationsResponse

Returns occupations response

Returns:

See Also:



52
53
54
55
56
57
58
# File 'lib/arbetsformedlingen/api/ws_occupation_client.rb', line 52

def occupations
  soap_body = SOAPBuilder.wrap do |body|
    body.GetAllOccupations(xmlns: 'urn:ams.se:wsoccupation')
  end

  request.post(soap_body.to_xml)
end

#occupations_detailedResponse

Returns occupations detailed response with specified id

Returns:

See Also:



76
77
78
79
80
81
82
# File 'lib/arbetsformedlingen/api/ws_occupation_client.rb', line 76

def occupations_detailed
  soap_body = SOAPBuilder.wrap do |body|
    body.GetAllOccupationsDetailed(xmlns: 'urn:ams.se:wsoccupation')
  end

  request.post(soap_body.to_xml)
end

#occupations_shortResponse

Returns occupations short response with specified id

Returns:

See Also:



64
65
66
67
68
69
70
# File 'lib/arbetsformedlingen/api/ws_occupation_client.rb', line 64

def occupations_short
  soap_body = SOAPBuilder.wrap do |body|
    body.GetAllOccupationsShort(xmlns: 'urn:ams.se:wsoccupation')
  end

  request.post(soap_body.to_xml)
end