gbizinfo 0.2.1 → 0.2.2

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CODE_OF_CONDUCT.md +12 -12
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +32 -25
  5. data/LICENSE.txt +1 -1
  6. data/README.md +8 -7
  7. data/docs/ApiErrorResponse.md +20 -0
  8. data/docs/HojinInfoResponse.md +1 -1
  9. data/docs/HojinInfoUpdateInfoResponse.md +1 -1
  10. data/gbizinfo.gemspec +4 -4
  11. data/git_push.sh +1 -1
  12. data/lib/gbizinfo/api/g_biz_inforestapi_api.rb +18 -18
  13. data/lib/gbizinfo/api/g_biz_inforestapi_period_specified_search_api.rb +9 -9
  14. data/lib/gbizinfo/api_client.rb +29 -24
  15. data/lib/gbizinfo/api_error.rb +1 -1
  16. data/lib/gbizinfo/api_model_base.rb +88 -0
  17. data/lib/gbizinfo/configuration.rb +14 -3
  18. data/lib/gbizinfo/models/{api_error.rb → api_error_response.rb} +12 -79
  19. data/lib/gbizinfo/models/certification_info.rb +11 -78
  20. data/lib/gbizinfo/models/commendation_info.rb +11 -78
  21. data/lib/gbizinfo/models/compatibility_of_childcare_and_work.rb +11 -78
  22. data/lib/gbizinfo/models/finance.rb +11 -78
  23. data/lib/gbizinfo/models/hojin_info.rb +11 -78
  24. data/lib/gbizinfo/models/hojin_info_response.rb +12 -79
  25. data/lib/gbizinfo/models/hojin_info_update_info_response.rb +12 -79
  26. data/lib/gbizinfo/models/major_shareholders.rb +11 -78
  27. data/lib/gbizinfo/models/management_index.rb +11 -78
  28. data/lib/gbizinfo/models/patent_info.rb +11 -78
  29. data/lib/gbizinfo/models/procurement_info.rb +11 -78
  30. data/lib/gbizinfo/models/subsidy_info.rb +11 -78
  31. data/lib/gbizinfo/models/women_activity_infos.rb +11 -78
  32. data/lib/gbizinfo/models/workplace_base_infos.rb +11 -78
  33. data/lib/gbizinfo/models/workplace_info_bean.rb +11 -78
  34. data/lib/gbizinfo/version.rb +2 -2
  35. data/lib/gbizinfo.rb +3 -2
  36. data/openapi/root.yaml +5 -5
  37. data/pkg/gbizinfo-0.2.2.gem +0 -0
  38. data/spec/models/api_error_response_spec.rb +42 -0
  39. data/spec/spec_helper.rb +1 -1
  40. metadata +12 -10
  41. data/pkg/gbizinfo-0.1.0.gem +0 -0
  42. data/pkg/gbizinfo-0.2.0.gem +0 -0
  43. data/pkg/gbizinfo-0.2.1.gem +0 -0
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -17,6 +17,7 @@ require 'tempfile'
17
17
  require 'time'
18
18
  require 'typhoeus'
19
19
 
20
+
20
21
  module Gbizinfo
21
22
  class ApiClient
22
23
  # The Configuration object holding settings to be used in the API client.
@@ -45,9 +46,11 @@ module Gbizinfo
45
46
  # Call an API with given options.
46
47
  #
47
48
  # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
48
- # the data deserialized from response body (could be nil), response status code and response headers.
49
+ # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
49
50
  def call_api(http_method, path, opts = {})
50
51
  request = build_request(http_method, path, opts)
