Skip to content

Commit

Permalink
feat: additional device id support (#21)
Browse files Browse the repository at this point in the history
* feat: additional device id support

* fix: update python version in CI

github actions removed support for 3.5/3.6 in their latest ubuntu image

Co-authored-by: Sam Dozor <sdozor@mparticle.com>
  • Loading branch information
samdozor and Sam Dozor authored Dec 7, 2022
1 parent f2dc143 commit cd0c601
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
Expand Down
80 changes: 79 additions & 1 deletion mparticle/models/device_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

class DeviceInformation(object):

def __init__(self, brand=None, product=None, device=None, android_uuid=None, device_manufacturer=None, platform=None, os_version=None, device_model=None, screen_height=None, screen_width=None, screen_dpi=None, device_country=None, locale_language=None, locale_country=None, network_country=None, network_carrier=None, network_code=None, network_mobile_country_code=None, timezone_offset=None, build_identifier=None, http_header_user_agent=None, ios_advertising_id=None, push_token=None, cpu_architecture=None, is_tablet=None, push_notification_sound_enabled=None, push_notification_vibrate_enabled=None, radio_access_technology=None, supports_telephony=None, has_nfc=None, bluetooth_enabled=None, bluetooth_version=None, att_timestamp_unixtime_ms=None, att_authorization_status=None, ios_idfv=None, android_advertising_id=None):
def __init__(self, brand=None, product=None, device=None, android_uuid=None, device_manufacturer=None, platform=None, os_version=None, device_model=None, screen_height=None, screen_width=None, screen_dpi=None, device_country=None, locale_language=None, locale_country=None, network_country=None, network_carrier=None, network_code=None, network_mobile_country_code=None, timezone_offset=None, build_identifier=None, http_header_user_agent=None, ios_advertising_id=None, push_token=None, cpu_architecture=None, is_tablet=None, push_notification_sound_enabled=None, push_notification_vibrate_enabled=None, radio_access_technology=None, supports_telephony=None, has_nfc=None, bluetooth_enabled=None, bluetooth_version=None, att_timestamp_unixtime_ms=None, att_authorization_status=None, ios_idfv=None, android_advertising_id=None, amp_id=None, roku_advertising_id=None, roku_publisher_id=None, microsoft_advertising_id=None, microsoft_publisher_id=None, fire_advertising_id=None):
"""
DeviceInformation - a model defined in Swagger
Expand Down Expand Up @@ -72,6 +72,12 @@ def __init__(self, brand=None, product=None, device=None, android_uuid=None, dev
'has_nfc': 'bool',
'bluetooth_enabled': 'bool',
'bluetooth_version': 'str',
'amp_id': 'str',
'roku_advertising_id': 'str',
'roku_publisher_id': 'str',
'microsoft_advertising_id': 'str',
'microsoft_publisher_id': 'str',
'fire_advertising_id': 'str',
'att_timestamp_unixtime_ms': 'int',
'att_authorization_status': 'str',
'ios_idfv': 'str',
Expand Down Expand Up @@ -111,6 +117,12 @@ def __init__(self, brand=None, product=None, device=None, android_uuid=None, dev
'has_nfc': 'has_nfc',
'bluetooth_enabled': 'bluetooth_enabled',
'bluetooth_version': 'bluetooth_version',
'amp_id': 'amp_id',
'roku_advertising_id': 'roku_advertising_id',
'roku_publisher_id': 'roku_publisher_id',
'microsoft_advertising_id': 'microsoft_advertising_id',
'microsoft_publisher_id': 'microsoft_publisher_id',
'fire_advertising_id': 'fire_advertising_id',
'att_timestamp_unixtime_ms': 'att_timestamp_unixtime_ms',
'att_authorization_status': 'att_authorization_status',
'ios_idfv': 'ios_idfv',
Expand Down Expand Up @@ -149,6 +161,12 @@ def __init__(self, brand=None, product=None, device=None, android_uuid=None, dev
self._has_nfc = has_nfc
self._bluetooth_enabled = bluetooth_enabled
self._bluetooth_version = bluetooth_version
self.amp_id = amp_id
self.roku_advertising_id = roku_advertising_id
self.roku_publisher_id = roku_publisher_id
self.microsoft_advertising_id = microsoft_advertising_id
self.microsoft_publisher_id = microsoft_publisher_id
self.fire_advertising_id = fire_advertising_id
self.att_timestamp_unixtime_ms = att_timestamp_unixtime_ms
self.att_authorization_status = att_authorization_status
self.ios_idfv = ios_idfv
Expand Down Expand Up @@ -909,6 +927,66 @@ def bluetooth_version(self, bluetooth_version):

self._bluetooth_version = bluetooth_version

@property
def amp_id(self):
return self._amp_id

@amp_id.setter
def amp_id(self, amp_id):
self._amp_id = amp_id

@property
def roku_advertising_id(self):
return self._roku_advertising_id

@roku_advertising_id.setter
def roku_advertising_id(self, roku_advertising_id):

error = self.validateUUID(roku_advertising_id)
if (error is not None):
raise ValueError("Error: \"{0}\", while setting roku_advertising_id with value: {1}"
.format(error, roku_advertising_id))

self._roku_advertising_id = roku_advertising_id

@property
def roku_publisher_id(self):
return self._roku_publisher_id

@roku_publisher_id.setter
def roku_publisher_id(self, roku_publisher_id):
self._roku_publisher_id = roku_publisher_id

@property
def microsoft_advertising_id(self):
return self._microsoft_advertising_id

@microsoft_advertising_id.setter
def microsoft_advertising_id(self, microsoft_advertising_id):
self._microsoft_advertising_id = microsoft_advertising_id

@property
def microsoft_publisher_id(self):
return self._microsoft_publisher_id

@microsoft_publisher_id.setter
def microsoft_publisher_id(self, microsoft_publisher_id):
self._microsoft_publisher_id = microsoft_publisher_id

@property
def fire_advertising_id(self):
return self._fire_advertising_id

@fire_advertising_id.setter
def fire_advertising_id(self, fire_advertising_id):

error = self.validateUUID(fire_advertising_id)
if (error is not None):
raise ValueError("Error: \"{0}\", while setting fire_advertising_id with value: {1}"
.format(error, fire_advertising_id))

self._fire_advertising_id = fire_advertising_id

@property
def att_timestamp_unixtime_ms(self):
"""
Expand Down
19 changes: 19 additions & 0 deletions test/test_device_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@ def testInvalidAAID(self):
model = mparticle.models.device_information.DeviceInformation()
model.android_advertising_id = "anything"

def testInvalidFireID(self):

with self.assertRaises(ValueError):
model = mparticle.models.device_information.DeviceInformation(fire_advertising_id="anything")

with self.assertRaises(ValueError):
model = mparticle.models.device_information.DeviceInformation()
model.fire_advertising_id = "anything"

def testRokuAdID(self):

with self.assertRaises(ValueError):
model = mparticle.models.device_information.DeviceInformation(roku_advertising_id="anything")

with self.assertRaises(ValueError):
model = mparticle.models.device_information.DeviceInformation()
model.roku_advertising_id = "anything"



if __name__ == '__main__':
unittest.main()

0 comments on commit cd0c601

Please sign in to comment.