wx_ext 0.1.6 → 0.1.8

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.
@@ -10,40 +10,39 @@ module WxExt
10
10
  # User api of weixin.
11
11
  #
12
12
  # @author FuShengYang
13
- module Menu
14
- class << self
15
-
16
- # Create menu via post.
17
- #
18
- # @param [Enumerable<String>] access_token
19
- # @param [Hash] menu_hash
20
- # @return [Hash] Json based hash.
21
- def create_menu(access_token, menu_hash)
22
- url = 'https://api.weixin.qq.com/cgi-bin/menu/create'\
23
- "?access_token=#{access_token}"
24
- Helper.http_post(url, menu_hash.to_json)
25
- end
13
+ module Menu
14
+ # Create menu via post.
15
+ #
16
+ # @param [Enumerable<String>] access_token
17
+ # @param [Hash] menu_hash
18
+ # @return [Hash] Json based hash.
19
+ def create_menu(access_token, menu_hash)
20
+ url = 'https://api.weixin.qq.com/cgi-bin/menu/create'\
21
+ "?access_token=#{access_token}"
22
+ Helper.http_post(url, menu_hash.to_json)
23
+ end
26
24
 
27
- # Get menus via get.
28
- #
29
- # @param [Enumerable<String>] access_token
30
- # @return [Hash] Json based hash.
31
- def menus(access_token)
32
- url = 'https://api.weixin.qq.com/cgi-bin/menu/get'\
33
- "?access_token=#{access_token}"
34
- Helper.http_get(url, { accept: :json })
35
- end
25
+ # Get menus via get.
26
+ #
27
+ # @param [Enumerable<String>] access_token
28
+ # @return [Hash] Json based hash.
29
+ def menus(access_token)
30
+ url = 'https://api.weixin.qq.com/cgi-bin/menu/get'\
31
+ "?access_token=#{access_token}"
32
+ Helper.http_get(url, { accept: :json })
33
+ end
36
34
 
37
- # Del menu via get.
38
- #
39
- # @param [Enumerable<String>] access_token
40
- # @return [Hash] Json based hash.
41
- def del_menu(access_token)
42
- url = 'https://api.weixin.qq.com/cgi-bin/menu/delete'\
43
- "?access_token=#{access_token}"
44
- Helper.http_get(url, { accept: :json })
45
- end
35
+ # Del menu via get.
36
+ #
37
+ # @param [Enumerable<String>] access_token
38
+ # @return [Hash] Json based hash.
39
+ def del_menu(access_token)
40
+ url = 'https://api.weixin.qq.com/cgi-bin/menu/delete'\
41
+ "?access_token=#{access_token}"
42
+ Helper.http_get(url, { accept: :json })
46
43
  end
44
+
45
+ extend self
47
46
  end
48
47
  end
49
48
  end
@@ -10,42 +10,41 @@ module WxExt
10
10
  # User api of weixin.
11
11
  #
12
12
  # @author FuShengYang
13
- module Qrcode
14
- class << self
15
-
16
- # Create ticket via post.
17
- #
18
- # @param [Enumerable<String>] access_token
19
- # @param [Hash] ticket_hash
20
- # @return [Hash] Json based hash.
21
- def create_ticket(access_token, ticket_hash)
22
- url = 'https://api.weixin.qq.com/cgi-bin/qrcode/create'\
23
- "?access_token=#{access_token}"
24
- Helper.http_post(url, ticket_hash.to_json)
25
- end
13
+ module Qrcode
14
+ # Create ticket via post.
15
+ #
16
+ # @param [Enumerable<String>] access_token
17
+ # @param [Hash] ticket_hash
18
+ # @return [Hash] Json based hash.
19
+ def create_ticket(access_token, ticket_hash)
20
+ url = 'https://api.weixin.qq.com/cgi-bin/qrcode/create'\
21
+ "?access_token=#{access_token}"
22
+ Helper.http_post(url, ticket_hash.to_json)
23
+ end
26
24
 
27
- # Get the qrcode via ticket.
28
- #
29
- # @param [Enumerable<String>] ticket
30
- # @return [Hash] Json based hash.
31
- def get_qrcode_by_ticket(ticket)
32
- url = 'https://mp.weixin.qq.com/cgi-bin/showqrcode'\
33
- "?ticket=#{ticket}"
34
- Helper.http_get url
35
- end
25
+ # Get the qrcode via ticket.
26
+ #
27
+ # @param [Enumerable<String>] ticket
28
+ # @return [Hash] Json based hash.
29
+ def get_qrcode_by_ticket(ticket)
30
+ url = 'https://mp.weixin.qq.com/cgi-bin/showqrcode'\
31
+ "?ticket=#{ticket}"
32
+ Helper.http_get url
33
+ end
36
34
 
