wechat-pay 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62c4aa7b22ada0f4b3251fdc6b28ba32620ca5149e7d999c458543a805dbcbef
4
- data.tar.gz: d7f4b63d6e82df69d440154b233776e6a289b875a0ca81107440816732ec3dff
3
+ metadata.gz: b07e4346fb61d83569dadb3b0dd467a6b719375fa3b471d6df0ed58a2307b3d2
4
+ data.tar.gz: f72bff18f57427e1c8946ddf82bcdb9f20c0057f80fb11beb9eb71183a6499c0
5
5
  SHA512:
6
- metadata.gz: eddf42af769b7cf7781b991780b11deabe060e1bf4f2f86250e4a910b7483cafc779731ac03e12a6cc2ff9b9b97f81ff0e0ee8a83a177d5488d8ce68b727f6f0
7
- data.tar.gz: 8a53231c6e6ead3ea36dffa157eba6bfeb73ae94762789d1261d852f92a60925764be70d9d1f8bf33b59a39aebc20fcff21b909e361cd64dc30621ea40f68ad9
6
+ metadata.gz: 124e7291a418fd0759ca7906973bf2134fa4330d0db0c2b8cb0612964247ee51de5f7ed74203b99492019a544f513a8b2e005f5f1f81a339e4f4bf91890fedc4
7
+ data.tar.gz: c1b0543c3cffc19563d0f42ed624f43f0a4bfcd5bbf990923457be6c9cfa49dbcb67ad864a444970f4929e81ee4e7fdeb1e5f2727ca24b1f05e2627546f79d78
@@ -21,75 +21,73 @@ module WechatPay
21
21
  module Ecommerce
22
22
  include WechatPayHelper
23
23
 
24
- class<<self
25
- # 视频上传
26
- #
27
- # Document: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter2_1_2.shtml
28
- #
29
- # Example:
30
- #
31
- # ``` ruby
32
- # WechatPay::Ecommerce.media_video_upload(File.open('Your Video'))
33
- # ```
34
- #
35
- def media_video_upload(video)
36
- url = '/v3/merchant/media/video_upload'
37
- method = 'POST'
38
- meta = {
39
- filename: video.to_path,
40
- sha256: Digest::SHA256.hexdigest(video.read)
41
- }
24
+ # 视频上传
25
+ #
26
+ # Document: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter2_1_2.shtml
27
+ #
28
+ # Example:
29
+ #
30
+ # ``` ruby
31
+ # WechatPay::Ecommerce.media_video_upload(File.open('Your Video'))
32
+ # ```
33
+ #
34
+ def self.media_video_upload(video)
35
+ url = '/v3/merchant/media/video_upload'
36
+ method = 'POST'
37
+ meta = {
38
+ filename: video.to_path,
39
+ sha256: Digest::SHA256.hexdigest(video.read)
40
+ }
41
+
42
+ video.rewind
43
+ payload = {
44
+ meta: meta.to_json,
45
+ file: video
46
+ }
42
47
 
43
- video.rewind
44
- payload = {
45
- meta: meta.to_json,
46
- file: video
48
+ make_request(
49
+ method: method,
50
+ path: url,
51
+ for_sign: meta.to_json,
52
+ payload: payload,
53
+ extra_headers: {
54
+ 'Content-Type' => nil
47
55
  }
56
+ )
57
+ end
48
58
 
49
- make_request(
50
- method: method,
51
- path: url,
52
- for_sign: meta.to_json,
53
- payload: payload,
54
- extra_headers: {
55
- 'Content-Type' => nil
56
- }
57
- )
58
- end
59
+ # 图片上传
60
+ #
61
+ # Document: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter2_1_1.shtml
62
+ #
63
+ # Example:
64
+ #
65
+ # ``` ruby
66
+ # WechatPay::Ecommerce.media_upload(File.open('Your Image'))
67
+ # ```
68
+ def self.media_upload(image)
69
+ url = '/v3/merchant/media/upload'
70
+ method = 'POST'
71
+ meta = {
72
+ filename: image.to_path,
73
+ sha256: Digest::SHA256.hexdigest(image.read)
74
+ }
59
75
 
60
- # 图片上传
61
- #
62
- # Document: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter2_1_1.shtml
63
- #
64
- # Example:
65
- #
66
- # ``` ruby
67
- # WechatPay::Ecommerce.media_upload(File.open('Your Image'))
68
- # ```
69
- def media_upload(image)
70
- url = '/v3/merchant/media/upload'
71
- method = 'POST'
72
- meta = {
73
- filename: image.to_path,
74
- sha256: Digest::SHA256.hexdigest(image.read)
75
- }
76
+ image.rewind
77
+ payload = {
78
+ meta: meta.to_json,
79
+ file: image
80
+ }
76
81
 
77
- image.rewind
78
- payload = {
79
- meta: meta.to_json,
80
- file: image
82
+ make_request(
83
+ method: method,
84
+ path: url,
85
+ for_sign: meta.to_json,
86
+ payload: payload,
87
+ extra_headers: {
88
+ 'Content-Type' => nil # Pass nil to remove the Content-Type
81
89
  }
82
-
83
- make_request(
84
- method: method,
85
- path: url,
86
- for_sign: meta.to_json,
87
- payload: payload,
88
- extra_headers: {
89
- 'Content-Type' => nil # Pass nil to remove the Content-Type
90
- }
91
- )
92
- end
90
+ )
93
91
  end
94
92
  end
95
93
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WechatPay
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wechat-pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - lanzhiheng