anthonator / dirigible

Ruby wrapper for the Urban Airship v3 API
MIT License
11 stars 10 forks source link

DeviceRegistration.register_apid takes optional hash #14

Closed johnnaegle closed 10 years ago

johnnaegle commented 10 years ago

Make params (now named options) optional for Dirigible::DeviceRegistration.register_apid as it is for the other device registration calls

anthonator commented 10 years ago

Generally if I don't make params optional it's because the API is expecting them in all cases. Does UA require alias and/or tags when registering an APID or are they optional?

According to the UA documentation:

"Unlike registration for iOS and Blackberry applications, basic registration tying an APID to your application happens automatically. The registration API can be used to set tags or aliases."

So it seems to me that the purpose of the API call is to set tags/aliases but the documentation is a little ambiguous. Can you verify that it's not required?

johnnaegle commented 10 years ago

I interpreted the API documentation the same as in the IOS registration: the tags and other parameters are optional, and if you are doing something different via an API call than via the device you might get unexpected behavior.

This seems to be relevant to answering the question you pose:

However, if you are setting tags via the API, you will need to add ..

That seems to imply the tags are optional.

Moreover, from the console, it registers the device without options:

> droid_token = "1111111-1111-1111-1111-111111111111"
> Dirigible::DeviceRegistration.register_apid(droid_token)
200
OK
=> nil

The 200/OK are the status and body from the response.

And I see my device registered:

> Dirigible::DeviceInformation.list_apids
{:apids=>
  [{
    "apid" : "01111111-1111-1111-1111-111111111111",
    "tags" : [ ],
    "alias" : null,
    "active" : true,
    "created" : "2014-01-29 17:54:13",
    "c2dm_registration_id" : null
  }]
}
anthonator commented 10 years ago

Thanks for verifying.