Module: Freelancer::API::Job::InstanceMethods

Defined in:
lib/freelancer/api/job.rb

Instance Method Summary collapse

Instance Method Details

#job_categoriesObject

Retrieve a list of available job categories



15
16
17
18
19
20
# File 'lib/freelancer/api/job.rb', line 15

def job_categories
  
  result = api_get("/Job/getCategoryJobList.json")
  ::Freelancer::Models::JobCategory.parse_collection(result, :shift => [ :"json-result", :items, :category ])

end

#jobsObject

Retrieve a list of available jobs



7
8
9
10
11
12
# File 'lib/freelancer/api/job.rb', line 7

def jobs

  result = api_get("/Job/getJobList.json")
  ::Freelancer::Models::Job.parse_collection(result, :shift => [ :"json-result", :items ])
  
end

#my_jobsObject

Retrieve a list of the current users jobs



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/freelancer/api/job.rb', line 23

def my_jobs
  
  result = api_get("/Job/getMyJobList.json")

  # We need to hack this to make the job id a sub element of the
  # job node to make the mapping work properly.
  json_result = JSONMapper::Parser.parse(result)
  jobs = []
  unless json_result.nil?

    json_result[:"json-result"][:items][:job].each do |item|
      jobs << { :id => item }
    end

  end

  ::Freelancer::Models::Job.parse_json_collection(jobs)

end