Module: Phones
- Included in:
- TessituraRest
- Defined in:
- lib/tessitura_rest/crm/phones.rb
Instance Method Summary collapse
- #create_primary_phone(id, phone, options = {}) ⇒ Object
- #create_secondary_phone(id, phone, options = {}) ⇒ Object
- #get_phone(id, options = {}) ⇒ Object
- #update_phone(id, phone, options = {}) ⇒ Object
Instance Method Details
#create_primary_phone(id, phone, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tessitura_rest/crm/phones.rb', line 9 def create_primary_phone(id, phone, ={}) parameters = { 'Constituent': { 'Id': id }, 'PhoneNumber': phone, 'PhoneType': { 'Description': 'Phone 1', 'Id': 1, 'Inactive': false } } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters) response = self.class.post(base_api_endpoint('CRM/Phones'), ) JSON.parse(response.body) end |
#create_secondary_phone(id, phone, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tessitura_rest/crm/phones.rb', line 28 def create_secondary_phone(id, phone, ={}) parameters = { 'Constituent': { 'Id': id }, 'PhoneNumber': phone, 'PhoneType': { 'Description': 'Phone 2', 'Id': 2, 'Inactive': false } } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters) response = self.class.post(base_api_endpoint('CRM/Phones'), ) JSON.parse(response.body) end |
#get_phone(id, options = {}) ⇒ Object
3 4 5 6 7 |
# File 'lib/tessitura_rest/crm/phones.rb', line 3 def get_phone(id, ={}) .merge!(basic_auth: @auth, headers: @headers) response = self.class.get(base_api_endpoint("CRM/Phones/#{id}"), ) JSON.parse(response.body) end |
#update_phone(id, phone, options = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/tessitura_rest/crm/phones.rb', line 47 def update_phone(id, phone, ={}) current = get_phone(id) parameters = { "Address": { "Id": current["Address"]["Id"], "AddressType": { "Id": current["Address"]["AddressType"]["Id"], } }, "Constituent": { "Id": current["Constituent"]["Id"] }, "PhoneType": { "Id": current["PhoneType"]["Id"], }, "Id": current["Id"], "PhoneNumber": phone, "UpdatedDateTime": current["UpdatedDateTime"], } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters) self.class.put(base_api_endpoint("CRM/Phones/#{id}"), ) end |