Class: Wechat::ShakeAround::Apply
- Inherits:
-
Object
- Object
- Wechat::ShakeAround::Apply
- Extended by:
- Core::Common, Common
- Defined in:
- lib/wechat/shake_around/apply.rb
Overview
Apply 是批量申请 iBeacon 设备 UUID 、 Major 和 Minor 的封装类。
Constant Summary
Constants included from Common
Class Method Summary collapse
- .create(access_token, quantity, reason, comment: nil, poi_id: nil) ⇒ Object
- .load(access_token, apply_id) ⇒ Object
Methods included from Common
normalize_date, normalize_device_id, normalize_page_ids
Class Method Details
.create(access_token, quantity, reason, comment: nil, poi_id: nil) ⇒ Object
Return hash format if success: {
data:
{
apply_id: <APPLY_ID>, // 申请的批次ID,可用在“查询设备列表”接口按批次查询本次申请成功的设备ID。
audit_status: <AUDIT_STATUS>, // 审核状态。0:审核未通过、1:审核中、2:审核已通过;若单次申请的设备ID数量小于等于500个,系统会进行快速审核;若单次申请的设备ID数量大于500个,会在三个工作日内完成审核;此时返回值全部为1(审核中)
audit_comment: <AUDIT_COMMENT> // 审核备注,对审核状态的文字说明
},
errcode: 0,
errmsg: 'success.'
}
quantity: 申请的设备ID的数量,单次新增设备超过500个,需走人工审核流程。 reason: 申请理由,不超过100个汉字或200个英文字母。 comment: 备注,不超过15个汉字或30个英文字母。
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/wechat/shake_around/apply.rb', line 51 def self.create(access_token, quantity, reason, comment: nil, poi_id: nil) assert_present! :access_token, access_token assert_present! :quantity, quantity assert_present! :reason, reason = { quantity: quantity, apply_reason: reason } [:comment] = comment if comment.present? [:poi_id] = poi_id if poi_id.present? post_json "https://api.weixin.qq.com/shakearound/device/applyid?access_token=#{access_token}", body: end |
.load(access_token, apply_id) ⇒ Object
Return hash format if success: {
data:
{
apply_time: <APPLY_TIME>, // 提交申请的时间戳
audit_comment: <AUDIT_COMMENT>, // 审核备注,对审核状态的文字说明
audit_status: <AUDIT_STATUS>, // 审核状态。0:审核未通过、1:审核中、2:审核已通过;若单次申请的设备ID数量小于等于500个,系统会进行快速审核;若单次申请的设备ID数量大于500个,会在三个工作日内完成审核。
audit_time: <AUDIT_TIME>, // 确定审核结果的时间戳,若状态为审核中,则该时间值为0
},
errcode: 0,
errmsg: 'success.'
}
25 26 27 28 29 30 |
# File 'lib/wechat/shake_around/apply.rb', line 25 def self.load(access_token, apply_id) assert_present! :access_token, access_token assert_present! :apply_id, apply_id post_json "https://api.weixin.qq.com/shakearound/device/applystatus?access_token=#{access_token}", body: { apply_id: apply_id.to_i } end |