def __init__(self, hv, json): self.billable = json['billable'] self.deactivated = json['deactivated'] self.hourly_rate = json['hourly_rate'] self.id = json['id'] self.task_id = json['task_id'] self.project_id = json['project_id'] self.updated = parse_time(json['updated_at']) self.created = parse_time(json['created_at'])
def __init__(self, hv, json): self.default_billable = json['billable_by_default'] self.deactivated = json['deactivated'] self.default_hourly_rate = json['default_hourly_rate'] self.id = json['id'] self.name = json['name'] self.default = json['is_default'] self.updated = parse_time(json['updated_at']) self.created = parse_time(json['created_at'])
def __init__(self, hv, json): self.id = json['id'] self.hours = float(json['hours']) self.project_id = json['project_id'] self.notes = json['notes'] self.task_id = json['task_id'] self.user_id = json['user_id'] self.billed = json['is_billed'] self.closed = json['is_closed'] self.updated = parse_time(json['updated_at']) self.created = parse_time(json['created_at']) self.spent = parse_short_time(json['spent_at'])
def __init__(self, hv, json): self.hv = hv self.id = json['id'] self.name = json['name'] self.active = json['active'] self.billable = json['billable'] self.bill_by = json['bill_by'] self.hourly_rate = json['hourly_rate'] self.client_id = json['client_id'] self.code = json['code'] self.notes = json['notes'] self.budget_by = json['budget_by'] self.budget = float(json['budget']) if json['budget'] else None self.cost_budget = float(json['cost_budget']) if json['cost_budget'] else None self.latest_record = parse_short_time(json['hint_latest_record_at']) self.earliest_record = parse_short_time(json['hint_earliest_record_at']) self.created = parse_time(json['created_at']) self.updated = parse_time(json['updated_at'])
def __init__(self, hv, json): self.hv = hv self.name = json['name'].encode('utf-8') self.id = json['id'] self.created = parse_time(json['created_at']) self.updated = parse_time(json['updated_at']) self.highrise_id = json['highrise_id'] self.cache_version = json['cache_version'] self.currency = json['currency'] self.currency_symbol = json['currency_symbol'] self.active = json['active'] self.details = json['details'].encode('utf-8') timeframes = json['default_invoice_timeframe'] if timeframes and timeframes != 'Custom': pst = lambda timestr: \ datetime.datetime.strptime(timestr, '%Y%m%d') self.invoice_timeframe = \ map(pst, timeframes.split(',')) else: self.invoice_timeframe = None self.last_invoice_kind = json['last_invoice_kind']
def __parse_json(self, json): self.id = json['id'] self.spent_at = json['spent_at'] self.user_id = json['user_id'] self.client_name = json['client'] # workaround because sometimes this comes back as a string, not an int. self.project_id = int(json['project_id']) self.project_name = json['project'] # workaround because sometimes this comes back as a string, not an int. self.task_id = int(json['task_id']) self.task_name = json['task'] self.hours = json['hours'] # sometimes this is None, set None to empty string. self.notes = json['notes'] or '' self.started = json.has_key('timer_started_at') if self.started: self.timer_started = parse_time(json['timer_started_at']) self.timer_created = parse_time(json['created_at']) self.timer_updated = parse_time(json['updated_at']) else: self.timer_started = None self.timer_created = None self.timer_updated = None