Class: ApplicantTracking::Jobs
- Defined in:
- lib/applicant_tracking_api/resources/jobs.rb
Defined Under Namespace
Classes: Applications
Instance Method Summary collapse
- #applications(params = {}) ⇒ Object
-
#initialize(attributes = {}, persisted = false) ⇒ Jobs
constructor
A new instance of Jobs.
Methods inherited from Resource
Constructor Details
#initialize(attributes = {}, persisted = false) ⇒ Jobs
Returns a new instance of Jobs.
7 8 9 10 11 12 13 14 |
# File 'lib/applicant_tracking_api/resources/jobs.rb', line 7 def initialize(attributes = {}, persisted = false) # Server implements "find" functionality by # returning a one-element array, which active # resource does not like. Therefore, when # given an array, must use the first element. attributes = attributes[0] if attributes.is_a?(Array) super(attributes, persisted) end |
Instance Method Details
#applications(params = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/applicant_tracking_api/resources/jobs.rb', line 16 def applications(params = {}) # get my applications my_id = self.id.to_s Class.new(ApplicantTracking::Applications) do def self.name superclass.to_s end def create @is_creating = true super() ensure @is_creating = false end def load(attributes, remove_root = false, persisted = false) # AT API does not return a # hash as AR expects, so # circumvent this method when # creating a new application. if(! @is_creating) super(attributes, remove_root, persisted) end end def update run_callbacks :update do connection.post(element_path(), encode, self.class.headers) end end self.prefix = "/remote/jobs/#{my_id}/" end end |