Sha256: f8eed0ba744cc68525f74edcf71d6140005577560baa8783f5c7aba85c477210

Contents?: true

Size: 973 Bytes

Versions: 1

Compression:

Stored size: 973 Bytes

Contents

##
# 微信摇一摇周边的摇动封装类。

class Wechat::ShakeAround::Shaking

  extend Wechat::Core::Common
  extend Wechat::ShakeAround::Common

  # 获取摇周边的设备及用户信息
  # http://mp.weixin.qq.com/wiki/3/34904a5db3d0ec7bb5306335b8da1faf.html
  #
  # Return hash format if success:
  # {
  #   data:
  #   {
  #     page_id: <PAGE_ID>,
  #     openid:  <OPEN_ID>,
  #     poi_id:  <POI_ID>,
  #     beacon_info:
  #     {
  #       distance: <DISTANCE>,
  #       uuid:     <UUID>,
  #       major:    <MAJOR>,
  #       minor:    <MINOR>
  #     }
  #   },
  #   errcode: 0,
  #   errmsg:  'success.'
  # }
  def self.load(access_token, ticket)

    assert_present! :access_token, access_token
    assert_present! :ticket,       ticket

    message = post_json "https://api.weixin.qq.com/shakearound/user/getshakeinfo?access_token=#{access_token}", body:
      {
        ticket:   ticket,
        need_poi: 1
      }
    message.body
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wechat-shake_around-0.9.1 lib/wechat/shake_around/shaking.rb