FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add integration attributes to sdk by v-mamaya · Pull Request #26 · mParticle/mparticle-python-sdk · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .md  (1) .py  (4) All 2 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions docs/Batch.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
| **deleted_user_attributes** | **list[str]** | | [optional] |
| **user_identities** | [**UserIdentities**](UserIdentities.md) | | [optional] |
| **consentState** | [**ConsentState**](ConsentState.md) | | [optional] |
| **integration_attributes** | **dict(str, dict(str, str))** | | [optional] |
| **mpid** | **int** | | [optional] |
| **mp_deviceid** | **str** | | [optional] |

Expand Down
6 changes: 6 additions & 0 deletions example_usage.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@

batch.consent_state = consent_state

batch.integration_attributes = {
"123": {
"someIntegrationAttribute": "value"
}
}

app_event = mparticle.AppEvent('Example', 'navigation')
app_event.timestamp_unixtime_ms = 1552596256103
app_event.custom_flags = {
Expand Down
26 changes: 25 additions & 1 deletion mparticle/models/batch.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

class Batch(object):

def __init__(self, events=None, source_request_id=None, environment=None, ip=None, schema_version=None, device_info=None, application_info=None, user_attributes=None, deleted_user_attributes=None, user_identities=None, api_key=None, mpid=None, mp_deviceid=None, consent_state=None, context=None):
def __init__(self, events=None, source_request_id=None, environment=None, ip=None, schema_version=None, device_info=None, application_info=None, user_attributes=None, deleted_user_attributes=None, user_identities=None, api_key=None, mpid=None, mp_deviceid=None, consent_state=None, context=None, integration_attributes=None):
"""
Batch - a model defined in Swagger

Expand All @@ -84,6 +84,7 @@ def __init__(self, events=None, source_request_id=None, environment=None, ip=Non
'deleted_user_attributes': 'list[str]',
'user_identities': 'UserIdentities',
'consent_state': 'ConsentState',
'integration_attributes': 'dict(str, dict(str, str))',
'api_key': 'str',
'mpid': 'int',
'mp_deviceid': 'str',
Expand All @@ -102,6 +103,7 @@ def __init__(self, events=None, source_request_id=None, environment=None, ip=Non
'deleted_user_attributes': 'deleted_user_attributes',
'user_identities': 'user_identities',
'consent_state': 'consent_state',
'integration_attributes': 'integration_attributes',
'api_key': 'api_key',
'mpid': 'mpid',
'mp_deviceid': 'mp_deviceid',
Expand All @@ -118,6 +120,7 @@ def __init__(self, events=None, source_request_id=None, environment=None, ip=Non
self._application_info = application_info
self._user_attributes = user_attributes
self._consent_state = consent_state
self._integration_attributes = integration_attributes
self._deleted_user_attributes = deleted_user_attributes
self._user_identities = user_identities
self._mpid = mpid
Expand Down Expand Up @@ -486,6 +489,27 @@ def consent_state(self, consent_state):

self._consent_state = consent_state

@property
def integration_attributes(self):
"""Gets the integration_attributes of this Batch.


:return: The integration_attributes of this Batch.
:rtype: dict(str, dict(str, str))
"""
return self._integration_attributes

@integration_attributes.setter
def integration_attributes(self, integration_attributes):
"""Sets the integration_attributes of this Batch.


:param integration_attributes: The integration_attributes of this Batch.
:type: dict(str, dict(str, str))
"""

self._integration_attributes = integration_attributes

@property
def context(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import setup, find_packages

NAME = "mparticle"
VERSION = "0.16.0"
VERSION = "0.16.1"


# To install the library, run the following
Expand Down
14 changes: 14 additions & 0 deletions test/test_batch.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,19 @@ def testBatchWithContext(self):
self.assertEqual("foo", batch_dict["context"]["data_plan"]["plan_id"])
self.assertEqual(5, batch_dict["context"]["data_plan"]["plan_version"])

def testBatchIntegrationAttributes(self):
"""
Test Batch Integration Attributes
"""
model = mparticle.models.batch.Batch()

batch_dict = model.to_dict()
for key in batch_dict:
self.assertEqual(None, batch_dict[key])

model.integration_attributes = { "123": { "someIntegrationAttribute": "value" } }
batch_dict = model.to_dict()
self.assertEqual({ "123": { "someIntegrationAttribute":"value" } }, batch_dict["integration_attributes"])

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

Back | FazBrowse Home | New Git URL