52
+ tempfile = nil
53
+ (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
51
54
  response = request.run
52
55
 
53
56
  if @config.debugging
@@ -69,7 +72,9 @@ module Gbizinfo
69
72
  end
70
73
  end
71
74
 
72
- if opts[:return_type]
75
+ if opts[:return_type] == 'File'
76
+ data = tempfile
77
+ elsif opts[:return_type]
73
78
  data = deserialize(response, opts[:return_type])
74
79
  else
75
80
  data = nil
@@ -124,9 +129,7 @@ module Gbizinfo
124
129
  end
125
130
  end
126
131
 
127
- request = Typhoeus::Request.new(url, req_opts)
128
- download_file(request) if opts[:return_type] == 'File'
129
- request
132
+ Typhoeus::Request.new(url, req_opts)
130
133
  end
131
134
 
132
135
  # Builds the HTTP request body
@@ -164,6 +167,8 @@ module Gbizinfo
164
167
  # process can use.
165
168
  #
166
169
  # @see Configuration#temp_folder_path
170
+ #
171
+ # @return [Tempfile] the tempfile generated
167
172
  def download_file(request)
168
173
  tempfile = nil
169
174
  encoding = nil
@@ -178,20 +183,21 @@ module Gbizinfo
178
183
  prefix = prefix + '-' unless prefix.end_with?('-')
179
184
  encoding = response.body.encoding
180
185
  tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
181
- @tempfile = tempfile
182
186
  end
183
187
  request.on_body do |chunk|
184
188
  chunk.force_encoding(encoding)
185
189
  tempfile.write(chunk)
186
190
  end
187
- request.on_complete do |response|
188
- if tempfile
189
- tempfile.close
190
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
191
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
192
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
193
- "explicitly with `tempfile.delete`"
191
+ request.on_complete do
192
+ if !tempfile
193
+ fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
194
194
  end
195
+ tempfile.close
196
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
197
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
198
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
199
+ "explicitly with `tempfile.delete`"
200
+ yield tempfile if block_given?
195
201
  end
196
202
  end
197
203
 
@@ -204,7 +210,7 @@ module Gbizinfo
204
210
  # @param [String] mime MIME
205
211
  # @return [Boolean] True if the MIME is application/json
206
212
  def json_mime?(mime)
207
- (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
213
+ (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
208
214
  end
209
215
 
210
216
  # Deserialize the response to the given return type.
@@ -213,15 +219,10 @@ module Gbizinfo
213
219
  # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
214
220
  def deserialize(response, return_type)
215
221
  body = response.body
216
-
217
- # handle file downloading - return the File instance processed in request callbacks
218
- # note that response body is empty when the file is written in chunks in request on_body callback
219
- return @tempfile if return_type == 'File'
220
-
221
222
  return nil if body.nil? || body.empty?
222
223
 
223
224
  # return response body directly for String return type
224
- return body if return_type == 'String'
225
+ return body.to_s if return_type == 'String'
225
226
 
226
227
  # ensuring a default content type
227
228
  content_type = response.headers['Content-Type'] || 'application/json'
@@ -276,9 +277,13 @@ module Gbizinfo
276
277
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
277
278
  end
278
279
  else
279
- # models (e.g. Pet) or oneOf
280
+ # models (e.g. Pet) or oneOf/anyOf
280
281
  klass = Gbizinfo.const_get(return_type)
281
- klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
282
+ if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of)
283
+ klass.build(data)
284
+ else
285
+ klass.build_from_hash(data)
286
+ end
282
287
  end
283
288
  end
284
289
 
@@ -288,7 +293,7 @@ module Gbizinfo
288
293
  # @param [String] filename the filename to be sanitized
289
294
  # @return [String] the sanitized filename
290
295
  def sanitize_filename(filename)
291
- filename.gsub(/.*[\/\\]/, '')
296
+ filename.split(/[\/\\]/).last
292
297
  end
293
298
 
294
299
  def build_request_url(path, opts = {})
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,88 @@
1
+ =begin
2
+ #gBizINFO REST API
3
+
4
+ #<div>各REST APIはHTTPリクエストヘッダX-hojinInfo-api-tokenに動作確認用のAPIトークンDTcLxzo1lZaUYaQPVdSRxdS4MzlXNCs4を指定して動作を確認することができます。</div><div>※動作確認用のAPIトークンはこのページでの動作確認でのみ使用してください。</div><div>※REST APIを利用する際は必ず、<a href='https://info.gbiz.go.jp/hojin/api_registration/form'>Web API利用申請</a>を行い、APIトークンを取得してください。</div>
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ module Gbizinfo
14
+ class ApiModelBase
15
+ # Deserializes the data based on type
16
+ # @param string type Data type
17
+ # @param string value Value to be deserialized
18
+ # @return [Object] Deserialized data
19
+ def self._deserialize(type, value)
20
+ case type.to_sym
21
+ when :Time
22
+ Time.parse(value)
23
+ when :Date
24
+ Date.parse(value)
25
+ when :String
26
+ value.to_s
27
+ when :Integer
28
+ value.to_i
29
+ when :Float
30
+ value.to_f
31
+ when :Boolean
32
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
33
+ true
34
+ else
35
+ false
36
+ end
37
+ when :Object
38
+ # generic object (usually a Hash), return directly
39
+ value
40
+ when /\AArray<(?<inner_type>.+)>\z/
41
+ inner_type = Regexp.last_match[:inner_type]
42
+ value.map { |v| _deserialize(inner_type, v) }
43
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
44
+ k_type = Regexp.last_match[:k_type]
45
+ v_type = Regexp.last_match[:v_type]
46
+ {}.tap do |hash|
47
+ value.each do |k, v|
48
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
49
+ end
50
+ end
51
+ else # model
52
+ # models (e.g. Pet) or oneOf
53
+ klass = Gbizinfo.const_get(type)
54
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
55
+ end
56
+ end
57
+
58
+ # Returns the string representation of the object
59
+ # @return [String] String presentation of the object
60
+ def to_s
61
+ to_hash.to_s
62
+ end
63
+
64
+ # to_body is an alias to to_hash (backward compatibility)
65
+ # @return [Hash] Returns the object in the form of hash
66
+ def to_body
67
+ to_hash
68
+ end
69
+
70
+ # Outputs non-array value in the form of hash
71
+ # For object, use to_hash. Otherwise, just return the value
72
+ # @param [Object] value Any valid value
73
+ # @return [Hash] Returns the value in the form of hash
74
+ def _to_hash(value)
75
+ if value.is_a?(Array)
76
+ value.compact.map { |v| _to_hash(v) }
77
+ elsif value.is_a?(Hash)
78
+ {}.tap do |hash|
79
+ value.each { |k, v| hash[k] = _to_hash(v) }
80
+ end
81
+ elsif value.respond_to? :to_hash
82
+ value.to_hash
83
+ else
84
+ value
85
+ end
86
+ end
87
+ end
88
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -79,6 +79,14 @@ module Gbizinfo
79
79
  # @return [true, false]
80
80
  attr_accessor :debugging
81
81
 
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
82
90
  # Defines the logger used for debugging.
83
91
  # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
84
92
  #
@@ -166,6 +174,7 @@ module Gbizinfo
166
174
  @timeout = 0
167
175
  @params_encoding = nil
168
176
  @debugging = false
177
+ @ignore_operation_servers = false
169
178
  @inject_format = false
170
179
  @force_ending_format = false
171
180
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
@@ -200,6 +209,7 @@ module Gbizinfo
200
209
 
201
210
  # Returns base URL for specified operation based on server settings
202
211
  def base_url(operation = nil)
212
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
203
213
  if operation_server_settings.key?(operation) then
204
214
  index = server_operation_index.fetch(operation, server_index)
205
215
  server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
@@ -222,8 +232,8 @@ module Gbizinfo
222
232
 
223
233
  # Gets access_token using access_token_getter or uses the static access_token
224
234
  def access_token_with_refresh
225
- return access_token if access_token_getter.nil?
226
- access_token_getter.call
235
+ return access_token if access_token_getter.nil?
236
+ access_token_getter.call
227
237
  end
228
238
 
229
239
  # Gets Basic Auth token string
@@ -286,5 +296,6 @@ module Gbizinfo
286
296
  url
287
297
  end
288
298
 
299
+
289
300
  end
290
301
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Gbizinfo
17
- class ApiError
17
+ class ApiErrorResponse < ApiModelBase
18
18
  # エラー箇所(項目)
19
19
  attr_accessor :item
20
20
 
@@ -29,9 +29,14 @@ module Gbizinfo
29
29
  }
30
30
  end
31
31
 
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
32
37
  # Returns all the JSON keys this model knows about
33
38
  def self.acceptable_attributes
34
- attribute_map.values
39
+ acceptable_attribute_map.values
35
40
  end
36
41
 
37
42
  # Attribute type mapping.
@@ -52,13 +57,14 @@ module Gbizinfo
52
57
  # @param [Hash] attributes Model attributes in the form of hash
53
58
  def initialize(attributes = {})
54
59
  if (!attributes.is_a?(Hash))
55
- fail ArgumentError, "The input argument (attributes) must be a hash in `Gbizinfo::ApiError` initialize method"
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Gbizinfo::ApiErrorResponse` initialize method"
56
61
  end
57
62
 
58
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
59
65
  attributes = attributes.each_with_object({}) { |(k, v), h|
60
- if (!self.class.attribute_map.key?(k.to_sym))
61
- fail ArgumentError, "`#{k}` is not a valid attribute in `Gbizinfo::ApiError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Gbizinfo::ApiErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
68
  end
63
69
  h[k.to_sym] = v
64
70
  }
