1 package pl
.smsapi
.api
.response
;
3 import java
.util
.ArrayList
;
4 import org
.json
.JSONArray
;
5 import org
.json
.JSONObject
;
7 public class UsersResponse
implements Response
{
9 private ArrayList
<UserResponse
> list
= new ArrayList
<UserResponse
>();
11 public UsersResponse(String data
) {
13 if (data
!= null && !data
.isEmpty()) {
15 JSONArray aData
= new JSONArray(data
);
16 final int n
= aData
.length();
18 for (int i
= 0; i
< n
; i
++) {
19 JSONObject tmp
= aData
.getJSONObject(i
);
20 list
.add(new UserResponse(tmp
.optString("username"), tmp
.optDouble("limit"), tmp
.optDouble("month_limit"), tmp
.optInt("senders"), tmp
.optInt("phonebook"), tmp
.optInt("active"), tmp
.optString("info")));
27 public ArrayList
<UserResponse
> getList() {