Module: JPush::Report
Constant Summary collapse
- TIME_UNIT =
['HOUR', 'DAY', 'MONTH']
- TIME_FORMAT =
{ hour: '%F %H', day: '%F', month: '%Y-%m' }
- MAX_DURATION =
{ hour: 24, day: 60, month: 2 }
Constants included from Helper::ArgumentHelper
Helper::ArgumentHelper::MAX_ALIAS_ARRAY_SIZE, Helper::ArgumentHelper::MAX_MSG_IDS_ARRAY_SIZE, Helper::ArgumentHelper::MAX_REGISTRATION_ID_ARRAY_SIZE, Helper::ArgumentHelper::MAX_TAG_ARRAY_MAX_BYTESIZE, Helper::ArgumentHelper::MAX_TAG_ARRAY_SZIE
Constants included from Helper::Argument
Helper::Argument::MAX_ALIAS_BYTESIZE, Helper::Argument::MAX_TAG_BYTESIZE, Helper::Argument::MOBILE_RE
Instance Method Summary collapse
-
#messages(msg_ids) ⇒ Object
GET /v3/messages 消息统计.
-
#received(msg_ids) ⇒ Object
GET /v3/received 送达统计.
-
#users(time_unit, start, duration) ⇒ Object
GET /v3/users 用户统计.
Methods included from Helper::ArgumentHelper
build_alias, build_extras, build_msg_ids, build_platform, build_registration_ids, build_tags, extended
Methods included from Helper::Argument
#check_alias, #check_mobile, #check_platform, #check_registration_id, #check_tag, #ensure_argument_not_blank, #ensure_argument_required, #ensure_not_over_bytesize, #ensure_not_over_size, #ensure_word_valid
Instance Method Details
#messages(msg_ids) ⇒ Object
GET /v3/messages 消息统计
26 27 28 29 30 31 32 33 |
# File 'lib/jpush/report.rb', line 26 def (msg_ids) msg_ids = build_msg_ids(msg_ids) url = base_url + '/messages' params = { msg_ids: msg_ids.join(',') } Http::Client.get(url, params: params) end |
#received(msg_ids) ⇒ Object
GET /v3/received 送达统计
15 16 17 18 19 20 21 22 |
# File 'lib/jpush/report.rb', line 15 def received(msg_ids) msg_ids = build_msg_ids(msg_ids) url = base_url + '/received' params = { msg_ids: msg_ids.join(',') } Http::Client.get(url, params: params) end |
#users(time_unit, start, duration) ⇒ Object
GET /v3/users 用户统计
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/jpush/report.rb', line 37 def users(time_unit, start, duration) raise Utils::Exceptions::InvalidElementError.new('time unit', time_unit, TIME_UNIT) unless TIME_UNIT.include?(time_unit.upcase) start = start.strftime(TIME_FORMAT[time_unit.downcase.to_sym]) duration = build_duration(time_unit.downcase.to_sym, duration) params = { time_unit: time_unit.upcase, start: start, duration: duration } url = base_url + '/users' Http::Client.get(url, params: params) end |