@@ -131,61 +137,6 @@ module Gbizinfo
131
137
  new(transformed_hash)
132
138
  end
133
139
 
134
- # Deserializes the data based on type
135
- # @param string type Data type
136
- # @param string value Value to be deserialized
137
- # @return [Object] Deserialized data
138
- def self._deserialize(type, value)
139
- case type.to_sym
140
- when :Time
141
- Time.parse(value)
142
- when :Date
143
- Date.parse(value)
144
- when :String
145
- value.to_s
146
- when :Integer
147
- value.to_i
148
- when :Float
149
- value.to_f
150
- when :Boolean
151
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
- true
153
- else
154
- false
155
- end
156
- when :Object
157
- # generic object (usually a Hash), return directly
158
- value
159
- when /\AArray<(?<inner_type>.+)>\z/
160
- inner_type = Regexp.last_match[:inner_type]
161
- value.map { |v| _deserialize(inner_type, v) }
162
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
- k_type = Regexp.last_match[:k_type]
164
- v_type = Regexp.last_match[:v_type]
165
- {}.tap do |hash|
166
- value.each do |k, v|
167
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
- end
169
- end
170
- else # model
171
- # models (e.g. Pet) or oneOf
172
- klass = Gbizinfo.const_get(type)
173
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
- end
175
- end
176
-
177
- # Returns the string representation of the object
178
- # @return [String] String presentation of the object
179
- def to_s
180
- to_hash.to_s
181
- end
182
-
183
- # to_body is an alias to to_hash (backward compatibility)
184
- # @return [Hash] Returns the object in the form of hash
185
- def to_body
186
- to_hash
187
- end
188
-
189
140
  # Returns the object in the form of hash
