2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/tessitura_rest/web/registration.rb', line 2
def register_user(session_key, address, first_name, last_name, email, password, promotion, special_offer, phone, options = {})
parameters =
{
'FirstName': first_name,
'LastName': last_name,
'ElectronicAddress': {
'Address': email,
'AllowMarketing': special_offer || 0,
},
'WebLogin': {
'Login': email,
'LoginTypeId': 1,
'Password': password,
},
'Address': {
'AddressTypeId': 3,
'City': address.city,
'PostalCode': address.postal_code,
'StateId': address.state,
'Street1': address.street1,
'Street2': address.street2,
'CountryId': address.country,
},
'ConstituentTypeId': 1,
'OriginalSourceId': 3,
'SourceId': promotion,
'Phones':
[
{
'PhoneNumber': phone,
'PhoneTypeId': 5,
},
],
}
options.merge!(basic_auth: @auth, headers: @headers)
options.merge!(:body => parameters.to_json, :headers => { 'Content-Type' => 'application/json' })
self.class.post(base_api_endpoint("Web/Registration/#{session_key}/Register"), options)
end
|