payjpv2 1.0.11 → 1.1.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
  SHA256:
3
- metadata.gz: b5c7c9af553704a217bd596adb3053420567631ce8cc4f70e645359d4d4bd39e
4
- data.tar.gz: c6f326ca919ac51333a6088d36dccca76d3a7748006709b52af31b0beaf1a9b1
3
+ metadata.gz: 56b88fd18889958097f5e7e121adfb3525c0df32c2c248653b686753b6ec90d2
4
+ data.tar.gz: 7d022140ae970e85dffb8a88f91abdb0633d9c07909e5b83deaf06e1ff290332
5
5
  SHA512:
6
- metadata.gz: 347a4b4656ec911fc1cdb57edff26d85111fa396c62e7d620d31ff529b4eb28c5f9cf0104131316e95583cab03177d4e6261dc794fe4a438fa22486dbcd665bd
7
- data.tar.gz: aa7a00e763734f551ee06ec9eaba83608c798d9979ae473c28cc36edfc7530a67aa3abf44117e949c841dc2c1ba4a502c9372f1ba48feea428ea646cbb6d268d
6
+ metadata.gz: cf3ba18464531a698a3e0f8353d3f3a85a958f743c3aca94ce96b1b86cbf73065324893521ef39b7d05076c259501336882cb841fb832829ce7b12bd4e735d23
7
+ data.tar.gz: a56d69719517c149a0918f879f52170c51a5d645eebfa24530426045aabeb61c4612c6d1a2431cda384cded5ba129d1cbae52b8c4b2eecccb101a0acece00fae
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- payjpv2 (1.0.11)
4
+ payjpv2 (1.1.0)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -5,7 +5,7 @@ A Ruby client library for the PAY.JP v2 API. This SDK provides a convenient way
5
5
  This Ruby gem is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
6
6
 
7
7
  - API version: 2.0.0
8
- - Package version: 1.0.11
8
+ - Package version: 1.1.0
9
9
  - Generator version: 7.14.0
10
10
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
11
11
 
@@ -26,7 +26,7 @@ gem install payjpv2
26
26
  Add this line to your application's Gemfile:
27
27
 
28
28
  ```ruby
29
- gem 'payjpv2', '~> 1.0.11'
29
+ gem 'payjpv2', '~> 1.1.0'
30
30
  ```
31
31
 
32
32
  Then execute:
@@ -350,11 +350,13 @@ Class | Method | HTTP request | Description
350
350
  - [PAYJPv2::PaymentTransactionResponse](docs/PaymentTransactionResponse.md)
351
351
  - [PAYJPv2::PaymentTransactionType](docs/PaymentTransactionType.md)
352
352
  - [PAYJPv2::PriceCreateRequest](docs/PriceCreateRequest.md)
353
+ - [PAYJPv2::PriceDataRequest](docs/PriceDataRequest.md)
353
354
  - [PAYJPv2::PriceDetailsResponse](docs/PriceDetailsResponse.md)
354
355
  - [PAYJPv2::PriceListResponse](docs/PriceListResponse.md)
355
356
  - [PAYJPv2::PriceType](docs/PriceType.md)
356
357
  - [PAYJPv2::PriceUpdateRequest](docs/PriceUpdateRequest.md)
357
358
  - [PAYJPv2::ProductCreateRequest](docs/ProductCreateRequest.md)
359
+ - [PAYJPv2::ProductDataRequest](docs/ProductDataRequest.md)
358
360
  - [PAYJPv2::ProductDeletedResponse](docs/ProductDeletedResponse.md)
359
361
  - [PAYJPv2::ProductDetailsResponse](docs/ProductDetailsResponse.md)
360
362
  - [PAYJPv2::ProductListResponse](docs/ProductListResponse.md)
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **default_payment_method_id** | **String** | | [optional] |
7
+ | **default_payment_method_id** | **String** | 支払いにデフォルトで使用される支払い方法 ID | [optional] |
8
8
  | **email** | **String** | 顧客のメールアドレス。メールアドレスの形式が正しいかどうかは検証されます。 | [optional] |
9
9
  | **description** | **String** | 顧客オブジェクトに付加できる任意の文字列です。管理画面で顧客と一緒に表示されます。 | [optional] |
10
10
  | **metadata** | [**Hash<String, MetadataValue>**](MetadataValue.md) | キーバリューの任意のデータを格納できます。20件まで登録可能で、空文字列を指定するとそのキーを削除できます。<a href=\"https://docs.pay.jp/v2/guide/developers/metadata\">詳細はメタデータのドキュメントを参照してください。</a> | [optional] |