190
141
  # @return [Hash] Returns the object in the form of hash
191
142
  def to_hash
@@ -202,24 +153,6 @@ module Gbizinfo
202
153
  hash
203
154
  end
204
155
 
205
- # Outputs non-array value in the form of hash
206
- # For object, use to_hash. Otherwise, just return the value
207
- # @param [Object] value Any valid value
208
- # @return [Hash] Returns the value in the form of hash
209
- def _to_hash(value)
210
- if value.is_a?(Array)
211
- value.compact.map { |v| _to_hash(v) }
212
- elsif value.is_a?(Hash)
213
- {}.tap do |hash|
214
- value.each { |k, v| hash[k] = _to_hash(v) }
215
- end
216
- elsif value.respond_to? :to_hash
217
- value.to_hash
218
- else
219
- value
220
- end
221
- end
222
-
223
156
  end
224
157
 
225
158
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Gbizinfo
17
- class CertificationInfo
17
+ class CertificationInfo < ApiModelBase
18
18
  # 部門
19
19
  attr_accessor :category
20
20
 
@@ -49,9 +49,14 @@ module Gbizinfo
49
49
  }
50
50
  end
51
51
 
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
52
57
  # Returns all the JSON keys this model knows about
53
58
  def self.acceptable_attributes
54
- attribute_map.values
59
+ acceptable_attribute_map.values
55
60
  end