37
- # Long url to short url via post.
38
- #
39
- # @param [Enumerable<String>] access_token
40
- # @param [Enumerable<String>] action
41
- # @param [Enumerable<String>] long_url
42
- # @return [Hash] Json based hash.
43
- def long_url_2_short(access_token, action='long2short', long_url)
44
- url = 'https://api.weixin.qq.com/cgi-bin/shorturl'\
45
- "?access_token=#{access_token}"
46
- Helper.http_post(url, { action: action, long_url: long_url }.to_json)
47
- end
35
+ # Long url to short url via post.
36
+ #
37
+ # @param [Enumerable<String>] access_token
38
+ # @param [Enumerable<String>] action
39
+ # @param [Enumerable<String>] long_url
40
+ # @return [Hash] Json based hash.
41
+ def long_url_2_short(access_token, action='long2short', long_url)
42
+ url = 'https://api.weixin.qq.com/cgi-bin/shorturl'\
43
+ "?access_token=#{access_token}"
44
+ Helper.http_post(url, { action: action, long_url: long_url }.to_json)
48
45
  end
46
+
47
+ extend self
49
48
  end
50
49
  end
51
50
  end
@@ -11,15 +11,15 @@ module WxExt
11
11
  #
12
12
  # @author FuShengYang
13
13
  module Msg
14
- class << self
15
- # Check the signature before send msg.
16
- #
17
- # @return [Boolean] Check the signature true or false.
18
- def check_signature(signature, timestamp, nonce, token)
19
- array = [token, timestamp, nonce].sort
20
- signature == Digest::SHA1.hexdigest(array.join) ? true : false
21
- end
14
+ # Check the signature before send msg.
15
+ #
16
+ # @return [Boolean] Check the signature true or false.
17
+ def check_signature(signature, timestamp, nonce, token)
18
+ array = [token, timestamp, nonce].sort
19
+ signature == Digest::SHA1.hexdigest(array.join) ? true : false
22
20
  end
21
+
22
+ extend self
23
23
  end
24
24
  end
25
25
  end
@@ -11,19 +11,18 @@ module WxExt
11
11
  #
12
12
  # @author FuShengYang
13
13
  module Semantic
14
- class << self
15
-
16
- # Create semantic search via post.
17
- #
18
- # @param [Enumerable<String>] access_token
19
- # @param [Hash] semantic_hash
20
- # @return [Hash] Json based hash.
21
- def semantic_search(access_token, semantic_hash)
22
- url = 'https://api.weixin.qq.com/semantic/semproxy/search'\
23
- "?access_token=#{access_token}"
24
- Helper.http_post(url, semantic_hash.to_json)
25
- end
14
+ # Create semantic search via post.
15
+ #
16
+ # @param [Enumerable<String>] access_token
17
+ # @param [Hash] semantic_hash
18
+ # @return [Hash] Json based hash.
19
+ def semantic_search(access_token, semantic_hash)
20
+ url = 'https://api.weixin.qq.com/semantic/semproxy/search'\
21
+ "?access_token=#{access_token}"
22
+ Helper.http_post(url, semantic_hash.to_json)
26
23
  end
24
+
25
+ extend self
27
26
  end
28
27
  end
29
28
  end
@@ -11,42 +11,41 @@ module WxExt
11
11
  #
12
12
  # @author FuShengYang
13
13
  module TemplateMsg
14
- class << self
15
-
16
- # Set the industry via post.
17
- #
18
- # @param [Enumerable<String>] access_token
19
- # @param [Enumerable<String>] industry_id1
20
- # @param [Enumerable<String>] industry_id2
21
- # @return [Hash] Json based hash.
22
- def set_industry(access_token, industry_id1, industry_id2)
23
- url = 'https://api.weixin.qq.com/cgi-bin/template/api_set_industry'\
24
- "?access_token=#{access_token}"
25
- Helper.http_post(url, { industry_id1: industry_id1, industry_id2: industry_id2 }.to_json)
26
- end
14
+ # Set the industry via post.
15
+ #
16
+ # @param [Enumerable<String>] access_token
17
+ # @param [Enumerable<String>] industry_id1
18
+ # @param [Enumerable<String>] industry_id2
19
+ # @return [Hash] Json based hash.
20
+ def set_industry(access_token, industry_id1, industry_id2)
21
+ url = 'https://api.weixin.qq.com/cgi-bin/template/api_set_industry'\
22
+ "?access_token=#{access_token}"
23
+ Helper.http_post(url, { industry_id1: industry_id1, industry_id2: industry_id2 }.to_json)
24
+ end
27
25
 
