Module: RockRMS::Client::Person
- Included in:
- RockRMS::Client
- Defined in:
- lib/rock_rms/resources/person.rb
Constant Summary collapse
- NAME_SEARCH_DEFAULTS =
{ includeHtml: false, includeDetails: true, includeBusinesses: false, includeDeceased: false }.freeze
Instance Method Summary collapse
- #create_business(name:, email:, connection_status_value_id: nil, record_status_value_id: nil, record_type_value_id: 2) ⇒ Object
- #create_person(first_name:, last_name:, email:, gender: 1, connection_status_value_id: nil, record_status_value_id: nil, record_type_value_id: 1, email_preference: 0) ⇒ Object
- #find_person(id) ⇒ Object
- #find_person_by_alias_id(id) ⇒ Object
- #find_person_by_email(email) ⇒ Object
- #find_person_by_name(full_name, options = {}) ⇒ Object
- #launch_person_workflow(id, workflow_type_id:, workflow_name:, attributes: {}) ⇒ Object
- #list_people(options = {}) ⇒ Object
- #update_person(id, options = {}) ⇒ Object
Instance Method Details
#create_business(name:, email:, connection_status_value_id: nil, record_status_value_id: nil, record_type_value_id: 2) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rock_rms/resources/person.rb', line 66 def create_business(name:, email:, connection_status_value_id: nil, record_status_value_id: nil, record_type_value_id: 2) = { 'IsSystem' => false, 'LastName' => name, 'Email' => email, 'Gender' => 1, 'ConnectionStatusValueId' => connection_status_value_id, 'RecordStatusValueId' => record_status_value_id, 'RecordTypeValueId' => record_type_value_id, } # RecordTypeValueId 2 = Business post(people_path, ) end |
#create_person(first_name:, last_name:, email:, gender: 1, connection_status_value_id: nil, record_status_value_id: nil, record_type_value_id: 1, email_preference: 0) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/rock_rms/resources/person.rb', line 38 def create_person( first_name:, last_name:, email:, gender: 1, connection_status_value_id: nil, record_status_value_id: nil, record_type_value_id: 1, email_preference: 0 ) = { 'IsSystem' => false, 'FirstName' => first_name, 'LastName' => last_name, 'Email' => email, 'EmailPreference' => email_preference, 'Gender' => gender, 'ConnectionStatusValueId' => connection_status_value_id, 'RecordStatusValueId' => record_status_value_id, 'RecordTypeValueId' => record_type_value_id } # RecordTypeValueId 1 = Person # RecordTypeValueId 2 = Business post(people_path, ) end |
#find_person(id) ⇒ Object
9 10 11 12 |
# File 'lib/rock_rms/resources/person.rb', line 9 def find_person(id) res = get(people_path(id)) Response::Person.format(res) end |
#find_person_by_alias_id(id) ⇒ Object
14 15 16 |
# File 'lib/rock_rms/resources/person.rb', line 14 def find_person_by_alias_id(id) Response::Person.format(get("People/GetByPersonAliasId/#{id}")) end |
#find_person_by_email(email) ⇒ Object
18 19 20 21 |
# File 'lib/rock_rms/resources/person.rb', line 18 def find_person_by_email(email) res = get("People/GetByEmail/#{email}") Response::Person.format(res) end |
#find_person_by_name(full_name, options = {}) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/rock_rms/resources/person.rb', line 30 def find_person_by_name(full_name, = {}) priority = .merge(name: full_name) Response::Person.format( get('People/Search', NAME_SEARCH_DEFAULTS.merge(priority)) ) end |
#launch_person_workflow(id, workflow_type_id:, workflow_name:, attributes: {}) ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/rock_rms/resources/person.rb', line 86 def launch_person_workflow( id, workflow_type_id:, workflow_name:, attributes: {} ) query_string = "?workflowTypeId=#{workflow_type_id}&workflowName=#{workflow_name}" post(people_path + "/LaunchWorkflow/#{id}#{query_string}", attributes) end |
#list_people(options = {}) ⇒ Object
4 5 6 7 |
# File 'lib/rock_rms/resources/person.rb', line 4 def list_people( = {}) res = get(people_path, ) Response::Person.format(res) end |
#update_person(id, options = {}) ⇒ Object
82 83 84 |
# File 'lib/rock_rms/resources/person.rb', line 82 def update_person(id, = {}) put(people_path(id), ) end |