Class: Spear::Structure::Job::Search

Inherits:
Base
  • Object
show all
Includes:
EmbededClass
Defined in:
lib/spear/structure/job/search.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#error_message, #response, #root, #status

Instance Method Summary collapse

Methods included from EmbededClass

#generate_jobs

Methods inherited from Base

#success?

Constructor Details

#initialize(response) ⇒ Search

Returns a new instance of Search.



10
11
12
13
14
15
16
17
18
19
# File 'lib/spear/structure/job/search.rb', line 10

def initialize(response)
  super(response)

  if response.class == HTTParty::Response
    @tn_did = response.request.options[:query][:TalentNetworkDID]
  end

  job_search_result = @root['Results'].nil? ? [] : @root['Results']['JobSearchResult']
  @jobs = generate_jobs(job_search_result, @tn_did) rescue nil
end

Instance Attribute Details

#jobsObject

Returns the value of attribute jobs.



8
9
10
# File 'lib/spear/structure/job/search.rb', line 8

def jobs
  @jobs
end

#tn_didObject (readonly)

Returns the value of attribute tn_did.



7
8
9
# File 'lib/spear/structure/job/search.rb', line 7

def tn_did
  @tn_did
end