<commit_before>require 'jsonclient'

class Wechat::ShakeAround::BeaconPoiRelation

  extend ::Wechat::ShakeAround::Common

  # 配置设备与门店的关联关系
  # http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html#.E9.85.8D.E7.BD.AE.E8.AE.BE.E5.A4.87.E4.B8.8E.E9.97.A8.E5.BA.97.E7.9A.84.E5.85.B3.E8.81.94.E5.85.B3.E7.B3.BB
  #
  # Return hash format if success:
  # {
  #   data:    {},
  #   errcode: 0,
  #   errmsg:  'success.'
  # }
  #
  # device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }.
  def self.create(access_token, device_id, poi_id)
    device_identifier = self.normalize_device_id device_id
    message = ::JSONClient.new.post "https://api.weixin.qq.com/shakearound/device/bindlocation?access_token=#{access_token}",
      {
        device_identifier: device_identifier,
        poi_id:            poi_id.to_i
      }
    message.body
  end

end
<commit_msg>1, Improve the Beacon PoI Relation wrapper class for the argument validation.<commit_after>require 'jsonclient'

class Wechat::ShakeAround::BeaconPoiRelation

  extend ::Wechat::ShakeAround::Common

  # 配置设备与门店的关联关系
  # http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html#.E9.85.8D.E7.BD.AE.E8.AE.BE.E5.A4.87.E4.B8.8E.E9.97.A8.E5.BA.97.E7.9A.84.E5.85.B3.E8.81.94.E5.85.B3.E7.B3.BB
  #
  # Return hash format if success:
  # {
  #   data:    {},
  #   errcode: 0,
  #   errmsg:  'success.'
  # }
  #
  # device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }.
  def self.create(access_token, device_id, poi_id)

    raise ArgumentError.new('The access_token argument is required.') if access_token.blank?

    device_identifier = self.normalize_device_id device_id
    message = ::JSONClient.new.post "https://api.weixin.qq.com/shakearound/device/bindlocation?access_token=#{access_token}",
      {
        device_identifier: device_identifier,
        poi_id:            poi_id.to_i
      }
    message.body
  end

end

{'fraction_non_alphanumeric': 0.14235234729934376, 'fraction_numerical': 0.06713780918727916, 'mean_word_length': 3.1638655462184873, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2881906', 'n_tokens_mistral': 887, 'n_tokens_neox': 849, 'n_words': 117}