28
- # Get the template ID via post.
29
- #
30
- # @param [Enumerable<String>] access_token
31
- # @param [Enumerable<String>] template_id_short
32
- # @return [Hash] Json based hash.
33
- def get_template_id(access_token, template_id_short)
34
- url = 'https://api.weixin.qq.com/cgi-bin/template/api_add_template'\
35
- "?access_token=#{access_token}"
36
- Helper.http_post(url, { template_id_short: template_id_short })
37
- end
26
+ # Get the template ID via post.
27
+ #
28
+ # @param [Enumerable<String>] access_token
29
+ # @param [Enumerable<String>] template_id_short
30
+ # @return [Hash] Json based hash.
31
+ def get_template_id(access_token, template_id_short)
32
+ url = 'https://api.weixin.qq.com/cgi-bin/template/api_add_template'\
33
+ "?access_token=#{access_token}"
34
+ Helper.http_post(url, { template_id_short: template_id_short })
35
+ end
38
36
 
39
- # Send the template msg via post.
40
- #
41
- # @param [Enumerable<String>] access_token
42
- # @param [Hash] template_msg_hash
43
- # @return [Hash] Json based hash.
44
- def send_template_msg(access_token, template_msg_hash)
45
- url = 'https://api.weixin.qq.com/cgi-bin/message/template/send'\
46
- "?access_token=#{access_token}"
47
- Helper.http_post(url, template_msg_hash.to_json)
48
- end
37
+ # Send the template msg via post.
38
+ #
39
+ # @param [Enumerable<String>] access_token
40
+ # @param [Hash] template_msg_hash
41
+ # @return [Hash] Json based hash.
42
+ def send_template_msg(access_token, template_msg_hash)
43
+ url = 'https://api.weixin.qq.com/cgi-bin/message/template/send'\
44
+ "?access_token=#{access_token}"
45
+ Helper.http_post(url, template_msg_hash.to_json)
49
46
  end
47
+
48
+ extend self
50
49
  end
51
50
  end
52
51
  end
@@ -15,63 +15,63 @@ module WxExt
15
15
  #
16
16
  # @author FuShengYang
17
17
  module Group
18
- class << self
19
- # Create user group via post.
20
- #
21
- # @param [Enumerable<String>] access_token
22
- # @param [Enumerable<String>] group_name
23
- # @return [Hash] A json parse hash.
24
- def create_group(access_token, group_name)
25
- url = 'https://api.weixin.qq.com/cgi-bin/groups/create'\
26
- "?access_token=#{access_token}"
27
- Helper.http_post(url, { group: { name: group_name } }.to_json)
28
- end
18
+ # Create user group via post.
19
+ #
20
+ # @param [Enumerable<String>] access_token
21
+ # @param [Enumerable<String>] group_name
22
+ # @return [Hash] A json parse hash.
23
+ def create_group(access_token, group_name)
24
+ url = 'https://api.weixin.qq.com/cgi-bin/groups/create'\
25
+ "?access_token=#{access_token}"
26
+ Helper.http_post(url, { group: { name: group_name } }.to_json)
27
+ end
29
28
 
30
- # Get all groups via get.
31
- #
32
- # @param [Enumerable<String>] access_token
33
- # @return [Hash] A json parse hash.
34
- def groups(access_token)
35
- url = 'https://api.weixin.qq.com/cgi-bin/groups/get'\
36
- "?access_token=#{access_token}"
37
- Helper.http_get(url, { accept: :json }.to_json)
38
- end
29
+ # Get all groups via get.
30
+ #
31
+ # @param [Enumerable<String>] access_token
32
+ # @return [Hash] A json parse hash.
33
+ def groups(access_token)
34
+ url = 'https://api.weixin.qq.com/cgi-bin/groups/get'\
35
+ "?access_token=#{access_token}"
36
+ Helper.http_get(url, { accept: :json }.to_json)
37
+ end
39
38
 
