module Addresses
Public Instance Methods
create_address(constituent, address_type, city, postal_code, state, country, street1, street2, primary, options={})
click to toggle source
# File lib/tessitura_rest/crm/addresses.rb, line 15 def create_address(constituent, address_type, city, postal_code, state, country, street1, street2, primary, options={}) parameters = { 'AddressType': { 'Id': address_type }, 'City': city, 'Constituent': { 'Id': constituent }, 'Inactive': false, 'Label': true, 'Months': 'YYYYYYYYYYYY', 'PostalCode': postal_code, 'PrimaryIndicator': primary, 'State': { 'Id': state, 'Country': { 'Id': country } }, 'Street1': street1, 'Street2': street2, 'Country': { 'Id': country } } options.merge!(basic_auth: @auth, headers: @headers) options.merge!(:body => parameters) response = self.class.post(base_api_endpoint("CRM/Addresses"), options) JSON.parse(response.body) end
deactivate_address(id, options={})
click to toggle source
# File lib/tessitura_rest/crm/addresses.rb, line 84 def deactivate_address(id, options={}) current = get_address(id) parameters = { 'Id': id, 'UpdatedDateTime': current['UpdatedDateTime'], 'AddressType': { 'Id': current['AddressType']['Id'] }, 'City': current['City'], 'Constituent': { 'Id': current['Constituent']['Id'] }, 'Inactive': true, 'Label': true, 'Months': 'YYYYYYYYYYYY', 'PostalCode': current['PostalCode'], 'State': { 'Id': current['State']['Id'], 'Country': { 'Id': current['Country']['Id'] } }, 'Street1': current['Street1'], 'Street2': current['Street2'], 'Country': { 'Id': current['Country']['Id'] } } options.merge!(basic_auth: @auth, headers: @headers) options.merge!(:body => parameters) self.class.put(base_api_endpoint("CRM/Addresses/#{id}"), options) end
delete_address(address_id, options={})
click to toggle source
# File lib/tessitura_rest/crm/addresses.rb, line 118 def delete_address(address_id, options={}) options.merge!(basic_auth: @auth, headers: @headers) self.class.delete(base_api_endpoint("CRM/Addresses/#{address_id}"), options) end
get_address(address_id, options={})
click to toggle source
# File lib/tessitura_rest/crm/addresses.rb, line 3 def get_address(address_id, options={}) options.merge!(basic_auth: @auth, headers: @headers) response = self.class.get(base_api_endpoint("CRM/Addresses/#{address_id}"), options) JSON.parse(response.body) end
get_all_addresses(constituent_id, options={})
click to toggle source
# File lib/tessitura_rest/crm/addresses.rb, line 9 def get_all_addresses(constituent_id, options={}) options.merge!(basic_auth: @auth, headers: @headers) response = self.class.get(base_api_endpoint("CRM/Addresses?constituentId=#{constituent_id}"), options) JSON.parse(response.body) end
update_address(id, address_type, city, postal_code, state, country, street1, street2, primary, options={})
click to toggle source
# File lib/tessitura_rest/crm/addresses.rb, line 48 def update_address(id, address_type, city, postal_code, state, country, street1, street2, primary, options={}) current = get_address(id) parameters = { 'Id': id, 'UpdatedDateTime': current['UpdatedDateTime'], 'AddressType': { 'Id': address_type }, 'City': city, 'Constituent': { 'Id': current['Constituent']['Id'] }, 'Inactive': false, 'Label': true, 'Months': 'YYYYYYYYYYYY', 'PostalCode': postal_code, 'PrimaryIndicator': primary, 'State': { 'Id': state, 'Country': { 'Id': country } }, 'Street1': street1, 'Street2': street2, 'Country': { 'Id': country } } options.merge!(basic_auth: @auth, headers: @headers) options.merge!(:body => parameters) response = self.class.put(base_api_endpoint("CRM/Addresses/#{id}"), options) JSON.parse(response.body) end