/* Swisscom Safe Connect Copyright (C) 2014 Swisscom This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.swisscom.safeconnect.model; import org.json.JSONObject; import java.io.Serializable; /** * Created by cianci on 9/22/14. */ public class PlumberLastConnectionLogResponse extends PlumberResponse implements Serializable { private double latitude; private double longitude; private String countryCode; private String city; private long timestamp; public PlumberLastConnectionLogResponse() { fromJson((JSONObject) null); } public PlumberLastConnectionLogResponse(JSONObject json) { super(json); } public PlumberLastConnectionLogResponse(String json) { super(json); } protected void fromJson(JSONObject json) { if (json == null) { return; } latitude = json.optDouble("latitude"); longitude = json.optDouble("longitude"); countryCode = json.optString("country_code"); city = json.optString("city"); timestamp = json.optLong("time"); } public double getLatitude() { return latitude; } public double getLongitude() { return longitude; } public String getCountryCode() { return countryCode; } public String getCity() { return city; } public long getTimestamp() { return timestamp; } @Override public String toString() { return "PlumberLastConnectionLogResponse{" + ", latitude=" + latitude + ", longitude=" + longitude + ", countryCode='" + countryCode + '\'' + ", city='" + city +'\'' + ", timestamp=" + timestamp + '}'; } }