class RemoteOK::Job

Class representing a single job from RemoteOK with data accessors.

Constants

HTML_CHARS_REGEX

Attributes

raw[R]

Public Class Methods

new(job_data) click to toggle source
# File lib/remoteok/job.rb, line 12
def initialize(job_data)
  @raw = job_data
end

Public Instance Methods

apply_url() click to toggle source
# File lib/remoteok/job.rb, line 84
def apply_url
  raw['apply_url']
end
company() click to toggle source
# File lib/remoteok/job.rb, line 38
def company
  raw['company']
end
date() click to toggle source
# File lib/remoteok/job.rb, line 32
def date
  return unless raw['date']

  DateTime.parse raw['date']
end
description() click to toggle source
# File lib/remoteok/job.rb, line 62
def description
  raw['description']
end
description_text() click to toggle source
# File lib/remoteok/job.rb, line 66
def description_text
  return unless raw['description']

  raw['description'].gsub(HTML_CHARS_REGEX, ' ').strip.gsub(/\s+/, ' ')
end
epoch() click to toggle source
# File lib/remoteok/job.rb, line 26
def epoch
  return unless raw['epoch']

  Integer raw['epoch']
end
id() click to toggle source
# File lib/remoteok/job.rb, line 20
def id
  return unless raw['id']

  Integer raw['id']
end
location() click to toggle source
# File lib/remoteok/job.rb, line 72
def location
  raw['location']
end
original() click to toggle source
# File lib/remoteok/job.rb, line 76
def original
  raw['original']
end
position() click to toggle source
# File lib/remoteok/job.rb, line 46
def position
  raw['position']
end
slug() click to toggle source
# File lib/remoteok/job.rb, line 16
def slug
  raw['slug']
end
tags() click to toggle source
# File lib/remoteok/job.rb, line 50
def tags
  return unless raw['tags']

  raw['tags'].map do |tag|
    tag.gsub(' ', '_').to_sym
  end
end
url() click to toggle source
# File lib/remoteok/job.rb, line 80
def url
  raw['url']
end