cns_openapi_ruby_client 1.0.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.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +81 -0
  4. data/README.md +123 -0
  5. data/Rakefile +10 -0
  6. data/cns_openapi_ruby_client.gemspec +39 -0
  7. data/docs/CorporateType.md +15 -0
  8. data/docs/Corporation.md +76 -0
  9. data/docs/CorporationsApi.md +101 -0
  10. data/docs/CorrectCodeType.md +15 -0
  11. data/docs/ProcessCodeType.md +15 -0
  12. data/docs/Response.md +26 -0
  13. data/docs/ResponseWrapper.md +18 -0
  14. data/git_push.sh +58 -0
  15. data/lib/cns_openapi_ruby_client.rb +46 -0
  16. data/lib/cns_openapi_ruby_client/api/corporations_api.rb +168 -0
  17. data/lib/cns_openapi_ruby_client/api_client.rb +383 -0
  18. data/lib/cns_openapi_ruby_client/api_error.rb +57 -0
  19. data/lib/cns_openapi_ruby_client/configuration.rb +277 -0
  20. data/lib/cns_openapi_ruby_client/models/corporate_type.rb +45 -0
  21. data/lib/cns_openapi_ruby_client/models/corporation.rb +606 -0
  22. data/lib/cns_openapi_ruby_client/models/correct_code_type.rb +37 -0
  23. data/lib/cns_openapi_ruby_client/models/process_code_type.rb +45 -0
  24. data/lib/cns_openapi_ruby_client/models/response.rb +286 -0
  25. data/lib/cns_openapi_ruby_client/models/response_wrapper.rb +223 -0
  26. data/lib/cns_openapi_ruby_client/version.rb +15 -0
  27. data/spec/api/corporations_api_spec.rb +57 -0
  28. data/spec/api_client_spec.rb +197 -0
  29. data/spec/configuration_spec.rb +42 -0
  30. data/spec/models/corporate_type_spec.rb +28 -0
  31. data/spec/models/corporation_spec.rb +220 -0
  32. data/spec/models/correct_code_type_spec.rb +28 -0
  33. data/spec/models/process_code_type_spec.rb +28 -0
  34. data/spec/models/response_spec.rb +58 -0
  35. data/spec/models/response_wrapper_spec.rb +34 -0
  36. data/spec/spec_helper.rb +111 -0
  37. metadata +148 -0
