Address
- class q2_sdk.hq.db.address.AddressRow[source]
Bases:
RepresentationRowBase
-
AddressID:
IntElement
= 'AddressID'
-
StreetAddress1:
StringElement
= 'StreetAddress1'
-
StreetAddress2:
StringElement
= 'StreetAddress2'
-
City:
StringElement
= 'City'
-
State:
StringElement
= 'State'
-
PostalCode:
StringElement
= 'PostalCode'
-
CustomerID:
IntElement
= 'CustomerID'
-
AddressType:
IntElement
= 'AddressType'
-
UserID:
IntElement
= 'UserID'
-
CountryID:
IntElement
= 'CountryID'
-
IsInternational:
BoolElement
= 'IsInternational'
-
Province:
StringElement
= 'Province'
-
IsoCodeA2:
StringElement
= 'IsoCodeA2'
-
IsoCodeA3:
StringElement
= 'IsoCodeA3'
-
CountryName:
StringElement
= 'CountryName'
-
AddressID:
- class q2_sdk.hq.db.address.Address(logger, hq_credentials=None, ret_table_obj=None)[source]
Bases:
DbObject
Allows for additional address details given an address ID. Usually used in conjunction with a Default Address ID from a User query.
Programmatic access to the Q2 database. Not as flexible as a true ORM, but takes the guesswork out of database schemas and ensures safety in the transactions.
- Parameters:
logger – Reference to calling request’s logger (self.logger in your extension)
hq_credentials (
Optional
[HqCredentials
]) – HQ Connectivity Information (Defaults to settings file)ret_table_obj (
Optional
[bool
]) – Flag to return list of LXML elements ifFalse
or TableRow objects from DB calls ifTrue
(Defaults to settings file)
- REPRESENTATION_ROW_CLASS
alias of
AddressRow
- async get(address_id, serialize_for_cli=False)[source]
- Return type:
list
[AddressRow
]
- async get_by_login(login_name, serialize_for_cli=False)[source]
- Return type:
list
[AddressRow
]
- async create(address_object, user_id=None, customer_id=None)[source]
Creates an address in the database. State should be a two character state code if country is USA, otherwise a province
- async delete(address_id, online_user, online_session, time_occurred=None)[source]
Deletes an address in the Q2_Address table. The User ID is required in the OnlineUser parameter in order to check the default address id on the Q2_User table before deletion. The deletion is audited :type address_id:
int
:param address_id: The id of the address to delete :type online_user:OnlineUser
:param online_user: An OnlineUser object with the user id populated at the minimum :type online_session:OnlineSession
:param online_session: An OnlineSession object used for auditing :type time_occurred:Optional
[str
] :param time_occurred: The ISO format timestamp of the deletion time.