Method: Xtify::Commands#register_device

Defined in:
lib/xtify/commands.rb

#register_device(opts = {}) ⇒ Object

Register and return a device with the provided details which can be used to refer to this device in the Xtify system. Calling this endpoint with a device that is already registered will result in the existing device being returned.

Parameters:

  • install_id -> (Required) This id along with your application key will

    uniquely identify your user in our system 
    and is used to manage uninstalls/reinstalls 
    and mapping registrations to existing users. 
    It does not have to be the device’s IMEI or 
    true device identifier. This must be unique 
    for every user of your application.
    
    Please note: If you use a custom install ID and 
    call the registration service from the same device 
    (ie same device token) multiple times with the same 
    install ID, the user will receive multiple messages.
    
  • type -> (Required) The SDK device type you have implemented in your app.

    Values restricted to: Xtify::Device::TYPES
    
  • device_token -> The Apple provided deviceToken received by registering

    with APNS
    
  • registration_id -> The Google provided registrationId received by

    registering with google’s cloud to device service.
    
  • blackberry_pin -> The RIM provided device PIN received by registering

    with the BlackBerry Push service.
    
  • user_key -> An optional customer defined key which can be

    associated with this user. Available to premium/enterprise 
    customers.
    
  • install_date -> Install date of this user.

  • badge -> Current badge for iOS only

  • v_os -> The operating system version of the device.

  • model -> The model name/number of the device.

  • carrier -> The carrier in use by the device.

  • Returns a Xtify ID for device



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/xtify/commands.rb', line 53

def register_device(opts={})
  validate_arguments('register_device', opts, :install_id, :type)
  validate_in_set('register_device', :type, opts, Device::TYPES.values)

  args = convert_to_args(opts,
    :blackberry_pin => 'blackberryPIN',
    :v_os => 'vOS'
  )

  result = post('users/register', args)
  Device.new(result)
end