Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

sky-sharma
Copy link
Collaborator

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

sky-sharma and others added 15 commits December 29, 2022 13:19
modified to handle gatewayListOptions following NodeJS SDK
* 1. imports incl. google.api_core.datetime_helpers
2. Added logic to def from_json in class DeviceState and DeviceConfig to
convert times to DateTimeWithNanoseconds and binaryData to bytes if env.
vars set

* 1. Changed Device.from_json to support GCP types
for time, binaryData.
2. Changed DeviceState.from_json to handle blank binaryData
3. Changed DeviceConfig.from_json to handle blank binaryData

* Removed extra 'import base64'

* Added note about types of times, binaryData

* Cleaned up formatting

* Further cleanup

* Added copyright info. at top of files

* Not to 'pip install google-api-core'

* Removed instructions for installing
datetime_helpers module. Also now changed 'google.api_core' to 'proto'

* Added "proto.datetime_helpers" to dependencies

* Changed 'google.api_core' to 'proto.'

* Removed call to set 'convert_binarydata_to_bytes'
in Devices.from_json

* Changed README to reflect decision on ONE env. var

* Changed module to import to proto-plus

* Two env. vars -> BINARYDATA_AND_TIME_GOOGLE_FORMAT

* Removed a '.'

* Format improvements for README

* Added note about new env. var in 'Quick Start' sec
* 'config', 'state' None? (i.e. not in fieldMask?)

* Added new @Property's to address DESK-2174
* Made PublicKeyFormat a child class of Enum

* 1. import PublicKeyFormat from .resources
2. New dodict class for providing dot notation for dicts when read.
3. Call to dodict in credentials getter.
4. New functions for converting PublicKeyFormat to/from string.
5. Calls to PublicKeyFormat conversion functions.

* Added note about how to run from source

* Formatting

* More formatting

* Formatting

* Formatting

* Clearer info. on running from source

* 1. Import PublicKeyCredential & DeviceCredential
2. Remove dotdict class.
3. Remove convertCredentialsFormatToString.
4. Set self._credentials=convertCredentialsFormatsToString(credentials)
5. Simplified Device class' credentials getter.
6. Changed Device class attr from 'credentials' to '_credentials'

* Added code to _create_device_body to:
1. Convert DeviceCredential and PublicKeyCredential objects to dicts
2. Convert PublicKeyFormat class to string
This is prior to creating device in registry.

* Add PublicKeyCredential & DeviceCredential classes

* Changed PublicKeyCredential constructor params:
publicKeyFormat -> format
publicKey -> key

* 1. bug: DeviceCredential constructor calls
PublicKeyCredential constructor where params were reversed.
2. Added classmethod convert_credentials_for_create_update.

* 1. Removed unnecessary var from
convertCredentialsFormatToString.
2. Calling convert_credentials_for_create_update
in _prepare_params_body_for_update fcn

* 1. Import DeviceCredential
2. Remove code for converting credentials from _create_device_body and
call DeviceCredential.convert_credentials_for_create_update instead

* 1. Removed the config and state conversion code
from class Device.
2. In Device.from_json returned config as DeviceConfig.from_json() and
state as DeviceState.from_json()
3. In DeviceState replace attr. self._update_time w/ self.updateTime and
self._binary_data w/ self.binaryData
4. Added __getitem__ and get functions.

* In classes PublicKeyCredential & DeviceCredential
added function "get" which does the same thing as __getitem__

* Document changes from last version in UPGRADING.md

* Turned ClearBlade and Google License info. into comments

* Formatting changes

* In 'convert_credentials_for_create_update' check
for expirationTime. If it is datetime convert to ISO string

* Formatting

* Formatting

* Formatting

* Formatting

* Formatting

* Prefixed license info.

* bug: if expirationTime type 'datetime', isoformat
won't work: 'Z' suffix is left off and is needed by CB platform.
Resolved by replacing isoformat with strftime.
found during merging (and because expirationTime is now validated):
DeviceCredential constructor was being called with credential rather
than credential['publicKey'] and credential['expirationTime']. Fixed
* bug: def get_value; if json_data None throws err

* In def convertCredentials... added check for None
Added name attribute to Device class.
@sky-sharma sky-sharma merged commit 08f89f1 into main Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants