def __init__(self, version, payload, account_sid): """ Initialize the DailyInstance :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance """ super(DailyInstance, self).__init__(version) # Marshaled Properties self._properties = { 'account_sid': payload.get('account_sid'), 'api_version': payload.get('api_version'), 'as_of': payload.get('as_of'), 'category': payload.get('category'), 'count': payload.get('count'), 'count_unit': payload.get('count_unit'), 'description': payload.get('description'), 'end_date': deserialize.iso8601_date(payload.get('end_date')), 'price': deserialize.decimal(payload.get('price')), 'price_unit': payload.get('price_unit'), 'start_date': deserialize.iso8601_date(payload.get('start_date')), 'subresource_uris': payload.get('subresource_uris'), 'uri': payload.get('uri'), 'usage': payload.get('usage'), 'usage_unit': payload.get('usage_unit'), } # Context self._context = None self._solution = { 'account_sid': account_sid, }
def __init__(self, version, payload, account_sid): """ Initialize the YesterdayInstance :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance """ super(YesterdayInstance, self).__init__(version) # Marshaled Properties self._properties = { 'account_sid': payload['account_sid'], 'api_version': payload['api_version'], 'category': payload['category'], 'count': payload['count'], 'count_unit': payload['count_unit'], 'description': payload['description'], 'end_date': deserialize.iso8601_date(payload['end_date']), 'price': deserialize.decimal(payload['price']), 'price_unit': payload['price_unit'], 'start_date': deserialize.iso8601_date(payload['start_date']), 'subresource_uris': payload['subresource_uris'], 'uri': payload['uri'], 'usage': payload['usage'], 'usage_unit': payload['usage_unit'], } # Context self._context = None self._solution = { 'account_sid': account_sid, }
def __init__(self, version, payload, account_sid): """ Initialize the AllTimeInstance :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance """ super(AllTimeInstance, self).__init__(version) # Marshaled Properties self._properties = { 'account_sid': payload['account_sid'], 'api_version': payload['api_version'], 'category': payload['category'], 'count': payload['count'], 'count_unit': payload['count_unit'], 'description': payload['description'], 'end_date': deserialize.iso8601_date(payload['end_date']), 'price': deserialize.decimal(payload['price']), 'price_unit': payload['price_unit'], 'start_date': deserialize.iso8601_date(payload['start_date']), 'subresource_uris': payload['subresource_uris'], 'uri': payload['uri'], 'usage': payload['usage'], 'usage_unit': payload['usage_unit'], } # Context self._context = None self._solution = {'account_sid': account_sid, }
def __init__(self, version, payload, account_sid, sid=None): """ Initialize the FeedbackSummaryInstance :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance """ super(FeedbackSummaryInstance, self).__init__(version) # Marshaled Properties self._properties = { 'account_sid': payload.get('account_sid'), 'call_count': deserialize.integer(payload.get('call_count')), 'call_feedback_count': deserialize.integer(payload.get('call_feedback_count')), 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), 'end_date': deserialize.iso8601_date(payload.get('end_date')), 'include_subaccounts': payload.get('include_subaccounts'), 'issues': payload.get('issues'), 'quality_score_average': deserialize.decimal(payload.get('quality_score_average')), 'quality_score_median': deserialize.decimal(payload.get('quality_score_median')), 'quality_score_standard_deviation': deserialize.decimal( payload.get('quality_score_standard_deviation')), 'sid': payload.get('sid'), 'start_date': deserialize.iso8601_date(payload.get('start_date')), 'status': payload.get('status'), } # Context self._context = None self._solution = { 'account_sid': account_sid, 'sid': sid or self._properties['sid'], }
def __init__(self, version, payload, date=None, sid=None): """ Initialize the ArchivedCallInstance :returns: twilio.rest.voice.v1.archived_call.ArchivedCallInstance :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallInstance """ super(ArchivedCallInstance, self).__init__(version) # Marshaled Properties self._properties = { 'date': deserialize.iso8601_date(payload.get('date')), 'sid': payload.get('sid'), 'url': payload.get('url'), } # Context self._context = None self._solution = { 'date': date or self._properties['date'], 'sid': sid or self._properties['sid'], }
def test_not_parsable(self): actual = deserialize.iso8601_date('not-a-date') self.assertEqual('not-a-date', actual)
def test_parsable(self): actual = deserialize.iso8601_date('2015-01-02') expected = datetime.date(2015, 1, 2) self.assertEqual(expected, actual)