Class: TFSO::Person
Constant Summary collapse
- URL =
'https://webservices.24sevenoffice.com/CRM/Contact/PersonService.asmx?WSDL'
Instance Method Summary collapse
- #create(person_info) ⇒ Object
- #find(search_params = {}) ⇒ Object
-
#initialize(auth) ⇒ Person
constructor
A new instance of Person.
Methods included from Helpers
#ensure_authenticated, #intialize_savon_client, #savon_client, #session_id, #session_id=
Constructor Details
#initialize(auth) ⇒ Person
Returns a new instance of Person.
8 9 10 11 12 |
# File 'lib/tfso/person.rb', line 8 def initialize(auth) ensure_authenticated(auth) self.session_id = auth.session_id intialize_savon_client end |
Instance Method Details
#create(person_info) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tfso/person.rb', line 28 def create(person_info) response = savon_client.call(:save_person, message: {personItem: person_info}, cookies: @cookies) result = response.body[:save_person_response][:save_person_result] if result if result.class == Hash if result[:api_exception] raise result[:api_exception] else result end else result end else false end end |
#find(search_params = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tfso/person.rb', line 14 def find(search_params={}) response = savon_client.call(:get_persons, message: {personSearch: search_params}, cookies: @cookies) result = response.body[:get_persons_response][:get_persons_result] if result if result[:person_item].class == Hash [result[:person_item]] else result[:person_item] end else [] end end |