40
- # Get user of group via post.
41
- #
42
- # @param [Enumerable<String>] access_token
43
- # @param [Enumerable<String>] openid
44
- # @return [Hash] A json parse hash.
45
- def user_of_group(access_token, openid)
46
- url = 'https://api.weixin.qq.com/cgi-bin/groups/getid'\
47
- "?access_token=#{access_token}"
48
- Helper.http_post(url, { openid: openid }.to_json)
49
- end
39
+ # Get user of group via post.
40
+ #
41
+ # @param [Enumerable<String>] access_token
42
+ # @param [Enumerable<String>] openid
43
+ # @return [Hash] A json parse hash.
44
+ def user_of_group(access_token, openid)
45
+ url = 'https://api.weixin.qq.com/cgi-bin/groups/getid'\
46
+ "?access_token=#{access_token}"
47
+ Helper.http_post(url, { openid: openid }.to_json)
48
+ end
50
49
 
51
- # Update user group name via post.
52
- #
53
- # @param [Enumerable<String>] access_token
54
- # @param [Enumerable<String>] id
55
- # @param [Enumerable<String>] name
56
- # @return [Hash] A json parse hash.
57
- def update_group_name(access_token, id, name)
58
- url = 'https://api.weixin.qq.com/cgi-bin/groups/update'\
59
- "?access_token=#{access_token}"
60
- Helper.http_post(url, { group: { id: id, name: name } }.to_json)
61
- end
50
+ # Update user group name via post.
51
+ #
52
+ # @param [Enumerable<String>] access_token
53
+ # @param [Enumerable<String>] id
54
+ # @param [Enumerable<String>] name
55
+ # @return [Hash] A json parse hash.
56
+ def update_group_name(access_token, id, name)
57
+ url = 'https://api.weixin.qq.com/cgi-bin/groups/update'\
58
+ "?access_token=#{access_token}"
59
+ Helper.http_post(url, { group: { id: id, name: name } }.to_json)
60
+ end
62
61
 
63
- # Move user group via post.
64
- #
65
- # @param [Enumerable<String>] access_token
66
- # @param [Enumerable<String>] openid
67
- # @param [Enumerable<String>] to_groupid
68
- # @return [Hash] A json parse hash.
69
- def mv_user_group(access_token, openid, to_groupid)
70
- url = 'https://api.weixin.qq.com/cgi-bin/groups/members/update'\
71
- "?access_token=#{access_token}"
72
- Helper.http_post(url, { openid: openid, to_groupid: to_groupid }.to_json)
73
- end
62
+ # Move user group via post.
63
+ #
64
+ # @param [Enumerable<String>] access_token
65
+ # @param [Enumerable<String>] openid
66
+ # @param [Enumerable<String>] to_groupid
67
+ # @return [Hash] A json parse hash.
68
+ def mv_user_group(access_token, openid, to_groupid)
69
+ url = 'https://api.weixin.qq.com/cgi-bin/groups/members/update'\
70
+ "?access_token=#{access_token}"
71
+ Helper.http_post(url, { openid: openid, to_groupid: to_groupid }.to_json)
74
72
  end
73
+
74
+ extend self
75
75
  end
76
76
  end
77
77
  end
@@ -11,92 +11,91 @@ module WxExt
11
11
  #
12
12
  # @author FuShengYang
13
13
  module User
14
- class << self
15
-
16
- # Change the remark of user via post.
17
- #
18
- # @param [Enumerable<String>] access_token
19
- # @param [Enumerable<String>] openid
20
- # @param [Enumerable<String>] remark
21
- # @return [Hash] Json based hash.
22
- def change_remark(access_token, openid, remark)
23
- url = 'https://api.weixin.qq.com/cgi-bin/user/info/updateremark'\
24
- "?access_token=#{access_token}"
25
- Helper.http_post(url, { openid: openid, remark: remark }.to_json)
26
- end
14
+ # Change the remark of user via post.
15
+ #
16
+ # @param [Enumerable<String>] access_token
17
+ # @param [Enumerable<String>] openid
18
+ # @param [Enumerable<String>] remark
19
+ # @return [Hash] Json based hash.
20
+ def change_remark(access_token, openid, remark)
21
+ url = 'https://api.weixin.qq.com/cgi-bin/user/info/updateremark'\
22
+ "?access_token=#{access_token}"
23
+ Helper.http_post(url, { openid: openid, remark: remark }.to_json)
24
+ end
27
25
 
