aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/main/java/org/wordpress/android/ui/stats/models/InsightsAllTimeModel.java
blob: fd0b02e7b0467ec2c9bab9c681e0292d0c163bb0 (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
package org.wordpress.android.ui.stats.models;

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

public class InsightsAllTimeModel extends BaseStatsModel {

    private String mBlogID;
    private String mDate;
    private int mVisitors;
    private int mViews;
    private int mPosts;
    private String mViewsBestDay;
    private int mViewsBestDayTotal;


    public InsightsAllTimeModel(String blogID, JSONObject response) throws JSONException {
        this.setBlogID(blogID);
        this.mDate = response.getString("date");
        JSONObject stats = response.getJSONObject("stats");
        this.mPosts = stats.optInt("posts");
        this.mVisitors = stats.optInt("visitors");
        this.mViews = stats.optInt("views");
        this.mViewsBestDay = stats.getString("views_best_day");
        this.mViewsBestDayTotal = stats.optInt("views_best_day_total");
    }

    public String getBlogID() {
        return mBlogID;
    }

    private void setBlogID(String blogID) {
        this.mBlogID = blogID;
    }

    public String getDate() {
        return mDate;
    }

    public void setDate(String date) {
        this.mDate = date;
    }

    public int getVisitors() {
        return mVisitors;
    }

    public int getViews() {
        return mViews;
    }

    public int getPosts() {
        return mPosts;
    }

    public String getViewsBestDay() {
        return mViewsBestDay;
    }

    public int getViewsBestDayTotal() {
        return mViewsBestDayTotal;
    }
}