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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f99b7d09d3da36d7350f6e11ec9e3992e5518b1e4cf9280577f537b952471ff
4
- data.tar.gz: a139b2429b80827e4865b5bb1b6d970bb9cb9051b28577a4340a0f88b2e258e1
3
+ metadata.gz: 3c39a84c5f8ae3dc4bdde7e2b7bf99a3b570ea66f5d2368442be24e888b148c7
4
+ data.tar.gz: 6d29b4e6920b8a995b2bc9cd06484eee06770b91daeefa263f2c90ea72c19331
5
5
  SHA512:
6
- metadata.gz: 4151964b4afe765e3a2dbdd2b36f531ee02e0f21e28a4d2f674917b310018f891c657462a73b3132853529a1ab80e249da1aca01acddf954ab3aa2f60ffa1cdc
7
- data.tar.gz: 94d3d4875dce4fbf501c10263cff3d221bf2c7ae78b60f4210709ef3811271d77ba47de346dd834e6df108492c496e001293ef2c8b372d3ec803f3e3168981f7
6
+ metadata.gz: 7df5bdd01f1682769cb2fb5b6a90da35ba87cc289e2e9539104f671f474963dd8451b9916a8f5016b5b46bb44017b992cf733a2ae82ae8d8b3461d9c1b3f52d6
7
+ data.tar.gz: f9b0fcf40002c3c579b73da89bdca1829f861ad4c661f171bdc37392f208cec4f5005d0b3ffffff187a42a127d1c7a77b393e9b58aa33310f6ed36bf5f4e44da
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 3.0.0
2
+ - store api 추가
3
+ - 내부용 storage api 추가
4
+
1
5
  ### 2.0.5
2
6
  - 빌링결제 api 추가
3
7
  - 계좌 빌링 결제 api 추가
@@ -0,0 +1,4 @@
1
+ # lib/bootpay.rb
2
+ require_relative "bootpay/bootpay-rest-client"
3
+ require_relative "bootpay_storage/bootpay-storage-rest-client"
4
+ require_relative "bootpay_store/bootpay-store-rest-client"
@@ -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(image_data:, image_name:)
10
+ def image_upload(images:)
11
11
  upload(
12
12
  uri: 'images',
13
- image_data: image_data,
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:, image_data:, image_name:, headers: {}, params: nil)
42
-
43
- # puts [BootpayStorage::RestClient::API[@mode.to_sym], uri].join('/')
44
-
45
- # 파일 객체 생성
46
- file = HTTP::FormData::File.new(image_data, filename: image_name)
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: [file] },
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Bootpay
3
- V2_VERSION = "3.0.0-alpha.1"
3
+ V2_VERSION = "3.0.0-alpha.3"
4
4
  end
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.1
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-26 00:00:00.000000000 Z
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