Class: Wechat::ShakeAround::DeviceDailyReport
- Inherits:
-
Object
- Object
- Wechat::ShakeAround::DeviceDailyReport
- Extended by:
- Core::Common, Common
- Defined in:
- lib/wechat/shake_around/device_daily_report.rb
Overview
Device Daily Report 是 iBeacon 设备每日统计报表的封装类。
Constant Summary
Constants included from Common
Class Method Summary collapse
Methods included from Common
normalize_date, normalize_device_id, normalize_page_ids
Class Method Details
.index(access_token, device_id, date_range) ⇒ Object
Return hash format if success: {
data:
[
{
click_pv: <CLICK_PAGE_VIEW>,
click_uv: <CLICK_USER_VIEW>,
ftime: <DATE>, // 当天0点对应的时间戳
shake_pv: <SHAKE_PAGE_VIEW>,
shake_uv: <SHAKE_USER_VIEW>
},
...
],
errcode: 0,
errmsg: 'success.'
}
device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }. date_range is a string range like ‘yyyy-mm-dd’..‘yyyy-mm-dd’.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/wechat/shake_around/device_daily_report.rb', line 32 def self.index(access_token, device_id, date_range) assert_present! :access_token, access_token assert_present! :device_id, device_id assert_present! :date_range, date_range device_identifier = normalize_device_id device_id post_json "https://api.weixin.qq.com/shakearound/statistics/device?access_token=#{access_token}", body: { device_identifier: device_identifier, begin_date: normalize_date(date_range.min), end_date: normalize_date(date_range.max) } end |