Class: ICIMS::SearchRequest

Inherits:
Object
  • Object
show all
Includes:
Requestable
Defined in:
lib/icims/search_request.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, filters) ⇒ SearchRequest

Returns a new instance of SearchRequest.



6
7
8
9
# File 'lib/icims/search_request.rb', line 6

def initialize endpoint, filters
  @body = filters.to_json
  @url = customer_url + "/search/#{endpoint}"
end

Class Method Details

.perform(endpoint, filters) ⇒ Object



22
23
24
# File 'lib/icims/search_request.rb', line 22

def perform(endpoint, filters)
  new(endpoint, filters).call
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
# File 'lib/icims/search_request.rb', line 11

def call
  ICIMS.logger.info "POST #{@url} #{@body}"
  response = post_request
  ICIMS.logger.info response
  if response['errors'].present?
    raise Net::HTTPBadResponse, response['errors']
  end
  response
end