@@ -4,7 +4,8 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **price_id** | **String** | 料金 ID | |
7
+ | **price_id** | **String** | | [optional] |
8
+ | **price_data** | [**PriceDataRequest**](PriceDataRequest.md) | | [optional] |
8
9
  | **quantity** | **Integer** | 購入する商品の数量 | |
9
10
  | **tax_rates** | **Array<String>** | 税率 ID | [optional] |
10
11
 
@@ -15,6 +16,7 @@ require 'payjpv2'
15
16
 
16
17
  instance = PAYJPv2::LineItemRequest.new(
17
18
  price_id: null,
19
+ price_data: null,
18
20
  quantity: null,
19
21
  tax_rates: null
20
22
  )
@@ -0,0 +1,24 @@
1
+ # PAYJPv2::PriceDataRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **currency** | [**Currency**](Currency.md) | 通貨。現在は `jpy` のみサポートしています。 | |
8
+ | **unit_amount** | **Integer** | 単価(0以上の整数) | |
9
+ | **product_id** | **String** | | [optional] |
10
+ | **product_data** | [**ProductDataRequest**](ProductDataRequest.md) | | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'payjpv2'
16
+
17
+ instance = PAYJPv2::PriceDataRequest.new(
18
+ currency: null,
19
+ unit_amount: null,
20
+ product_id: null,
21
+ product_data: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,20 @@
1
+ # PAYJPv2::ProductDataRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | **String** | Checkout などで顧客に表示される商品名 | |
8
+ | **description** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'payjpv2'
14
+
15
+ instance = PAYJPv2::ProductDataRequest.new(
16
+ name: null,
17
+ description: null
18
+ )
19
+ ```
20
+
@@ -15,6 +15,7 @@ require 'time'
15
15
 
16
16
  module PAYJPv2
17
17
  class CustomerUpdateRequest
18
+ # 支払いにデフォルトで使用される支払い方法 ID
18
19
  attr_accessor :default_payment_method_id
19
20
 
20
21
  # 顧客のメールアドレス。メールアドレスの形式が正しいかどうかは検証されます。
@@ -59,7 +60,6 @@ module PAYJPv2
59
60
  # List of attributes with nullable: true
60
61
  def self.openapi_nullable
61
62
  Set.new([
62
- :default_payment_method_id,
63
63
  ])
64
64
  end
65
65
 
@@ -15,9 +15,10 @@ require 'time'
15
15
 
16
16
  module PAYJPv2
17
17
  class LineItemRequest
18
- # 料金 ID
19
18
  attr_accessor :price_id
20
19
 
20
+ attr_accessor :price_data
21
+
21
22
  # 購入する商品の数量
22
23
  attr_accessor :quantity
23
24
 
@@ -28,6 +29,7 @@ module PAYJPv2
28
29
  def self.attribute_map
29
30
  {
30
31
  :price_id => :price_id,
32
+ :price_data => :price_data,
31
33
  :quantity => :quantity,
32
34
  :tax_rates => :tax_rates
33
35
  }
@@ -47,6 +49,7 @@ module PAYJPv2
47
49
  def self.openapi_types
48
50
  {
49
51
  :price_id => :'String',
52
+ :price_data => :'PriceDataRequest',
50
53
  :quantity => :'Integer',
51
54
  :tax_rates => :'Array<String>'
52
55
  }
@@ -55,6 +58,8 @@ module PAYJPv2
55
58
  # List of attributes with nullable: true
56
59
  def self.openapi_nullable
57
60
  Set.new([
61
+ :price_id,
62
+ :price_data,
58
63
  ])
59
64
  end
60
65
 
@@ -76,8 +81,10 @@ module PAYJPv2
76
81
 
77
82
  if attributes.key?(:price_id)
78
83
  self.price_id = attributes[:price_id]
79
- else
80
- self.price_id = nil
84
+ end
85
+
86
+ if attributes.key?(:price_data)
87
+ self.price_data = attributes[:price_data]
81
88
  end
82
89
 
83
90
  if attributes.key?(:quantity)
@@ -93,16 +100,6 @@ module PAYJPv2
93
100
  end
94
101
  end
95
102
 
96
- # Custom attribute writer method with validation
97
- # @param [Object] price_id Value to be assigned
98
- def price_id=(price_id)
99
- if price_id.nil?
100
- raise ArgumentError, 'price_id cannot be nil'
101
- end
102
-
103
- @price_id = price_id
104
- end
105
-
106
103
  # Custom attribute writer method with validation
107
104
  # @param [Object] quantity Value to be assigned
108
105
  def quantity=(quantity)
@@ -119,6 +116,7 @@ module PAYJPv2
119
116
  return true if self.equal?(o)
120
117
  self.class == o.class &&
121
118
  price_id == o.price_id &&
119
+ price_data == o.price_data &&
122
120
  quantity == o.quantity &&
123
121
  tax_rates == o.tax_rates
124
122
  end
@@ -132,7 +130,7 @@ module PAYJPv2
132
130
  # Calculates hash code according to all attributes.
133
131
  # @return [Integer] Hash code
134
132
  def hash
135
- [price_id, quantity, tax_rates].hash
133
+ [price_id, price_data, quantity, tax_rates].hash
136
134
  end
137
135
 
138
136
  # Builds the object from hash
@@ -0,0 +1,286 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PAYJPv2
17
+ class PriceDataRequest
18
+ # 通貨。現在は `jpy` のみサポートしています。
19
+ attr_accessor :currency
20
+
21
+ # 単価(0以上の整数)
22
+ attr_accessor :unit_amount
23
+
24
+ attr_accessor :product_id
25
+
26
+ attr_accessor :product_data
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :currency => :currency,
54
+ :unit_amount => :unit_amount,
55
+ :product_id => :product_id,
56
+ :product_data => :product_data
57
+ }
58
+ end
59
+
60
+ # Returns attribute mapping this model knows about
61
+ def self.acceptable_attribute_map
62
+ attribute_map
63
+ end
64
+
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ acceptable_attribute_map.values
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :currency => :'Currency',
74
+ :unit_amount => :'Integer',
75
+ :product_id => :'String',
76
+ :product_data => :'ProductDataRequest'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ :product_id,
84
+ :product_data
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::PriceDataRequest` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ acceptable_attribute_map = self.class.acceptable_attribute_map
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!acceptable_attribute_map.key?(k.to_sym))
99
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::PriceDataRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:currency)
105
+ self.currency = attributes[:currency]
106
+ else
107
+ self.currency = nil
108
+ end
109
+
110
+ if attributes.key?(:unit_amount)
111
+ self.unit_amount = attributes[:unit_amount]
112
+ else
113
+ self.unit_amount = nil
114
+ end
115
+
116
+ if attributes.key?(:product_id)
117
+ self.product_id = attributes[:product_id]
118
+ end
119
+
120
+ if attributes.key?(:product_data)
121
+ self.product_data = attributes[:product_data]
122
+ end
123
+ end
124
+
125
+ # Custom attribute writer method with validation
126
+ # @param [Object] currency Value to be assigned
127
+ def currency=(currency)
128
+ if currency.nil?
129
+ raise ArgumentError, 'currency cannot be nil'
130
+ end
131
+
132
+ @currency = currency
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] unit_amount Value to be assigned
137
+ def unit_amount=(unit_amount)
138
+ if unit_amount.nil?
139
+ raise ArgumentError, 'unit_amount cannot be nil'
140
+ end
141
+
142
+ if unit_amount < 0
143
+ raise ArgumentError, 'invalid value for "unit_amount", must be greater than or equal to 0.'
144
+ end
145
+
146
+ @unit_amount = unit_amount
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ currency == o.currency &&
155
+ unit_amount == o.unit_amount &&
156
+ product_id == o.product_id &&
157
+ product_data == o.product_data
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Integer] Hash code
168
+ def hash
169
+ [currency, unit_amount, product_id, product_data].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ attributes = attributes.transform_keys(&:to_sym)
178
+ transformed_hash = {}
179
+ openapi_types.each_pair do |key, type|
180
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = nil
182
+ elsif type =~ /\AArray<(.*)>/i
183
+ # check to ensure the input is an array given that the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[attribute_map[key]].is_a?(Array)
186
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
187
+ end
188
+ elsif !attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
190
+ end
191
+ end
192
+ new(transformed_hash)
193
+ end
194
+
195
+ # Deserializes the data based on type
196
+ # @param string type Data type
197
+ # @param string value Value to be deserialized
198
+ # @return [Object] Deserialized data
199
+ def self._deserialize(type, value)
200
+ case type.to_sym
201
+ when :Time
202
+ Time.parse(value)
203
+ when :Date
204
+ Date.parse(value)
205
+ when :String
206
+ value.to_s
207
+ when :Integer
208
+ value.to_i
209
+ when :Float
210
+ value.to_f
211
+ when :Boolean
212
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213
+ true
214
+ else
215
+ false
216
+ end
217
+ when :Object
218
+ # generic object (usually a Hash), return directly
219
+ value
220
+ when /\AArray<(?<inner_type>.+)>\z/
221
+ inner_type = Regexp.last_match[:inner_type]
222
+ value.map { |v| _deserialize(inner_type, v) }
223
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
224
+ k_type = Regexp.last_match[:k_type]
225
+ v_type = Regexp.last_match[:v_type]
226
+ {}.tap do |hash|
227
+ value.each do |k, v|
228
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229
+ end
230
+ end
231
+ else # model
232
+ # models (e.g. Pet) or oneOf
233
+ klass = PAYJPv2.const_get(type)
234
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
235
+ end
236
+ end
237
+
238
+ # Returns the string representation of the object
239
+ # @return [String] String presentation of the object
240
+ def to_s
241
+ to_hash.to_s
242
+ end
243
+
244
+ # to_body is an alias to to_hash (backward compatibility)
245
+ # @return [Hash] Returns the object in the form of hash
246
+ def to_body
247
+ to_hash
248
+ end
249
+
250
+ # Returns the object in the form of hash
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_hash
253
+ hash = {}
254
+ self.class.attribute_map.each_pair do |attr, param|
255
+ value = self.send(attr)
256
+ if value.nil?
257
+ is_nullable = self.class.openapi_nullable.include?(attr)
258
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
259
+ end
260
+
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ # Outputs non-array value in the form of hash
267
+ # For object, use to_hash. Otherwise, just return the value
268
+ # @param [Object] value Any valid value
269
+ # @return [Hash] Returns the value in the form of hash
270
+ def _to_hash(value)
271
+ if value.is_a?(Array)
272
+ value.compact.map { |v| _to_hash(v) }
273
+ elsif value.is_a?(Hash)
274
+ {}.tap do |hash|
275
+ value.each { |k, v| hash[k] = _to_hash(v) }
276
+ end
277
+ elsif value.respond_to? :to_hash
278
+ value.to_hash
279
+ else
280
+ value
281
+ end
282
+ end
283
+
284
+ end
285
+
286
+ end
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PAYJPv2
17
+ class ProductDataRequest
18
+ # Checkout などで顧客に表示される商品名
19
+ attr_accessor :name
20
+
21
+ attr_accessor :description
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :name => :name,
27
+ :description => :description
28
+ }
29
+ end
30
+
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :name => :'String',
45
+ :description => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ :description
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::ProductDataRequest` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::ProductDataRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:name)
73
+ self.name = attributes[:name]
74
+ else
75
+ self.name = nil
76
+ end
77
+
78
+ if attributes.key?(:description)
79
+ self.description = attributes[:description]
80
+ end
81
+ end
82
+
83
+ # Custom attribute writer method with validation
84
+ # @param [Object] name Value to be assigned
85
+ def name=(name)
86
+ if name.nil?
87
+ raise ArgumentError, 'name cannot be nil'
88
+ end
89
+
90
+ @name = name
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ name == o.name &&
99
+ description == o.description
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [name, description].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ attributes = attributes.transform_keys(&:to_sym)
120
+ transformed_hash = {}
121
+ openapi_types.each_pair do |key, type|
122
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
123
+ transformed_hash["#{key}"] = nil
124
+ elsif type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[attribute_map[key]].is_a?(Array)
128
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
129
+ end
130
+ elsif !attributes[attribute_map[key]].nil?
131
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
132
+ end
133
+ end
134
+ new(transformed_hash)
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def self._deserialize(type, value)
142
+ case type.to_sym
143
+ when :Time
144
+ Time.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :Boolean
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ # models (e.g. Pet) or oneOf
175
+ klass = PAYJPv2.const_get(type)
176
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ end
@@ -11,5 +11,5 @@ Generator version: 7.14.0
11
11
  =end
12
12
 
13
13
  module PAYJPv2
14
- VERSION = '1.0.11'
14
+ VERSION = '1.1.0'
15
15
  end
data/lib/payjpv2.rb CHANGED
@@ -106,11 +106,13 @@ require 'payjpv2/models/payment_transaction_list_response'
106
106
  require 'payjpv2/models/payment_transaction_response'
107
107
  require 'payjpv2/models/payment_transaction_type'
108
108
  require 'payjpv2/models/price_create_request'
109
+ require 'payjpv2/models/price_data_request'
109
110
  require 'payjpv2/models/price_details_response'
110
111
  require 'payjpv2/models/price_list_response'
111
112
  require 'payjpv2/models/price_type'
112
113
  require 'payjpv2/models/price_update_request'
113
114
  require 'payjpv2/models/product_create_request'
115
+ require 'payjpv2/models/product_data_request'
114
116
  require 'payjpv2/models/product_deleted_response'
115
117
  require 'payjpv2/models/product_details_response'
116
118
  require 'payjpv2/models/product_list_response'
@@ -33,6 +33,12 @@ describe PAYJPv2::LineItemRequest do
33
33
  end
34
34
  end
35
35
 
36
+ describe 'test attribute "price_data"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
36
42
  describe 'test attribute "quantity"' do
37
43
  it 'should work' do
38
44
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -0,0 +1,54 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for PAYJPv2::PriceDataRequest
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe PAYJPv2::PriceDataRequest do
21
+ let(:instance) { PAYJPv2::PriceDataRequest.new }
22
+
23
+ describe 'test an instance of PriceDataRequest' do
24
+ it 'should create an instance of PriceDataRequest' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(PAYJPv2::PriceDataRequest)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "currency"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "unit_amount"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ describe 'test attribute "product_id"' do
43
+ it 'should work' do
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
+ end
46
+ end
47
+
48
+ describe 'test attribute "product_data"' do
49
+ it 'should work' do
50
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for PAYJPv2::ProductDataRequest
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe PAYJPv2::ProductDataRequest do
21
+ let(:instance) { PAYJPv2::ProductDataRequest.new }
22
+
23
+ describe 'test an instance of ProductDataRequest' do
24
+ it 'should create an instance of ProductDataRequest' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(PAYJPv2::ProductDataRequest)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "name"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "description"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payjpv2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PAY.JP
@@ -164,12 +164,14 @@ files:
164
164
  - docs/PaymentTransactionType.md
165
165
  - docs/PaymentTransactionsApi.md
166
166
  - docs/PriceCreateRequest.md
167
+ - docs/PriceDataRequest.md
167
168
  - docs/PriceDetailsResponse.md
168
169
  - docs/PriceListResponse.md
169
170
  - docs/PriceType.md
170
171
  - docs/PriceUpdateRequest.md
171
172
  - docs/PricesApi.md
172
173
  - docs/ProductCreateRequest.md
174
+ - docs/ProductDataRequest.md
173
175
  - docs/ProductDeletedResponse.md
174
176
  - docs/ProductDetailsResponse.md
175
177
  - docs/ProductListResponse.md
@@ -312,11 +314,13 @@ files:
312
314
  - lib/payjpv2/models/payment_transaction_response.rb
313
315
  - lib/payjpv2/models/payment_transaction_type.rb
314
316
  - lib/payjpv2/models/price_create_request.rb
317
+ - lib/payjpv2/models/price_data_request.rb
315
318
  - lib/payjpv2/models/price_details_response.rb
316
319
  - lib/payjpv2/models/price_list_response.rb
317
320
  - lib/payjpv2/models/price_type.rb
318
321
  - lib/payjpv2/models/price_update_request.rb
319
322
  - lib/payjpv2/models/product_create_request.rb
323
+ - lib/payjpv2/models/product_data_request.rb
320
324
  - lib/payjpv2/models/product_deleted_response.rb
321
325
  - lib/payjpv2/models/product_details_response.rb
322
326
  - lib/payjpv2/models/product_list_response.rb
@@ -453,11 +457,13 @@ files:
453
457
  - spec/models/payment_transaction_response_spec.rb
454
458
  - spec/models/payment_transaction_type_spec.rb
455
459
  - spec/models/price_create_request_spec.rb
460
+ - spec/models/price_data_request_spec.rb
456
461
  - spec/models/price_details_response_spec.rb
457
462
  - spec/models/price_list_response_spec.rb
458
463
  - spec/models/price_type_spec.rb
459
464
  - spec/models/price_update_request_spec.rb
460
465
  - spec/models/product_create_request_spec.rb
466
+ - spec/models/product_data_request_spec.rb
461
467
  - spec/models/product_deleted_response_spec.rb
462
468
  - spec/models/product_details_response_spec.rb
463
469
  - spec/models/product_list_response_spec.rb
@@ -620,11 +626,13 @@ test_files:
620
626
  - spec/models/payment_transaction_response_spec.rb
621
627
  - spec/models/payment_transaction_type_spec.rb
622
628
  - spec/models/price_create_request_spec.rb
629
+ - spec/models/price_data_request_spec.rb
623
630
  - spec/models/price_details_response_spec.rb
624
631
  - spec/models/price_list_response_spec.rb
625
632
  - spec/models/price_type_spec.rb
626
633
  - spec/models/price_update_request_spec.rb
627
634
  - spec/models/product_create_request_spec.rb
635
+ - spec/models/product_data_request_spec.rb
628
636
  - spec/models/product_deleted_response_spec.rb
629
637
  - spec/models/product_details_response_spec.rb
630
638
  - spec/models/product_list_response_spec.rb