aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/main/java/org/wordpress/android/ui/stats/models/FollowDataModel.java
blob: 2c8acb829eef9a6bcd785730bb5e4f74cf3d132d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package org.wordpress.android.ui.stats.models;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;

public class FollowDataModel implements Serializable {

       /*
     "following-text": "Following",
      "is_following": false,
      "following-hover-text": "Unfollow",
      "blog_id": 6098762,
      "blog_url": "http://ilpostodellefragole.wordpress.com",
      "blog_title": "Il posto delle fragole",
      "site_id": 6098762,
      "stat-source": "stats_comments",
      "follow-text": "Follow",
      "blog_domain": "ilpostodellefragole.wordpress.com"
     */

    private String type;
    private String followText;
    private String followingText;
    private String followingHoverText;
    private boolean isFollowing;
    private int blogID;
    private int siteID;
    private String statsSource;
    private String blogDomain;

    public transient boolean isRestCallInProgress = false;

    public FollowDataModel(JSONObject followDataJSON) throws JSONException {
        this.type = followDataJSON.getString("type");
        JSONObject paramsJSON = followDataJSON.getJSONObject("params");
        this.followText = paramsJSON.getString("follow-text");
        this.followingText = paramsJSON.getString("following-text");
        this.followingHoverText = paramsJSON.getString("following-hover-text");
        this.isFollowing = paramsJSON.getBoolean("is_following");
        this.blogID = paramsJSON.getInt("blog_id");
        this.siteID = paramsJSON.getInt("site_id");
        this.statsSource = paramsJSON.getString("stat-source");
        this.blogDomain = paramsJSON.getString("blog_domain");
    }

    public boolean isFollowing() {
        return isFollowing;
    }

    public void setIsFollowing(boolean following) {
        isFollowing = following;
    }

    public int getBlogID() {
        return blogID;
    }

    public int getSiteID() {
        return siteID;
    }

    public String getFollowText() {
        return followText;
    }

    public String getFollowingHoverText() {
        return followingHoverText;
    }

    public String getFollowingText() {
        return followingText;
    }

    public String getType() {
        return type;
    }

    public String getStatsSource() {
        return statsSource;
    }

    public String getBlogDomain() {
        return blogDomain;
    }
}