Class: Arbetsformedlingen::API::WSOccupationClient
- Inherits:
-
Object
- Object
- Arbetsformedlingen::API::WSOccupationClient
- 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
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#find_occupations(name) ⇒ Response
Returns occupations response with specified name.
-
#initialize ⇒ WSOccupationClient
constructor
Initialize client.
-
#occupation(id) ⇒ Response
Returns occupation response with specified id.
-
#occupations ⇒ Response
Returns occupations response.
-
#occupations_detailed ⇒ Response
Returns occupations detailed response with specified id.
-
#occupations_short ⇒ Response
Returns occupations short response with specified id.
Constructor Details
#initialize ⇒ WSOccupationClient
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
#request ⇒ Object (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
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
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 |
#occupations ⇒ Response
Returns occupations response
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_detailed ⇒ Response
Returns occupations detailed response with specified id
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_short ⇒ Response
Returns occupations short response with specified id
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 |