module Registration

Public Instance Methods

register_user(session_key, address, first_name, last_name, email, password, promotion, special_offer, phone, options={}) click to toggle source
# File lib/tessitura_rest/web/registration.rb, line 3
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': 1
              },
            ],
        }
  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