28
- # Get the user base info.
29
- #
30
- # @param [Enumerable<String>] access_token
31
- # @param [Enumerable<String>] openid
32
- # @param [Enumerable<String>] lang
33
- # @return [Hash] Json based hash.
34
- def get_user_base_info(access_token, openid, lang='zh_CN')
35
- url = 'https://api.weixin.qq.com/cgi-bin/user/info'\
36
- "?access_token=#{access_token}&openid=#{openid}&lang=#{lang}"
37
- Helper.http_get(url, { accept: :json })
38
- end
26
+ # Get the user base info.
27
+ #
28
+ # @param [Enumerable<String>] access_token
29
+ # @param [Enumerable<String>] openid
30
+ # @param [Enumerable<String>] lang
31
+ # @return [Hash] Json based hash.
32
+ def get_user_base_info(access_token, openid, lang='zh_CN')
33
+ url = 'https://api.weixin.qq.com/cgi-bin/user/info'\
34
+ "?access_token=#{access_token}&openid=#{openid}&lang=#{lang}"
35
+ Helper.http_get(url, { accept: :json })
36
+ end
39
37
 
40
- # Get user list of weixin.
41
- #
42
- # @param [Enumerable<String>] access_token
43
- # @param [Enumerable<String>] next_openid
44
- # @return [Hash] Json based hash.
45
- def user_list(access_token, next_openid=nil)
46
- url = 'https://api.weixin.qq.com/cgi-bin/user/get'\
47
- "?access_token=#{access_token}"
48
- url += "&next_openid=#{next_openid}" if next_openid
49
- Helper.http_get(url, { accept: :json })
50
- end
38
+ # Get user list of weixin.
39
+ #
40
+ # @param [Enumerable<String>] access_token
41
+ # @param [Enumerable<String>] next_openid
42
+ # @return [Hash] Json based hash.
43
+ def user_list(access_token, next_openid=nil)
44
+ url = 'https://api.weixin.qq.com/cgi-bin/user/get'\
45
+ "?access_token=#{access_token}"
46
+ url += "&next_openid=#{next_openid}" if next_openid
47
+ Helper.http_get(url, { accept: :json })
48
+ end
51
49
 
52
- # Get oauth2 token with code.
53
- #
54
- # @param [Enumerable<String>] app_id
55
- # @param [Enumerable<String>] app_secret
56
- # @param [Enumerable<String>] code
57
- # @param [Enumerable<String>] grant_type
58
- # @return [Hash] Json based hash.
59
- def get_oauth2_token_with_code(app_id, app_secret, code, grant_type='authorization_code')
60
- url = 'https://api.weixin.qq.com/sns/oauth2/access_token'\
61
- "?appid=#{app_id}&secret=#{app_secret}&code=CODE&grant_type=#{grant_type}"
62
- Helper.http_get(url, { accept: :json })
63
- end
50
+ # Get oauth2 token with code.
51
+ #
52
+ # @param [Enumerable<String>] app_id
53
+ # @param [Enumerable<String>] app_secret
54
+ # @param [Enumerable<String>] code
55
+ # @param [Enumerable<String>] grant_type
56
+ # @return [Hash] Json based hash.
57
+ def get_oauth2_token_with_code(app_id, app_secret, code, grant_type='authorization_code')
58
+ url = 'https://api.weixin.qq.com/sns/oauth2/access_token'\
59
+ "?appid=#{app_id}&secret=#{app_secret}&code=CODE&grant_type=#{grant_type}"
60
+ Helper.http_get(url, { accept: :json })
61
+ end
64
62
 
65
- # Refresh oauth2 token.
66
- #
67
- # @param [Enumerable<String>] app_id
68
- # @param [Enumerable<String>] refresh_token
69
- # @param [Enumerable<String>] grant_type
70
- # @return [Hash] Json based hash.
71
- def refresh_oauth2_token(app_id, refresh_token, grant_type='refresh_token')
72
- url = 'https://api.weixin.qq.com/sns/oauth2/refresh_token'\
73
- "?appid=#{app_id}&grant_type=#{grant_type}&refresh_token=#{refresh_token}"
74
- Helper.http_get(url, { accept: :json })
75
- end
63
+ # Refresh oauth2 token.
64
+ #
65
+ # @param [Enumerable<String>] app_id
66
+ # @param [Enumerable<String>] refresh_token
67
+ # @param [Enumerable<String>] grant_type
68
+ # @return [Hash] Json based hash.
69
+ def refresh_oauth2_token(app_id, refresh_token, grant_type='refresh_token')
70
+ url = 'https://api.weixin.qq.com/sns/oauth2/refresh_token'\
71
+ "?appid=#{app_id}&grant_type=#{grant_type}&refresh_token=#{refresh_token}"
72
+ Helper.http_get(url, { accept: :json })
73
+ end
76
74
 
