Module: Registration

Included in:
TessituraRest
Defined in:
lib/tessitura_rest/web/registration.rb

Instance Method Summary collapse

Instance Method Details

#register_user(session_key, address, first_name, last_name, email, password, promotion, special_offer, phone, options = {}) ⇒ Object



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)
  self.class.post(base_api_endpoint("Web/Registration/#{session_key}/Register"), options)
end

#register_user_v16(session_key, address, first_name, last_name, email, password, promotion, special_offer, phone, options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/tessitura_rest/web/registration.rb', line 41

def register_user_v16(session_key, address, first_name, last_name, email, password, promotion, special_offer, phone, options = {})
  parameters =
    {
      'FirstName': first_name,
      'LastName': last_name,
      'PrimaryElectronicAddress': {
        'Address': email,
        'AllowMarketing': special_offer || 0,
      },
      'WebLogin': {
        'Login': email,
        'LoginTypeId': 1,
        'Password': password,
      },
      'PrimaryAddress': {
        '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,
      'PrimaryPhone':
        {
          'PhoneNumber': phone,
          'PhoneTypeId': 5,
          'IsMobile': true,
        },
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Registration/#{session_key}/Register"), options)
end