bootpay-backend-ruby 3.0.0.pre.alpha.1 → 3.0.0.pre.alpha.3
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/bootpay-backend-ruby.rb +4 -0
- data/lib/bootpay_storage/concern/image.rb +2 -3
- data/lib/bootpay_storage/concern/rest.rb +54 -11
- data/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c39a84c5f8ae3dc4bdde7e2b7bf99a3b570ea66f5d2368442be24e888b148c7
|
4
|
+
data.tar.gz: 6d29b4e6920b8a995b2bc9cd06484eee06770b91daeefa263f2c90ea72c19331
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7df5bdd01f1682769cb2fb5b6a90da35ba87cc289e2e9539104f671f474963dd8451b9916a8f5016b5b46bb44017b992cf733a2ae82ae8d8b3461d9c1b3f52d6
|
7
|
+
data.tar.gz: f9b0fcf40002c3c579b73da89bdca1829f861ad4c661f171bdc37392f208cec4f5005d0b3ffffff187a42a127d1c7a77b393e9b58aa33310f6ed36bf5f4e44da
|
data/CHANGELOG.md
CHANGED
@@ -7,11 +7,10 @@ module BootpayStorage::Concern::Image
|
|
7
7
|
# REST API로 본인인증 요청하기
|
8
8
|
# Comment by Gosomi
|
9
9
|
# Date: 2022-11-02
|
10
|
-
def image_upload(
|
10
|
+
def image_upload(images:)
|
11
11
|
upload(
|
12
12
|
uri: 'images',
|
13
|
-
|
14
|
-
image_name: image_name
|
13
|
+
images: images
|
15
14
|
)
|
16
15
|
end
|
17
16
|
|
@@ -38,12 +38,12 @@ module BootpayStorage::Concern::Rest
|
|
38
38
|
# Multipart 파일 전송 Method
|
39
39
|
# Comment by Gosomi
|
40
40
|
# Date: 2025-03-25
|
41
|
-
def upload(uri:,
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
def upload(uri:, images:, headers: {}, params: nil)
|
42
|
+
# 이미지 데이터를 배열로 받음
|
43
|
+
files = images.each_with_index.map do |data, index|
|
44
|
+
filename = "image_#{Time.now.to_i}_#{index}.jpg"
|
45
|
+
HTTP::FormData::File.new(data, filename: filename)
|
46
|
+
end
|
47
47
|
|
48
48
|
# HTTP 요청
|
49
49
|
response = HTTP.headers(
|
@@ -56,14 +56,10 @@ module BootpayStorage::Concern::Rest
|
|
56
56
|
}.merge!(headers).compact
|
57
57
|
).post(
|
58
58
|
[BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/'),
|
59
|
-
form: { images:
|
59
|
+
form: { images: files },
|
60
60
|
params: params
|
61
61
|
)
|
62
62
|
|
63
|
-
# 응답 상태와 바디 출력
|
64
|
-
puts "Response Status: #{response.status}"
|
65
|
-
puts "Response Body: #{response.body.to_s}"
|
66
|
-
|
67
63
|
# JSON 파싱 시도
|
68
64
|
parsed_response = begin
|
69
65
|
JSON.parse(response.body.to_s, symbolize_names: true)
|
@@ -84,5 +80,52 @@ module BootpayStorage::Concern::Rest
|
|
84
80
|
)
|
85
81
|
end
|
86
82
|
|
83
|
+
|
84
|
+
# def upload(uri:, image_data:, image_name:, headers: {}, params: nil)
|
85
|
+
#
|
86
|
+
# # puts [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/')
|
87
|
+
#
|
88
|
+
# # 파일 객체 생성
|
89
|
+
# file = HTTP::FormData::File.new(image_data, filename: image_name)
|
90
|
+
#
|
91
|
+
# # HTTP 요청
|
92
|
+
# response = HTTP.headers(
|
93
|
+
# {
|
94
|
+
# Authorization: "Bearer #{@token}",
|
95
|
+
# accept: 'application/json',
|
96
|
+
# bootpay_api_version: @api_version,
|
97
|
+
# bootpay_sdk_version: Bootpay::V2_VERSION,
|
98
|
+
# bootpay_sdk_type: '300'
|
99
|
+
# }.merge!(headers).compact
|
100
|
+
# ).post(
|
101
|
+
# [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/'),
|
102
|
+
# form: { images: [file] },
|
103
|
+
# params: params
|
104
|
+
# )
|
105
|
+
#
|
106
|
+
# # 응답 상태와 바디 출력
|
107
|
+
# puts "Response Status: #{response.status}"
|
108
|
+
# puts "Response Body: #{response.body.to_s}"
|
109
|
+
#
|
110
|
+
# # JSON 파싱 시도
|
111
|
+
# parsed_response = begin
|
112
|
+
# JSON.parse(response.body.to_s, symbolize_names: true)
|
113
|
+
# rescue JSON::ParserError => e
|
114
|
+
# { error: "응답 파싱 실패: #{e.message}", body: response.body.to_s }
|
115
|
+
# end
|
116
|
+
#
|
117
|
+
# # 응답 처리
|
118
|
+
# BootpayStorage::Response.new(
|
119
|
+
# response.status.to_i == 200,
|
120
|
+
# parsed_response
|
121
|
+
# )
|
122
|
+
# rescue Exception => e
|
123
|
+
# BootpayStorage::Response.new(
|
124
|
+
# false,
|
125
|
+
# message: "파일 업로드 실패: #{e.message}",
|
126
|
+
# backtrace: e.backtrace.join("\n")
|
127
|
+
# )
|
128
|
+
# end
|
129
|
+
|
87
130
|
end
|
88
131
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootpay-backend-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.pre.alpha.
|
4
|
+
version: 3.0.0.pre.alpha.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gosomi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- bin/console
|
57
57
|
- bin/setup
|
58
58
|
- bootpay-backend-ruby.gemspec
|
59
|
+
- lib/bootpay-backend-ruby.rb
|
59
60
|
- lib/bootpay/bootpay-rest-client.rb
|
60
61
|
- lib/bootpay/concern.rb
|
61
62
|
- lib/bootpay/concern/authenticate.rb
|