56
61
 
57
62
  # Attribute type mapping.
@@ -81,9 +86,10 @@ module Gbizinfo
81
86
  end
82
87
 
83
88
  # check to see if the attribute exists and convert string to symbol for hash key
89
+ acceptable_attribute_map = self.class.acceptable_attribute_map
84
90
  attributes = attributes.each_with_object({}) { |(k, v), h|
85
- if (!self.class.attribute_map.key?(k.to_sym))
86
- fail ArgumentError, "`#{k}` is not a valid attribute in `Gbizinfo::CertificationInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ if (!acceptable_attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Gbizinfo::CertificationInfo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
87
93
  end
88
94
  h[k.to_sym] = v
89
95
  }
@@ -181,61 +187,6 @@ module Gbizinfo
181
187
  new(transformed_hash)
182
188
  end
183
189
 
184
- # Deserializes the data based on type
185
- # @param string type Data type
186
- # @param string value Value to be deserialized
187
- # @return [Object] Deserialized data
188
- def self._deserialize(type, value)
189
- case type.to_sym
190
- when :Time
191
- Time.parse(value)
192
- when :Date
193
- Date.parse(value)
194
- when :String
195
- value.to_s
196
- when :Integer
197
- value.to_i
198
- when :Float
199
- value.to_f
200
- when :Boolean
201
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
- true
203
- else
204
- false
205
- end
206
- when :Object
207
- # generic object (usually a Hash), return directly
208
- value
209
- when /\AArray<(?<inner_type>.+)>\z/
210
- inner_type = Regexp.last_match[:inner_type]
211
- value.map { |v| _deserialize(inner_type, v) }
212
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
- k_type = Regexp.last_match[:k_type]
214
- v_type = Regexp.last_match[:v_type]
215
- {}.tap do |hash|
216
- value.each do |k, v|
217
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
- end
219
- end
220
- else # model
221
- # models (e.g. Pet) or oneOf
222
- klass = Gbizinfo.const_get(type)
223
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
- end
225
- end
226
-
227
- # Returns the string representation of the object
228
- # @return [String] String presentation of the object
229
- def to_s
230
- to_hash.to_s
231
- end
232
-
233
- # to_body is an alias to to_hash (backward compatibility)
234
- # @return [Hash] Returns the object in the form of hash
235
- def to_body
236
- to_hash
237
- end
238
-
239
190
  # Returns the object in the form of hash
240
191
  # @return [Hash] Returns the object in the form of hash
241
192
  def to_hash
@@ -252,24 +203,6 @@ module Gbizinfo
252
203
  hash
253
204
  end
254
205
 
255
- # Outputs non-array value in the form of hash
256
- # For object, use to_hash. Otherwise, just return the value
257
- # @param [Object] value Any valid value
258
- # @return [Hash] Returns the value in the form of hash
259
- def _to_hash(value)
260
- if value.is_a?(Array)
261
- value.compact.map { |v| _to_hash(v) }
262
- elsif value.is_a?(Hash)
263
- {}.tap do |hash|
264
- value.each { |k, v| hash[k] = _to_hash(v) }
265
- end
266
- elsif value.respond_to? :to_hash
267
- value.to_hash
268
- else
269
- value
270
- end
271
- end
272
-
273
206
  end
