wechat_public_api 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86044f37fa4700c008ef478330acaae14c42a5af
4
- data.tar.gz: 569ece2dd447d793239d2d414cb9feac28c4fdcc
3
+ metadata.gz: b5041f661bea1b425bc2ee410608b57ab0189291
4
+ data.tar.gz: eca2b80d1cdfa8f1ec5ea3773e1c33045d1391d4
5
5
  SHA512:
6
- metadata.gz: dcd7a2071e9c94ddecfe56bddc73c1fb42648812ffd79e7a13a2e088b097dc76d9cf8ccbbccc9fb675adbf1748dc3996770ea401f0a443a3cc3600b81b7373e0
7
- data.tar.gz: d6145add1bc8f2102fe0ef49ed3d15a300a88faa0b95c8cc0657900daf6fb8cd27a377b4d673648ca2b0b9927faec56eae01a43c071ac69dd75e9915ce2adbc5
6
+ metadata.gz: da34aa6178a8f923ea16cb955e25bf29ec0563c1ba4e1e32abe30c2da61c082f53a5444aa4d835f7431af17101fc689fe455fe48edc8538d30ebcc94fc70cd26
7
+ data.tar.gz: 6834a328295225f88cb6e9103a6e6fde9fb49f589d5e8fc5a208205a96d7ffb1aef618a6a95d4c98826a004a4c4d926df98d7613bfc117d5dc64a476e6e3343b
@@ -45,13 +45,13 @@ class WechatPublicApi
45
45
  def kf_text_message(openid, content, kf_account=nil)
46
46
 
47
47
  custom_message = {
48
- touser: openid,
49
- msgtype: 'text',
50
- text: {content: content}
48
+ :touser => openid,
49
+ :msgtype => 'text',
50
+ :text => {:content => content}
51
51
  }
52
52
 
53
53
  if kf_account
54
- custom_message.merge({customservice:{account: kf_account}})
54
+ custom_message.merge({:customservice => {:account => kf_account}})
55
55
  end
56
56
 
57
57
  post_customer_message custom_message
@@ -64,13 +64,13 @@ class WechatPublicApi
64
64
  def kf_image_message(openid, media_id, kf_account=nil)
65
65
 
66
66
  custom_message = {
67
- touser: openid,
68
- msgtype: 'image',
69
- image: {media_id: media_id}
67
+ :touser => openid,
68
+ :msgtype => 'image',
69
+ :image => {:media_id => media_id}
70
70
  }
71
71
 
72
72
  if kf_account
73
- custom_message.merge({customservice:{account: kf_account}})
73
+ custom_message.merge({:customservice => {:account => kf_account}})
74
74
  end
75
75
 
76
76
  post_customer_message custom_message
@@ -79,12 +79,12 @@ class WechatPublicApi
79
79
  # 发送图文消息(点击跳转到图文消息页面)
80
80
  def kf_mpnews_message(openid, media_id, kf_account=nil)
81
81
  custom_message = {
82
- touser: openid,
83
- msgtype: 'mpnews',
84
- mpnews: {media_id: media_id}
82
+ :touser => openid,
83
+ :msgtype => 'mpnews',
84
+ :mpnews => {:media_id => media_id}
85
85
  }
86
86
  if kf_account
87
- custom_message.merge({customservice:{account: kf_account}})
87
+ custom_message.merge({:customservice => {:account => kf_account}})
88
88
  end
89
89
 
90
90
  post_customer_message custom_message
@@ -111,15 +111,15 @@ class WechatPublicApi
111
111
  # 发送图文消息(点击跳转到外链)
112
112
  def kf_news_message(openid, articles, kf_account=nil)
113
113
  custom_message = {
114
- touser: openid,
115
- msgtype: 'news',
116
- news: {
117
- articles: articles
114
+ :touser => openid,
115
+ :msgtype => 'news',
116
+ :news => {
117
+ :articles => articles
118
118
  }
119
119
  }
120
120
 
121
121
  if kf_account
122
- custom_message.merge({customservice:{account: kf_account}})
122
+ custom_message.merge({:customservice => {:account => kf_account}})
123
123
  end
124
124
  post_customer_message custom_message
125
125
  end
@@ -128,14 +128,14 @@ class WechatPublicApi
128
128
  def kf_voice_message(openid, media_id, kf_account=nil)
129
129
 
130
130
  custom_message = {
131
- touser: openid,
132
- msgtype: 'voice',
133
- voice: {
134
- media_id: media_id
131
+ :touser => openid,
132
+ :msgtype => 'voice',
133
+ :voice => {
134
+ :media_id => media_id
135
135
  }
136
136
  }
137
137
  if kf_account
138
- custom_message.merge({customservice:{account: kf_account}})
138
+ custom_message.merge({:customservice => {:account => kf_account}})
139
139
  end
140
140
  post_customer_message custom_message
141
141
  end
@@ -60,14 +60,14 @@ class WechatPublicApi
60
60
  # 小程序模板消息
61
61
  def tp_miniprogram_message(openid, templet_id, url, appid, pagepath, data)
62
62
  message = {
63
- 'touser': openid,
64
- 'template_id': templet_id,
65
- 'url': url,
66
- "miniprogram":{
67
- "appid": appid,
68
- "pagepath": pagepath
63
+ :touser => openid,
64
+ :template_id => templet_id,
65
+ :url => url,
66
+ :miniprogram =>{
67
+ :appid => appid,
68
+ :pagepath => pagepath
69
69
  },
70
- 'data': data
70
+ :data => data
71
71
  }
72
72
 
73
73
  post_template_message message, 'send'
@@ -76,10 +76,10 @@ class WechatPublicApi
76
76
  # 普通的模板消息,不跳转小程序
77
77
  def tp_general_message(openid, templet_id, url, data)
78
78
  message = {
79
- 'touser': openid,
80
- 'template_id': templet_id,
81
- 'url': url,
82
- 'data': data
79
+ :touser => openid,
80
+ :template_id => templet_id,
81
+ :url => url,
82
+ :data => data
83
83
  }
84
84
  post_template_message message, 'send'
85
85
  end
@@ -87,7 +87,7 @@ class WechatPublicApi
87
87
  # 删除模板
88
88
  def tp_delete_template(templet_id)
89
89
  message = {
90
- 'template_id': template_id
90
+ :template_id => template_id
91
91
  }
92
92
  post_template_message message, 'del_private_template'
93
93
  end
@@ -1,3 +1,3 @@
1
1
  class WechatPublicApi
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wechat_public_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - '张明鑫 wechat number: zmx119966'