Class: Tazworks::Applicant
Overview
Tazworks Applicants Model
Instance Attribute Summary
Attributes inherited from Model
#attributes, #attributes_loaded, #ids
Class Method Summary collapse
- .all(clientGuid, params = {}) ⇒ Object
- .create(clientGuid, params) ⇒ Object
- .get(ids) ⇒ Object
- .submit_order(params) ⇒ Object
Instance Method Summary collapse
Methods inherited from Model
#attributes_loaded?, #clientGuid, find, #initialize, initialize_from_response, #load_attributes, #loaded_attributes, #reload
Constructor Details
This class inherits a constructor from Tazworks::Model
Class Method Details
.all(clientGuid, params = {}) ⇒ Object
30 31 32 33 |
# File 'lib/tazworks/applicant.rb', line 30 def self.all(clientGuid, params = {}) raw_response = RestClient.get("/v1/clients/#{clientGuid}/applicants", { params: }) ApplicantPagedResponse.new(raw_response, { clientGuid: }) end |
.create(clientGuid, params) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tazworks/applicant.rb', line 12 def self.create(clientGuid, params) required_params = %w[firstName lastName email] required_params.each do |rp| raise ArgumentError, "#{rp} is missing in params hash." unless params.key?(rp.to_sym) end response = RestClient.post("/v1/clients/#{clientGuid}/applicants", params) applicant = Applicant.initialize_from_response({ clientGuid: }, response) applicant.ids[:applicantGuid] = applicant.attributes[:applicantGuid] applicant end |
.get(ids) ⇒ Object
7 8 9 |
# File 'lib/tazworks/applicant.rb', line 7 def self.get(ids) RestClient.get("/v1/clients/#{ids[:clientGuid]}/applicants/#{ids[:applicantGuid]}") end |
Instance Method Details
#applicantGuid ⇒ Object
35 36 37 |
# File 'lib/tazworks/applicant.rb', line 35 def applicantGuid @ids[:applicantGuid] end |