274
207
 
275
208
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Gbizinfo
17
- class CommendationInfo
17
+ class CommendationInfo < ApiModelBase
18
18
  # 部門
19
19
  attr_accessor :category
20
20
 
@@ -41,9 +41,14 @@ module Gbizinfo
41
41
  }
42
42
  end
43
43
 
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
44
49
  # Returns all the JSON keys this model knows about
45
50
  def self.acceptable_attributes
46
- attribute_map.values
51
+ acceptable_attribute_map.values
47
52
  end
48
53
 
49
54
  # Attribute type mapping.
@@ -71,9 +76,10 @@ module Gbizinfo
71
76
  end
72
77
 
73
78
  # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
74
80
  attributes = attributes.each_with_object({}) { |(k, v), h|
75
- if (!self.class.attribute_map.key?(k.to_sym))
76
- fail ArgumentError, "`#{k}` is not a valid attribute in `Gbizinfo::CommendationInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Gbizinfo::CommendationInfo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
77
83
  end
78
84
  h[k.to_sym] = v
79
85
  }
@@ -161,61 +167,6 @@ module Gbizinfo
161
167
  new(transformed_hash)
162
168
  end
163
169
 
164
- # Deserializes the data based on type
165
- # @param string type Data type
166
- # @param string value Value to be deserialized
167
- # @return [Object] Deserialized data
168
- def self._deserialize(type, value)
169
- case type.to_sym
170
- when :Time
171
- Time.parse(value)
172
- when :Date
173
- Date.parse(value)
174
- when :String
175
- value.to_s
176
- when :Integer
177
- value.to_i
178
- when :Float
179
- value.to_f
180
- when :Boolean
181
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
- true
183
- else
184
- false
185
- end
186
- when :Object
187
- # generic object (usually a Hash), return directly
188
- value
189
- when /\AArray<(?<inner_type>.+)>\z/
190
- inner_type = Regexp.last_match[:inner_type]
191
- value.map { |v| _deserialize(inner_type, v) }
192
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
- k_type = Regexp.last_match[:k_type]
194
- v_type = Regexp.last_match[:v_type]
195
- {}.tap do |hash|
196
- value.each do |k, v|
197
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
- end
199
- end
200
- else # model
201
- # models (e.g. Pet) or oneOf
202
- klass = Gbizinfo.const_get(type)
203
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
204
- end
205
- end
206
-
207
- # Returns the string representation of the object
208
- # @return [String] String presentation of the object
209
- def to_s
210
- to_hash.to_s
211
- end
212
-
213
- # to_body is an alias to to_hash (backward compatibility)
214
- # @return [Hash] Returns the object in the form of hash
215
- def to_body
216
- to_hash
217
- end
218
-
219
170
  # Returns the object in the form of hash
220
171
  # @return [Hash] Returns the object in the form of hash
221
172
  def to_hash
@@ -232,24 +183,6 @@ module Gbizinfo
232
183
  hash
233
184
  end
234
185
 
235
- # Outputs non-array value in the form of hash
236
- # For object, use to_hash. Otherwise, just return the value
237
- # @param [Object] value Any valid value
238
- # @return [Hash] Returns the value in the form of hash
239
- def _to_hash(value)
240
- if value.is_a?(Array)
241
- value.compact.map { |v| _to_hash(v) }
242
- elsif value.is_a?(Hash)
243
- {}.tap do |hash|
244
- value.each { |k, v| hash[k] = _to_hash(v) }
245
- end
246
- elsif value.respond_to? :to_hash
247
- value.to_hash
248
- else
249
- value
250
- end
251
- end
252
-
253
186
  end
254
187
 
255
188
  end