@@ -0,0 +1,37 @@
1
+ =begin
2
+ #Corporate number system API v4
3
+
4
+ #Corporate number system API v4
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CnsOpenapiRubyClient
17
+ class CorrectCodeType
18
+ N0 = "0".freeze
19
+ N1 = "1".freeze
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ constantValues = CorrectCodeType.constants.select { |c| CorrectCodeType::const_get(c) == value }
33
+ raise "Invalid ENUM value #{value} for class #CorrectCodeType" if constantValues.empty?
34
+ value
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,45 @@
1
+ =begin
2
+ #Corporate number system API v4
3
+
4
+ #Corporate number system API v4
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CnsOpenapiRubyClient
17
+ class ProcessCodeType
18
+ N01 = "01".freeze
19
+ N11 = "11".freeze
20
+ N12 = "12".freeze
21
+ N13 = "13".freeze
22
+ N21 = "21".freeze
23
+ N22 = "22".freeze
24
+ N71 = "71".freeze
25
+ N72 = "72".freeze
26
+ N81 = "81".freeze
27
+ N99 = "99".freeze
28
+
29
+ # Builds the enum from string
30
+ # @param [String] The enum value in the form of the string
31
+ # @return [String] The enum value
32
+ def self.build_from_hash(value)
33
+ new.build_from_hash(value)
34
+ end
35
+
36
+ # Builds the enum from string
37
+ # @param [String] The enum value in the form of the string
38
+ # @return [String] The enum value
39
+ def build_from_hash(value)
40
+ constantValues = ProcessCodeType.constants.select { |c| ProcessCodeType::const_get(c) == value }
41
+ raise "Invalid ENUM value #{value} for class #ProcessCodeType" if constantValues.empty?
42
+ value
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,286 @@
1
+ =begin
2
+ #Corporate number system API v4
3
+
4
+ #Corporate number system API v4
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CnsOpenapiRubyClient
17
+ # 基本3情報及び付随する情報を含む応答結果です。
18
+ class Response
19
+ # 最終更新年月日
20
+ attr_accessor :last_update_date
21
+
22
+ # 総件数
23
+ attr_accessor :count
24
+
25
+ # 分割されたファイルの通し番号(分子)を表すデータ項目。
26
+ attr_accessor :divide_number
27
+
28
+ # 分割されたファイルの総数(分母)にあたるデータ項目。
29
+ attr_accessor :divide_size
30
+
31
+ attr_accessor :corporation
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'last_update_date' => :'lastUpdateDate',
37
+ :'count' => :'count',
38
+ :'divide_number' => :'divideNumber',
39
+ :'divide_size' => :'divideSize',
40
+ :'corporation' => :'corporation'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'last_update_date' => :'String',
53
+ :'count' => :'Integer',
54
+ :'divide_number' => :'Integer',
55
+ :'divide_size' => :'Integer',
56
+ :'corporation' => :'Array<Corporation>'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CnsOpenapiRubyClient::Response` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ 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 `CnsOpenapiRubyClient::Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'last_update_date')
82
+ self.last_update_date = attributes[:'last_update_date']
83
+ end
84
+
85
+ if attributes.key?(:'count')
86
+ self.count = attributes[:'count']
87
+ end
88
+
89
+ if attributes.key?(:'divide_number')
90
+ self.divide_number = attributes[:'divide_number']
91
+ end
92
+
93
+ if attributes.key?(:'divide_size')
94
+ self.divide_size = attributes[:'divide_size']
95
+ end
96
+
97
+ if attributes.key?(:'corporation')
98
+ if (value = attributes[:'corporation']).is_a?(Array)
99
+ self.corporation = value
100
+ end
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ if @last_update_date.nil?
109
+ invalid_properties.push('invalid value for "last_update_date", last_update_date cannot be nil.')
110
+ end
111
+
112
+ if @count.nil?
113
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
114
+ end
115
+
116
+ if @divide_number.nil?
117
+ invalid_properties.push('invalid value for "divide_number", divide_number cannot be nil.')
118
+ end
119
+
120
+ if @divide_size.nil?
121
+ invalid_properties.push('invalid value for "divide_size", divide_size cannot be nil.')
122
+ end
123
+
124
+ if @corporation.nil?
125
+ invalid_properties.push('invalid value for "corporation", corporation cannot be nil.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ return false if @last_update_date.nil?
135
+ return false if @count.nil?
136
+ return false if @divide_number.nil?
137
+ return false if @divide_size.nil?
138
+ return false if @corporation.nil?
139
+ true
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ last_update_date == o.last_update_date &&
148
+ count == o.count &&
149
+ divide_number == o.divide_number &&
150
+ divide_size == o.divide_size &&
151
+ corporation == o.corporation
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Integer] Hash code
162
+ def hash
163
+ [last_update_date, count, divide_number, divide_size, corporation].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def self.build_from_hash(attributes)
170
+ new.build_from_hash(attributes)
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ self.class.openapi_types.each_pair do |key, type|
179
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
180
+ self.send("#{key}=", nil)
181
+ elsif type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
185
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
186
+ end
187
+ elsif !attributes[self.class.attribute_map[key]].nil?
188
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
189
+ end
190
+ end
191
+
192
+ self
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 _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 = CnsOpenapiRubyClient.const_get(type)
234
+ 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,223 @@
1
+ =begin
2
+ #Corporate number system API v4
3
+
4
+ #Corporate number system API v4
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CnsOpenapiRubyClient
17
+ class ResponseWrapper
18
+ attr_accessor :corporations
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'corporations' => :'corporations'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'corporations' => :'Response'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CnsOpenapiRubyClient::ResponseWrapper` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CnsOpenapiRubyClient::ResponseWrapper`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'corporations')
61
+ self.corporations = attributes[:'corporations']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ if @corporations.nil?
70
+ invalid_properties.push('invalid value for "corporations", corporations cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @corporations.nil?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ corporations == o.corporations
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [corporations].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
117
+ self.send("#{key}=", nil)
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
123
+ end
124
+ elsif !attributes[self.class.attribute_map[key]].nil?
125
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
126
+ end
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = CnsOpenapiRubyClient.const_get(type)
171
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end