Class: Bullhorn::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bullhorn/client.rb

Defined Under Namespace

Classes: NoCredentials

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.apiKey=(value) ⇒ Object (writeonly)

Sets the attribute apiKey

Parameters:

  • value

    the value to set the attribute apiKey to.



9
10
11
# File 'lib/bullhorn/client.rb', line 9

def apiKey=(value)
  @apiKey = value
end

.password=(value) ⇒ Object (writeonly)

Sets the attribute password

Parameters:

  • value

    the value to set the attribute password to.



9
10
11
# File 'lib/bullhorn/client.rb', line 9

def password=(value)
  @password = value
end

.username=(value) ⇒ Object (writeonly)

Sets the attribute username

Parameters:

  • value

    the value to set the attribute username to.



9
10
11
# File 'lib/bullhorn/client.rb', line 9

def username=(value)
  @username = value
end

Class Method Details

.add_file(body) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/bullhorn/client.rb', line 38

def add_file body
  client = connection
  session = @session
  client.request :tns, :addFile do
    body[:session] = session
    soap.body = body
  end
end

.api(operation, body) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/bullhorn/client.rb', line 11

def api operation, body
  client = connection
  session = @session
  client.request :tns, operation.to_sym do
    body[:session] = session
    soap.body = body
  end
end

.authenticateObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/bullhorn/client.rb', line 153

def authenticate
  username = @username
  password = @password
  apiKey = @apiKey
  response = @connection.request :start_session do
    soap.body = {
      :username => username, 
      :password => password,
      :apiKey => apiKey
    }
  end

  @session = response.body[:start_session_response][:return][:session]
  @connection
end

.clear_connectionObject



169
170
171
# File 'lib/bullhorn/client.rb', line 169

def clear_connection
  @connection = nil
end

.connectionObject

Raises:



139
140
141
142
143
144
145
146
# File 'lib/bullhorn/client.rb', line 139

def connection

  raise NoCredentials if @username.nil?
  raise NoCredentials if @password.nil?
  raise NoCredentials if @apiKey.nil?

  @connection ||= new_connection
end

.eventsGetEvents(body) ⇒ Object



128
129
130
131
132
133
134
135
# File 'lib/bullhorn/client.rb', line 128

def eventsGetEvents body
  client = connection
  session = @session
  client.request :tns, :eventsGetEvents do
    body[:session] = session
    soap.body = body
  end
end

.eventsSubscribe(body) ⇒ Object



110
111
112
113
114
115
116
117
# File 'lib/bullhorn/client.rb', line 110

def eventsSubscribe body
  client = connection
  session = @session
  client.request :tns, :eventsSubscribe do
    body[:session] = session
    soap.body = body
  end
end

.eventsUnsubscribe(body) ⇒ Object



119
120
121
122
123
124
125
126
# File 'lib/bullhorn/client.rb', line 119

def eventsUnsubscribe body
 client = connection
 session = @session
 client.request :tns, :eventsUnsubscribe do
   body[:session] = session
   soap.body = body 
 end
end

.findCandidate(body) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/bullhorn/client.rb', line 56

def findCandidate body
  client = connection
  session = @session
  client.request :findCandidate do
    body[:session] = session
    soap.body = body
  end
end

.findMultiple(body) ⇒ Object



92
93
94
95
96
97
98
99
# File 'lib/bullhorn/client.rb', line 92

def findMultiple body
  client = connection
  session = @session
  client.request :tns, :findMultiple do
    body[:session] = session
    soap.body = body
  end
end

.get_entity_files(body) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/bullhorn/client.rb', line 20

def get_entity_files body
  client = connection
  session = @session
  client.request :tns, :getEntityFiles do
    body[:session] = session
    soap.body = body
  end
end

.getAssociationIds(body) ⇒ Object



101
102
103
104
105
106
107
108
# File 'lib/bullhorn/client.rb', line 101

def getAssociationIds body
  client = connection
  session = @session
  client.request :tns, :getAssociationIds do
    body[:session] = session
    soap.body = body
  end
end

.getFile(body) ⇒ Object



83
84
85
86
87
88
89
90
# File 'lib/bullhorn/client.rb', line 83

def getFile body
  client = connection
  session = @session
  client.request :tns, :getFile do
    body[:session] = session
    soap.body = body
  end
end

.new_connectionObject



148
149
150
151
# File 'lib/bullhorn/client.rb', line 148

def new_connection
  @connection = Savon.client "https://api.bullhornstaffing.com/webservices-2.5/?wsdl"
  authenticate
end

.parse(body) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/bullhorn/client.rb', line 29

def parse body
  client = connection
  session = @session
  client.request :tns, :parseResume do
    body[:session] = session
    soap.body = body
  end
end

.query(body) ⇒ Object



74
75
76
77
78
79
80
81
# File 'lib/bullhorn/client.rb', line 74

def query body
  client = connection
  session = @session
  client.request :query do
    body[:session] = session
    soap.body = body
  end
end

.save(body) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/bullhorn/client.rb', line 65

def save body
  client = connection
  session = @session
  client.request :save do
    body[:session] = session
    soap.body = body
  end
end

.update_file(body) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/bullhorn/client.rb', line 47

def update_file body
  client = connection
  session = @session
  client.request :tns, :updateFile do
    body[:session] = session
    soap.body = body
  end
end