77
- # Get user info with snsapi_userinfo.
78
- #
79
- # @param [Enumerable<String>] oauth2_token
80
- # @param [Enumerable<String>] openid
81
- # @param [Enumerable<String>] lang
82
- # @return [Hash] Json based hash.
83
- def get_user_info_with_snsapi_userinfo(oauth2_token, openid, lang)
84
- url = 'https://api.weixin.qq.com/sns/userinfo'\
85
- "?access_token=#{oauth2_token}&#{openid}=OPENID&lang=#{lang}"
86
- Helper.http_get(url, { accept: :json })
87
- end
75
+ # Get user info with snsapi_userinfo.
76
+ #
77
+ # @param [Enumerable<String>] oauth2_token
78
+ # @param [Enumerable<String>] openid
79
+ # @param [Enumerable<String>] lang
80
+ # @return [Hash] Json based hash.
81
+ def get_user_info_with_snsapi_userinfo(oauth2_token, openid, lang)
82
+ url = 'https://api.weixin.qq.com/sns/userinfo'\
83
+ "?access_token=#{oauth2_token}&#{openid}=OPENID&lang=#{lang}"
84
+ Helper.http_get(url, { accept: :json })
85
+ end
88
86
 
89
- # Check the oauth2_token.
90
- #
91
- # @param [Enumerable<String>] openid
92
- # @param [Enumerable<String>] oauth2_token
93
- # @return [Hash] Json based hash.
94
- def check_oauth2_token(openid, oauth2_token)
95
- url = 'https://api.weixin.qq.com/sns/auth'\
96
- "?access_token=#{oauth2_token}&openid=#{openid}"
97
- Helper.http_get(url, { accept: :json })
98
- end
87
+ # Check the oauth2_token.
88
+ #
89
+ # @param [Enumerable<String>] openid
90
+ # @param [Enumerable<String>] oauth2_token
91
+ # @return [Hash] Json based hash.
92
+ def check_oauth2_token(openid, oauth2_token)
93
+ url = 'https://api.weixin.qq.com/sns/auth'\
94
+ "?access_token=#{oauth2_token}&openid=#{openid}"
95
+ Helper.http_get(url, { accept: :json })
99
96
  end
97
+
98
+ extend self
100
99
  end
101
100
  end
102
101
  end
data/lib/wx_ext/helper.rb CHANGED
@@ -8,27 +8,27 @@ module WxExt
8
8
  #
9
9
  # @author FuShengYang
10
10
  module Helper
11
- class << self
12
- # Http get helper of this gem, always return a hash.
13
- #
14
- # @param [Enumerable<String>] url
15
- # @param [Hash] headers
16
- # @return [Hash] A json parse hash.
17
- def http_get(url, headers = {})
18
- res = RestClient.get url, headers
19
- JSON.parse res
20
- end
11
+ # Http get helper of this gem, always return a hash.
12
+ #
13
+ # @param [Enumerable<String>] url
14
+ # @param [Hash] headers
15
+ # @return [Hash] A json parse hash.
16
+ def http_get(url, headers = {})
17
+ res = RestClient.get url, headers
18
+ JSON.parse res
19
+ end
21
20
 
22
- # Http post helper of this gem, always return a hash.
23
- #
24
- # @param [Enumerable<String>] url
25
- # @param [Hash] params
26
- # @param [Hash] headers
27
- # @return [Hash] A json parse hash.
28
- def http_post(url, params, headers = {})
29
- res = RestClient.post url, params, headers
30
- JSON.parse res
31
- end
21
+ # Http post helper of this gem, always return a hash.
22
+ #
23
+ # @param [Enumerable<String>] url
24
+ # @param [Hash] params
25
+ # @param [Hash] headers
26
+ # @return [Hash] A json parse hash.
27
+ def http_post(url, params, headers = {})
28
+ res = RestClient.post url, params, headers
29
+ JSON.parse res
32
30
  end
31
+
32
+ extend self
33
33
  end
34
34
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module WxExt
3
- VERSION = '0.1.6'
3
+ VERSION = '0.1.8'
4
4
  end