kendama 0.2.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile +5 -4
- data/Gemfile.lock +17 -18
- data/README.md +4 -4
- data/Rakefile +1 -6
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/kendama.gemspec +46 -0
- data/lib/kendama/api/v1_api.rb +1 -1
- data/lib/kendama/api_client.rb +1 -1
- data/lib/kendama/api_error.rb +1 -1
- data/lib/kendama/configuration.rb +10 -8
- data/lib/kendama/models/announcement.rb +59 -18
- data/lib/kendama/models/response_body.rb +31 -24
- data/lib/kendama/version.rb +2 -2
- data/lib/kendama.rb +1 -1
- data/openapi/root.yaml +17 -0
- data/openapi/v1/announcement.yaml +179 -0
- data/openapi/v1/diff.yaml +87 -0
- data/openapi/v1/num.yaml +66 -0
- data/openapi/v1/valid.yaml +65 -0
- data/pkg/kendama-0.1.0.gem +0 -0
- data/pkg/kendama-0.1.1.gem +0 -0
- data/pkg/kendama-0.2.0.gem +0 -0
- data/pkg/kendama-0.2.1.gem +0 -0
- data/pkg/kendama-0.2.2.gem +0 -0
- data/pkg/kendama-0.2.3.gem +0 -0
- data/pkg/kendama-1.0.0.gem +0 -0
- data/spec/api/v1_api_spec.rb +35 -3
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/announcement_spec.rb +24 -4
- data/spec/models/response_body_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- metadata +19 -10
- data/.openapi-generator/FILES +0 -18
- data/.openapi-generator/VERSION +0 -1
- data/.openapi-generator-ignore +0 -30
- data/.rspec +0 -3
- data/.rubocop.yml +0 -155
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db9e5407f8a698baa415703bf947e0d187b9cdacaec0084f00a3871eec6cfff5
|
4
|
+
data.tar.gz: 2392913c34823811597d0203c84150874e5773f49919457499242896a5c55967
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fe936629d4dc33f3980fa7886834a321577fa80525541908db715b090f5e98fd4f1b2a6c05acbc21fd96f628d2168931f3d14194f1eb41640178a51a68347cd
|
7
|
+
data.tar.gz: 7e32fe4cb8340a329acd8a683b1677cfaabfd66824fa1d4155d1a935b3ebf88162f40ccb0983e48afee8a80a2b00dd031385cdbd50ba40d385232a7f90c466c8
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kendama (0.
|
4
|
+
kendama (1.0.0)
|
5
5
|
typhoeus (~> 1.0, >= 1.0.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -14,21 +14,23 @@ GEM
|
|
14
14
|
ethon (0.16.0)
|
15
15
|
ffi (>= 1.15.0)
|
16
16
|
ffi (1.15.5)
|
17
|
-
|
17
|
+
jaro_winkler (1.5.6)
|
18
18
|
method_source (1.0.0)
|
19
19
|
parallel (1.23.0)
|
20
|
-
parser (3.2.2.
|
20
|
+
parser (3.2.2.3)
|
21
21
|
ast (~> 2.4.1)
|
22
|
+
racc
|
22
23
|
pry (0.14.2)
|
23
24
|
coderay (~> 1.1)
|
24
25
|
method_source (~> 1.0)
|
25
26
|
pry-byebug (3.10.1)
|
26
27
|
byebug (~> 11.0)
|
27
28
|
pry (>= 0.13, < 0.15)
|
29
|
+
psych (5.1.0)
|
30
|
+
stringio
|
31
|
+
racc (1.7.1)
|
28
32
|
rainbow (3.1.1)
|
29
33
|
rake (13.0.6)
|
30
|
-
regexp_parser (2.8.0)
|
31
|
-
rexml (3.2.5)
|
32
34
|
rspec (3.12.0)
|
33
35
|
rspec-core (~> 3.12.0)
|
34
36
|
rspec-expectations (~> 3.12.0)
|
@@ -42,22 +44,19 @@ GEM
|
|
42
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
45
|
rspec-support (~> 3.12.0)
|
44
46
|
rspec-support (3.12.0)
|
45
|
-
rubocop (
|
46
|
-
|
47
|
+
rubocop (0.66.0)
|
48
|
+
jaro_winkler (~> 1.5.1)
|
47
49
|
parallel (~> 1.10)
|
48
|
-
parser (>=
|
50
|
+
parser (>= 2.5, != 2.5.1.1)
|
51
|
+
psych (>= 3.1.0)
|
49
52
|
rainbow (>= 2.2.2, < 4.0)
|
50
|
-
regexp_parser (>= 1.8, < 3.0)
|
51
|
-
rexml (>= 3.2.5, < 4.0)
|
52
|
-
rubocop-ast (>= 1.28.0, < 2.0)
|
53
53
|
ruby-progressbar (~> 1.7)
|
54
|
-
unicode-display_width (>=
|
55
|
-
rubocop-ast (1.28.1)
|
56
|
-
parser (>= 3.2.1.0)
|
54
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
57
55
|
ruby-progressbar (1.13.0)
|
56
|
+
stringio (3.0.8)
|
58
57
|
typhoeus (1.4.0)
|
59
58
|
ethon (>= 0.9.0)
|
60
|
-
unicode-display_width (
|
59
|
+
unicode-display_width (1.5.0)
|
61
60
|
|
62
61
|
PLATFORMS
|
63
62
|
x86_64-darwin-22
|
@@ -66,9 +65,9 @@ PLATFORMS
|
|
66
65
|
DEPENDENCIES
|
67
66
|
kendama!
|
68
67
|
pry-byebug
|
69
|
-
rake (~> 13.0)
|
70
|
-
rspec (~> 3.0)
|
71
|
-
rubocop (~>
|
68
|
+
rake (~> 13.0.1)
|
69
|
+
rspec (~> 3.6, >= 3.6.0)
|
70
|
+
rubocop (~> 0.66.0)
|
72
71
|
|
73
72
|
BUNDLED WITH
|
74
73
|
2.4.12
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Kendama - the Ruby gem for the 国税庁API
|
|
7
7
|
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
8
8
|
|
9
9
|
- API version: 1.0.0
|
10
|
-
- Package version: 0.
|
10
|
+
- Package version: 1.0.0
|
11
11
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
13
|
## Installation
|
@@ -23,16 +23,16 @@ gem build kendama.gemspec
|
|
23
23
|
Then either install the gem locally:
|
24
24
|
|
25
25
|
```shell
|
26
|
-
gem install ./kendama-0.
|
26
|
+
gem install ./kendama-1.0.0.gem
|
27
27
|
```
|
28
28
|
|
29
|
-
(for development, run `gem install --dev ./kendama-0.
|
29
|
+
(for development, run `gem install --dev ./kendama-1.0.0.gem` to install the development dependencies)
|
30
30
|
|
31
31
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
32
32
|
|
33
33
|
Finally add this to the Gemfile:
|
34
34
|
|
35
|
-
gem 'kendama', '~> 0.
|
35
|
+
gem 'kendama', '~> 1.0.0'
|
36
36
|
|
37
37
|
### Install from Git
|
38
38
|
|
data/Rakefile
CHANGED
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "kendama"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
require "irb"
|
11
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/kendama.gemspec
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
=begin
|
4
|
+
#国税庁API
|
5
|
+
|
6
|
+
#国税庁が提供するインボイス制度適格請求書発行事業者公表システムWeb-APIを使用するためのクライアントAPI(https://www.invoice-kohyo.nta.go.jp/web-api/index.html)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
9
|
+
|
10
|
+
Generated by: https://openapi-generator.tech
|
11
|
+
OpenAPI Generator version: 7.0.0
|
12
|
+
|
13
|
+
=end
|
14
|
+
|
15
|
+
$:.push File.expand_path("../lib", __FILE__)
|
16
|
+
require "kendama/version"
|
17
|
+
|
18
|
+
Gem::Specification.new do |s|
|
19
|
+
s.name = "kendama"
|
20
|
+
s.version = Kendama::VERSION
|
21
|
+
s.platform = Gem::Platform::RUBY
|
22
|
+
s.authors = ["uichi"]
|
23
|
+
s.email = ["37263474+uichi@users.noreply.github.com"]
|
24
|
+
s.homepage = "https://rubygems.org/gems/kendama"
|
25
|
+
s.summary = "適格請求書発行事業者公表システムWeb-APIのラッパー"
|
26
|
+
s.description = "国税庁が提供するインボイス制度適格請求書発行事業者公表システムWeb-APIを使用するためのRuby向けラッパーです。"
|
27
|
+
s.license = "MIT"
|
28
|
+
s.required_ruby_version = ">= 2.7"
|
29
|
+
|
30
|
+
# s.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
31
|
+
|
32
|
+
s.metadata["homepage_uri"] = s.homepage
|
33
|
+
s.metadata["source_code_uri"] = "https://github.com/uichi/kendama"
|
34
|
+
s.metadata["changelog_uri"] = "https://github.com/uichi/kendama/blob/main/CHANGELOG.md"
|
35
|
+
|
36
|
+
s.required_ruby_version = ">= 2.7"
|
37
|
+
|
38
|
+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
39
|
+
|
40
|
+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
41
|
+
|
42
|
+
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
|
43
|
+
s.test_files = `find spec/*`.split("\n")
|
44
|
+
s.executables = []
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
end
|
data/lib/kendama/api/v1_api.rb
CHANGED
data/lib/kendama/api_client.rb
CHANGED
data/lib/kendama/api_error.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -152,7 +152,7 @@ module Kendama
|
|
152
152
|
@scheme = 'https'
|
153
153
|
@host = 'kensyo.invoice-kohyo.nta.go.jp'
|
154
154
|
@base_path = ''
|
155
|
-
@server_index =
|
155
|
+
@server_index = nil
|
156
156
|
@server_operation_index = {}
|
157
157
|
@server_variables = {}
|
158
158
|
@server_operation_variables = {}
|
@@ -200,10 +200,12 @@ module Kendama
|
|
200
200
|
|
201
201
|
# Returns base URL for specified operation based on server settings
|
202
202
|
def base_url(operation = nil)
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
203
|
+
if operation_server_settings.key?(operation) then
|
204
|
+
index = server_operation_index.fetch(operation, server_index)
|
205
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
206
|
+
else
|
207
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
208
|
+
end
|
207
209
|
end
|
208
210
|
|
209
211
|
# Gets API key (with prefix if set).
|
@@ -262,8 +264,8 @@ module Kendama
|
|
262
264
|
servers = server_settings if servers == nil
|
263
265
|
|
264
266
|
# check array index out of bound
|
265
|
-
if (index < 0 || index >= servers.size)
|
266
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
267
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
268
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
267
269
|
end
|
268
270
|
|
269
271
|
server = servers[index]
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -197,82 +197,122 @@ module Kendama
|
|
197
197
|
|
198
198
|
if attributes.key?(:'sequence_number')
|
199
199
|
self.sequence_number = attributes[:'sequence_number']
|
200
|
+
else
|
201
|
+
self.sequence_number = nil
|
200
202
|
end
|
201
203
|
|
202
204
|
if attributes.key?(:'registrated_number')
|
203
205
|
self.registrated_number = attributes[:'registrated_number']
|
206
|
+
else
|
207
|
+
self.registrated_number = nil
|
204
208
|
end
|
205
209
|
|
206
210
|
if attributes.key?(:'process')
|
207
211
|
self.process = attributes[:'process']
|
212
|
+
else
|
213
|
+
self.process = nil
|
208
214
|
end
|
209
215
|
|
210
216
|
if attributes.key?(:'correct')
|
211
217
|
self.correct = attributes[:'correct']
|
218
|
+
else
|
219
|
+
self.correct = nil
|
212
220
|
end
|
213
221
|
|
214
222
|
if attributes.key?(:'kind')
|
215
223
|
self.kind = attributes[:'kind']
|
224
|
+
else
|
225
|
+
self.kind = nil
|
216
226
|
end
|
217
227
|
|
218
228
|
if attributes.key?(:'country')
|
219
229
|
self.country = attributes[:'country']
|
230
|
+
else
|
231
|
+
self.country = nil
|
220
232
|
end
|
221
233
|
|
222
234
|
if attributes.key?(:'latest')
|
223
235
|
self.latest = attributes[:'latest']
|
236
|
+
else
|
237
|
+
self.latest = nil
|
224
238
|
end
|
225
239
|
|
226
240
|
if attributes.key?(:'registration_date')
|
227
241
|
self.registration_date = attributes[:'registration_date']
|
242
|
+
else
|
243
|
+
self.registration_date = nil
|
228
244
|
end
|
229
245
|
|
230
246
|
if attributes.key?(:'update_date')
|
231
247
|
self.update_date = attributes[:'update_date']
|
248
|
+
else
|
249
|
+
self.update_date = nil
|
232
250
|
end
|
233
251
|
|
234
252
|
if attributes.key?(:'disposal_date')
|
235
253
|
self.disposal_date = attributes[:'disposal_date']
|
254
|
+
else
|
255
|
+
self.disposal_date = nil
|
236
256
|
end
|
237
257
|
|
238
258
|
if attributes.key?(:'expire_date')
|
239
259
|
self.expire_date = attributes[:'expire_date']
|
260
|
+
else
|
261
|
+
self.expire_date = nil
|
240
262
|
end
|
241
263
|
|
242
264
|
if attributes.key?(:'address')
|
243
265
|
self.address = attributes[:'address']
|
266
|
+
else
|
267
|
+
self.address = nil
|
244
268
|
end
|
245
269
|
|
246
270
|
if attributes.key?(:'address_prefecture_code')
|
247
271
|
self.address_prefecture_code = attributes[:'address_prefecture_code']
|
272
|
+
else
|
273
|
+
self.address_prefecture_code = nil
|
248
274
|
end
|
249
275
|
|
250
276
|
if attributes.key?(:'address_city_code')
|
251
277
|
self.address_city_code = attributes[:'address_city_code']
|
278
|
+
else
|
279
|
+
self.address_city_code = nil
|
252
280
|
end
|
253
281
|
|
254
282
|
if attributes.key?(:'address_request')
|
255
283
|
self.address_request = attributes[:'address_request']
|
284
|
+
else
|
285
|
+
self.address_request = nil
|
256
286
|
end
|
257
287
|
|
258
288
|
if attributes.key?(:'address_request_prefecture_code')
|
259
289
|
self.address_request_prefecture_code = attributes[:'address_request_prefecture_code']
|
290
|
+
else
|
291
|
+
self.address_request_prefecture_code = nil
|
260
292
|
end
|
261
293
|
|
262
294
|
if attributes.key?(:'address_request_city_code')
|
263
295
|
self.address_request_city_code = attributes[:'address_request_city_code']
|
296
|
+
else
|
297
|
+
self.address_request_city_code = nil
|
264
298
|
end
|
265
299
|
|
266
300
|
if attributes.key?(:'kana')
|
267
301
|
self.kana = attributes[:'kana']
|
302
|
+
else
|
303
|
+
self.kana = nil
|
268
304
|
end
|
269
305
|
|
270
306
|
if attributes.key?(:'name')
|
271
307
|
self.name = attributes[:'name']
|
308
|
+
else
|
309
|
+
self.name = nil
|
272
310
|
end
|
273
311
|
|
274
312
|
if attributes.key?(:'address_inside')
|
275
313
|
self.address_inside = attributes[:'address_inside']
|
314
|
+
else
|
315
|
+
self.address_inside = nil
|
276
316
|
end
|
277
317
|
|
278
318
|
if attributes.key?(:'address_inside_prefecture_code')
|
@@ -281,20 +321,27 @@ module Kendama
|
|
281
321
|
|
282
322
|
if attributes.key?(:'address_inside_city_code')
|
283
323
|
self.address_inside_city_code = attributes[:'address_inside_city_code']
|
324
|
+
else
|
325
|
+
self.address_inside_city_code = nil
|
284
326
|
end
|
285
327
|
|
286
328
|
if attributes.key?(:'trade_name')
|
287
329
|
self.trade_name = attributes[:'trade_name']
|
330
|
+
else
|
331
|
+
self.trade_name = nil
|
288
332
|
end
|
289
333
|
|
290
334
|
if attributes.key?(:'popular_name_previous_name')
|
291
335
|
self.popular_name_previous_name = attributes[:'popular_name_previous_name']
|
336
|
+
else
|
337
|
+
self.popular_name_previous_name = nil
|
292
338
|
end
|
293
339
|
end
|
294
340
|
|
295
341
|
# Show invalid properties with the reasons. Usually used together with valid?
|
296
342
|
# @return Array for valid properties with the reasons
|
297
343
|
def list_invalid_properties
|
344
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
298
345
|
invalid_properties = Array.new
|
299
346
|
if @sequence_number.nil?
|
300
347
|
invalid_properties.push('invalid value for "sequence_number", sequence_number cannot be nil.')
|
@@ -430,6 +477,7 @@ module Kendama
|
|
430
477
|
# Check to see if the all the properties in the model are valid
|
431
478
|
# @return true if the model is valid
|
432
479
|
def valid?
|
480
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
433
481
|
return false if @sequence_number.nil?
|
434
482
|
return false if @sequence_number.to_s.length > 8
|
435
483
|
return false if @sequence_number.to_s.length < 1
|
@@ -688,37 +736,30 @@ module Kendama
|
|
688
736
|
# @param [Hash] attributes Model attributes in the form of hash
|
689
737
|
# @return [Object] Returns the model itself
|
690
738
|
def self.build_from_hash(attributes)
|
691
|
-
new.build_from_hash(attributes)
|
692
|
-
end
|
693
|
-
|
694
|
-
# Builds the object from hash
|
695
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
696
|
-
# @return [Object] Returns the model itself
|
697
|
-
def build_from_hash(attributes)
|
698
739
|
return nil unless attributes.is_a?(Hash)
|
699
740
|
attributes = attributes.transform_keys(&:to_sym)
|
700
|
-
|
701
|
-
|
702
|
-
|
741
|
+
transformed_hash = {}
|
742
|
+
openapi_types.each_pair do |key, type|
|
743
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
744
|
+
transformed_hash["#{key}"] = nil
|
703
745
|
elsif type =~ /\AArray<(.*)>/i
|
704
746
|
# check to ensure the input is an array given that the attribute
|
705
747
|
# is documented as an array but the input is not
|
706
|
-
if attributes[
|
707
|
-
|
748
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
749
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
708
750
|
end
|
709
|
-
elsif !attributes[
|
710
|
-
|
751
|
+
elsif !attributes[attribute_map[key]].nil?
|
752
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
711
753
|
end
|
712
754
|
end
|
713
|
-
|
714
|
-
self
|
755
|
+
new(transformed_hash)
|
715
756
|
end
|
716
757
|
|
717
758
|
# Deserializes the data based on type
|
718
759
|
# @param string type Data type
|
719
760
|
# @param string value Value to be deserialized
|
720
761
|
# @return [Object] Deserialized data
|
721
|
-
def _deserialize(type, value)
|
762
|
+
def self._deserialize(type, value)
|
722
763
|
case type.to_sym
|
723
764
|
when :Time
|
724
765
|
Time.parse(value)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -103,6 +103,7 @@ module Kendama
|
|
103
103
|
# Show invalid properties with the reasons. Usually used together with valid?
|
104
104
|
# @return Array for valid properties with the reasons
|
105
105
|
def list_invalid_properties
|
106
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
106
107
|
invalid_properties = Array.new
|
107
108
|
if !@count.nil? && @count.to_s.length > 8
|
108
109
|
invalid_properties.push('invalid value for "count", the character length must be smaller than or equal to 8.')
|
@@ -134,6 +135,7 @@ module Kendama
|
|
134
135
|
# Check to see if the all the properties in the model are valid
|
135
136
|
# @return true if the model is valid
|
136
137
|
def valid?
|
138
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
137
139
|
return false if !@count.nil? && @count.to_s.length > 8
|
138
140
|
return false if !@count.nil? && @count.to_s.length < 1
|
139
141
|
return false if !@divide_number.nil? && @divide_number.to_s.length > 6
|
@@ -146,11 +148,15 @@ module Kendama
|
|
146
148
|
# Custom attribute writer method with validation
|
147
149
|
# @param [Object] count Value to be assigned
|
148
150
|
def count=(count)
|
149
|
-
if
|
151
|
+
if count.nil?
|
152
|
+
fail ArgumentError, 'count cannot be nil'
|
153
|
+
end
|
154
|
+
|
155
|
+
if count.to_s.length > 8
|
150
156
|
fail ArgumentError, 'invalid value for "count", the character length must be smaller than or equal to 8.'
|
151
157
|
end
|
152
158
|
|
153
|
-
if
|
159
|
+
if count.to_s.length < 1
|
154
160
|
fail ArgumentError, 'invalid value for "count", the character length must be great than or equal to 1.'
|
155
161
|
end
|
156
162
|
|
@@ -160,11 +166,15 @@ module Kendama
|
|
160
166
|
# Custom attribute writer method with validation
|
161
167
|
# @param [Object] divide_number Value to be assigned
|
162
168
|
def divide_number=(divide_number)
|
163
|
-
if
|
169
|
+
if divide_number.nil?
|
170
|
+
fail ArgumentError, 'divide_number cannot be nil'
|
171
|
+
end
|
172
|
+
|
173
|
+
if divide_number.to_s.length > 6
|
164
174
|
fail ArgumentError, 'invalid value for "divide_number", the character length must be smaller than or equal to 6.'
|
165
175
|
end
|
166
176
|
|
167
|
-
if
|
177
|
+
if divide_number.to_s.length < 1
|
168
178
|
fail ArgumentError, 'invalid value for "divide_number", the character length must be great than or equal to 1.'
|
169
179
|
end
|
170
180
|
|
@@ -174,11 +184,15 @@ module Kendama
|
|
174
184
|
# Custom attribute writer method with validation
|
175
185
|
# @param [Object] divide_size Value to be assigned
|
176
186
|
def divide_size=(divide_size)
|
177
|
-
if
|
187
|
+
if divide_size.nil?
|
188
|
+
fail ArgumentError, 'divide_size cannot be nil'
|
189
|
+
end
|
190
|
+
|
191
|
+
if divide_size.to_s.length > 6
|
178
192
|
fail ArgumentError, 'invalid value for "divide_size", the character length must be smaller than or equal to 6.'
|
179
193
|
end
|
180
194
|
|
181
|
-
if
|
195
|
+
if divide_size.to_s.length < 1
|
182
196
|
fail ArgumentError, 'invalid value for "divide_size", the character length must be great than or equal to 1.'
|
183
197
|
end
|
184
198
|
|
@@ -213,37 +227,30 @@ module Kendama
|
|
213
227
|
# @param [Hash] attributes Model attributes in the form of hash
|
214
228
|
# @return [Object] Returns the model itself
|
215
229
|
def self.build_from_hash(attributes)
|
216
|
-
new.build_from_hash(attributes)
|
217
|
-
end
|
218
|
-
|
219
|
-
# Builds the object from hash
|
220
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
221
|
-
# @return [Object] Returns the model itself
|
222
|
-
def build_from_hash(attributes)
|
223
230
|
return nil unless attributes.is_a?(Hash)
|
224
231
|
attributes = attributes.transform_keys(&:to_sym)
|
225
|
-
|
226
|
-
|
227
|
-
|
232
|
+
transformed_hash = {}
|
233
|
+
openapi_types.each_pair do |key, type|
|
234
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
235
|
+
transformed_hash["#{key}"] = nil
|
228
236
|
elsif type =~ /\AArray<(.*)>/i
|
229
237
|
# check to ensure the input is an array given that the attribute
|
230
238
|
# is documented as an array but the input is not
|
231
|
-
if attributes[
|
232
|
-
|
239
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
240
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
233
241
|
end
|
234
|
-
elsif !attributes[
|
235
|
-
|
242
|
+
elsif !attributes[attribute_map[key]].nil?
|
243
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
236
244
|
end
|
237
245
|
end
|
238
|
-
|
239
|
-
self
|
246
|
+
new(transformed_hash)
|
240
247
|
end
|
241
248
|
|
242
249
|
# Deserializes the data based on type
|
243
250
|
# @param string type Data type
|
244
251
|
# @param string value Value to be deserialized
|
245
252
|
# @return [Object] Deserialized data
|
246
|
-
def _deserialize(type, value)
|
253
|
+
def self._deserialize(type, value)
|
247
254
|
case type.to_sym
|
248
255
|
when :Time
|
249
256
|
Time.parse(value)
|
data/lib/kendama/version.rb
CHANGED