@@ -83,8 +83,7 @@ def load(self, entries):
83
83
def uri (self ):
84
84
return self .__dict__ .get ('uri' )
85
85
86
-
87
- class UsageRecords (ListResource ):
86
+ class BaseUsageRecords (ListResource ):
88
87
name = "Usage/Records"
89
88
instance = UsageRecord
90
89
key = "usage_records"
@@ -113,31 +112,43 @@ def load_instance(self, data):
113
112
return instance
114
113
115
114
116
- class UsageRecordsDaily (UsageRecords ):
115
+ class UsageRecords (BaseUsageRecords ):
116
+ def __init__ (self , base_uri , auth ):
117
+ super (UsageRecords , self ).__init__ (base_uri , auth )
118
+ self .daily = UsageRecordsDaily (base_uri , auth )
119
+ self .monthly = UsageRecordsMonthly (base_uri , auth )
120
+ self .yearly = UsageRecordsYearly (base_uri , auth )
121
+ self .today = UsageRecordsToday (base_uri , auth )
122
+ self .yesterday = UsageRecordsYesterday (base_uri , auth )
123
+ self .this_month = UsageRecordsThisMonth (base_uri , auth )
124
+ self .last_month = UsageRecordsLastMonth (base_uri , auth )
125
+
126
+
127
+ class UsageRecordsDaily (BaseUsageRecords ):
117
128
name = "Usage/Records/Daily"
118
129
119
130
120
- class UsageRecordsMonthly (UsageRecords ):
131
+ class UsageRecordsMonthly (BaseUsageRecords ):
121
132
name = "Usage/Records/Monthly"
122
133
123
134
124
- class UsageRecordsYearly (UsageRecords ):
135
+ class UsageRecordsYearly (BaseUsageRecords ):
125
136
name = "Usage/Records/Yearly"
126
137
127
138
128
- class UsageRecordsToday (UsageRecords ):
139
+ class UsageRecordsToday (BaseUsageRecords ):
129
140
name = "Usage/Records/Today"
130
141
131
142
132
- class UsageRecordsYesterday (UsageRecords ):
143
+ class UsageRecordsYesterday (BaseUsageRecords ):
133
144
name = "Usage/Records/Yesterday"
134
145
135
146
136
- class UsageRecordsThisMonth (UsageRecords ):
147
+ class UsageRecordsThisMonth (BaseUsageRecords ):
137
148
name = "Usage/Records/ThisMonth"
138
149
139
150
140
- class UsageRecordsLastMonth (UsageRecords ):
151
+ class UsageRecordsLastMonth (BaseUsageRecords ):
141
152
name = "Usage/Records/LastMonth"
142
153
143
154
UsageRecord .subresources = [
@@ -150,22 +161,11 @@ class UsageRecordsLastMonth(UsageRecords):
150
161
UsageRecordsLastMonth
151
162
]
152
163
153
- class Records (object ):
154
- def __init__ (self , base_uri , auth ):
155
- self .all = UsageRecords (base_uri , auth )
156
- self .daily = UsageRecordsDaily (base_uri , auth )
157
- self .monthly = UsageRecordsMonthly (base_uri , auth )
158
- self .yearly = UsageRecordsYearly (base_uri , auth )
159
- self .today = UsageRecordsToday (base_uri , auth )
160
- self .yesterday = UsageRecordsYesterday (base_uri , auth )
161
- self .this_month = UsageRecordsThisMonth (base_uri , auth )
162
- self .last_month = UsageRecordsLastMonth (base_uri , auth )
163
-
164
164
class Usage (object ):
165
165
"""
166
166
Holds all the specific Usage list resources
167
167
"""
168
168
169
169
def __init__ (self , base_uri , auth ):
170
- self .records = Records (base_uri , auth )
170
+ self .records = UsageRecords (base_uri , auth )
171
171
self .triggers = UsageTriggers (base_uri , auth )
0 commit comments