/*
*
* Copyright 2014 Citrus Payment Solutions Pvt. Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* /
*/
package com.citrus.sdk.classes;
import com.google.gson.Gson;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by MANGESH KADAM on 5/11/2015.
*/
public class AccessToken {
@SerializedName("access_token")
@Expose
private String accessToken;
@SerializedName("token_type")
@Expose
private String tokenType;
@SerializedName("expires_in")
@Expose
private int expiresIn;
@Expose
private String scope;
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
@SerializedName("refresh_token")
private String refreshToken;
/**
*
* @return
* The accessToken
*/
public String getAccessToken() {
return accessToken;
}
public String getHeaderAccessToken() {
return "Bearer " + accessToken;
}
/**
*
* @param accessToken
* The access_token
*/
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
/**
*
* @return
* The tokenType
*/
public String getTokenType() {
return tokenType;
}
/**
*
* @param tokenType
* The token_type
*/
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
/**
*
* @return
* The expiresIn
*/
public int getExpiresIn() {
return expiresIn;
}
/**
*
* @param expiresIn
* The expires_in
*/
public void setExpiresIn(int expiresIn) {
this.expiresIn = expiresIn;
}
/**
*
* @return
* The scope
*/
public String getScope() {
return scope;
}
/**
*
* @param scope
* The scope
*/
public void setScope(String scope) {
this.scope = scope;
}
public JSONObject getJSON() {
final Gson gson = new Gson();
String json = gson.toJson(this);
try {
return new JSONObject(json);
} catch (JSONException e) {
return null;
}
}
}