Module: Phones
- Included in:
- TessituraRest
- Defined in:
- lib/tessitura_rest/crm/phones.rb
Instance Method Summary collapse
- #create_primary_phone(id, phone, options = {}) ⇒ Object
- #delete_phone(id, options = {}) ⇒ Object
- #get_phone(id, options = {}) ⇒ Object
- #update_phone(id, phone, options = {}) ⇒ Object
Instance Method Details
#create_primary_phone(id, phone, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tessitura_rest/crm/phones.rb', line 8 def create_primary_phone(id, phone, = {}) parameters = { 'Constituent': { 'Id': id, }, 'Inactive': false, 'PhoneNumber': phone, 'PhoneType': { 'Description': 'Cell Phone', 'Id': 5, 'Inactive': false, }, 'IsMobile': true, 'PrimaryIndicator': true, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) response = self.class.post(base_api_endpoint('CRM/Phones'), ) JSON.parse(response.body) end |
#delete_phone(id, options = {}) ⇒ Object
30 31 32 33 |
# File 'lib/tessitura_rest/crm/phones.rb', line 30 def delete_phone(id, = {}) .merge!(basic_auth: @auth, headers: @headers) self.class.delete(base_api_endpoint("CRM/Phones/#{id}"), ) end |
#get_phone(id, options = {}) ⇒ Object
2 3 4 5 6 |
# File 'lib/tessitura_rest/crm/phones.rb', line 2 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
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/tessitura_rest/crm/phones.rb', line 35 def update_phone(id, phone, = {}) current = get_phone(id) parameters = { 'Constituent': { 'Id': current['Constituent']['Id'], }, 'PhoneType': { 'Id': 5, }, 'Id': current['Id'], 'PhoneNumber': phone, 'UpdatedDateTime': current['UpdatedDateTime'], 'IsMobile': true, 'PrimaryIndicator': true } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) self.class.put(base_api_endpoint("CRM/Phones/#{id}"), ) end |