Class: Roseflow::LinkedIn::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/roseflow/linkedin/job.rb,
lib/roseflow/linkedin/job/object.rb,
lib/roseflow/linkedin/job/search_query.rb,
lib/roseflow/linkedin/job/profile_query.rb

Defined Under Namespace

Classes: Object, ProfileQuery, SearchQuery

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Job

Returns a new instance of Job.



10
11
12
# File 'lib/roseflow/linkedin/job.rb', line 10

def initialize(connection)
  @connection = connection
end

Instance Method Details

#find(url, **options) ⇒ Object



14
15
16
17
18
19
# File 'lib/roseflow/linkedin/job.rb', line 14

def find(url, **options)
  query = ProfileQuery.new(url: url, **options)
  response = @connection.get("linkedin/job", query.to_h)
  return Job::Object.new(JSON.parse(response.body).merge(url: url)) if job_found?(response)
  return nil if job_not_found?(response)
end

#search(query) ⇒ Object



21
22
23
24
25
# File 'lib/roseflow/linkedin/job.rb', line 21

def search(query)
  query = SearchQuery.new(query)
  response = @connection.get("v2/linkedin/company/job", query.to_request_params)
  return JobListEntry.from(JSON.parse(response.body)) if job_found?(response)
end