kickflow 0.1.0 → 0.2.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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +102 -100
  3. data/Rakefile +1 -1
  4. data/docs/DefaultApi.md +118 -114
  5. data/docs/FormField.md +3 -1
  6. data/docs/FormFieldDetail.md +2 -0
  7. data/docs/PatchTicketsTicketIdRequestInputsInner.md +4 -4
  8. data/docs/PatchTicketsTicketIdRequestSlipItemsInnerInputsInner.md +8 -2
  9. data/docs/PostFiles200Response.md +1 -1
  10. data/docs/PostTicketsIdCommentsRequest.md +1 -1
  11. data/docs/PostTicketsRequestInputsInner.md +4 -4
  12. data/docs/PostTicketsRequestSlipItemsInnerInputsInner.md +7 -1
  13. data/docs/PostTicketsRequestSlipItemsInnerInputsInnerTeamId.md +49 -0
  14. data/docs/PostTicketsRequestSlipItemsInnerInputsInnerTicketId.md +49 -0
  15. data/docs/PostTicketsRequestSlipItemsInnerInputsInnerUserId.md +49 -0
  16. data/docs/RouteStep.md +3 -1
  17. data/docs/Section.md +2 -0
  18. data/docs/SectionListItem.md +32 -0
  19. data/docs/SlipField.md +3 -1
  20. data/docs/SlipFieldDetail.md +2 -0
  21. data/docs/SlipItemInput.md +6 -0
  22. data/docs/SubStatus.md +1 -1
  23. data/docs/TicketWithStep.md +52 -0
  24. data/docs/TicketWorkflow.md +10 -6
  25. data/docs/UserImage.md +5 -1
  26. data/docs/Workflow.md +6 -4
  27. data/docs/WorkflowDetail.md +9 -5
  28. data/docs/WorkflowInTicket.md +10 -6
  29. data/lib/kickflow/api/_api.rb +115 -109
  30. data/lib/kickflow/configuration.rb +2 -2
  31. data/lib/kickflow/models/form_field.rb +16 -5
  32. data/lib/kickflow/models/form_field_detail.rb +12 -1
  33. data/lib/kickflow/models/patch_tickets_ticket_id_request_inputs_inner.rb +4 -4
  34. data/lib/kickflow/models/patch_tickets_ticket_id_request_slip_items_inner_inputs_inner.rb +30 -5
  35. data/lib/kickflow/models/post_files200_response.rb +1 -1
  36. data/lib/kickflow/models/post_tickets_id_comments_request.rb +1 -1
  37. data/lib/kickflow/models/post_tickets_request_inputs_inner.rb +4 -4
  38. data/lib/kickflow/models/post_tickets_request_slip_items_inner_inputs_inner.rb +29 -2
  39. data/lib/kickflow/models/post_tickets_request_slip_items_inner_inputs_inner_team_id.rb +106 -0
  40. data/lib/kickflow/models/post_tickets_request_slip_items_inner_inputs_inner_ticket_id.rb +106 -0
  41. data/lib/kickflow/models/post_tickets_request_slip_items_inner_inputs_inner_user_id.rb +106 -0
  42. data/lib/kickflow/models/role_create_body_permission_list_inner.rb +2 -2
  43. data/lib/kickflow/models/role_detail_all_of_permission_list.rb +2 -2
  44. data/lib/kickflow/models/role_update_body_permission_list_inner.rb +2 -2
  45. data/lib/kickflow/models/route_step.rb +22 -5
  46. data/lib/kickflow/models/route_step_condition_field.rb +34 -0
  47. data/lib/kickflow/models/section.rb +51 -1
  48. data/lib/kickflow/models/section_list_item.rb +336 -0
  49. data/lib/kickflow/models/slip_field.rb +18 -7
  50. data/lib/kickflow/models/slip_field_detail.rb +14 -3
  51. data/lib/kickflow/models/slip_item_input.rb +37 -1
  52. data/lib/kickflow/models/sub_status.rb +2 -0
  53. data/lib/kickflow/models/ticket_with_step.rb +568 -0
  54. data/lib/kickflow/models/user_image.rb +29 -9
  55. data/lib/kickflow/models/workflow.rb +17 -5
  56. data/lib/kickflow/models/workflow_detail.rb +30 -6
  57. data/lib/kickflow/models/workflow_in_ticket.rb +31 -7
  58. data/lib/kickflow/version.rb +1 -1
  59. data/lib/kickflow.rb +5 -3
  60. data/manifest.scm +7 -1
  61. data/pkg/kickflow-0.1.0.gem +0 -0
  62. data/spec/models/post_tickets_request_slip_items_inner_inputs_inner_team_id_spec.rb +32 -0
  63. data/spec/models/post_tickets_request_slip_items_inner_inputs_inner_ticket_id_spec.rb +32 -0
  64. data/spec/models/post_tickets_request_slip_items_inner_inputs_inner_user_id_spec.rb +32 -0
  65. data/spec/models/section_list_item_spec.rb +82 -0
  66. data/spec/models/ticket_with_step_spec.rb +146 -0
  67. data/vendor/schema.yaml +377 -167
  68. metadata +22 -2
@@ -158,7 +158,7 @@ module Kickflow
158
158
  def initialize
159
159
  @scheme = 'https'
160
160
  @host = 'api.kickflow.com'
161
- @base_path = '/v1'
161
+ @base_path = ''
162
162
  @server_index = nil
163
163
  @server_operation_index = {}
164
164
  @server_variables = {}
@@ -262,7 +262,7 @@ module Kickflow
262
262
  def server_settings
263
263
  [
264
264
  {
265
- url: "https://api.kickflow.com/v1",
265
+ url: "https://api.kickflow.com",
266
266
  description: "kickflow REST API v1",
267
267
  }
268
268
  ]
@@ -82,6 +82,9 @@ module Kickflow
82
82
  # 隠しフィールドである場合true
83
83
  attr_accessor :hidden
84
84
 
85
+ # trueの時、申請者・承認者が画面上から値を入力することを禁止します。 ボタン(外部API連携)による代入や、REST API経由での入力はこのオプションの対象外です。
86
+ attr_accessor :readonly_on_ui
87
+
85
88
  class EnumAttributeValidator
86
89
  attr_reader :datatype
87
90
  attr_reader :allowable_values
@@ -128,7 +131,8 @@ module Kickflow
128
131
  :'delimited' => :'delimited',
129
132
  :'prefix' => :'prefix',
130
133
  :'suffix' => :'suffix',
131
- :'hidden' => :'hidden'
134
+ :'hidden' => :'hidden',
135
+ :'readonly_on_ui' => :'readonlyOnUi'
132
136
  }
133
137
  end
134
138
 
@@ -161,7 +165,8 @@ module Kickflow
161
165
  :'delimited' => :'Boolean',
162
166
  :'prefix' => :'String',
163
167
  :'suffix' => :'String',
164
- :'hidden' => :'Boolean'
168
+ :'hidden' => :'Boolean',
169
+ :'readonly_on_ui' => :'Boolean'
165
170
  }
166
171
  end
167
172
 
@@ -181,7 +186,8 @@ module Kickflow
181
186
  :'delimited',
182
187
  :'prefix',
183
188
  :'suffix',
184
- :'hidden'
189
+ :'hidden',
190
+ :'readonly_on_ui'
185
191
  ])
186
192
  end
187
193
 
@@ -329,6 +335,10 @@ module Kickflow
329
335
  if attributes.key?(:'hidden')
330
336
  self.hidden = attributes[:'hidden']
331
337
  end
338
+
339
+ if attributes.key?(:'readonly_on_ui')
340
+ self.readonly_on_ui = attributes[:'readonly_on_ui']
341
+ end
332
342
  end
333
343
 
334
344
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -514,7 +524,8 @@ module Kickflow
514
524
  delimited == o.delimited &&
515
525
  prefix == o.prefix &&
516
526
  suffix == o.suffix &&
517
- hidden == o.hidden
527
+ hidden == o.hidden &&
528
+ readonly_on_ui == o.readonly_on_ui
518
529
  end
519
530
 
520
531
  # @see the `==` method
@@ -526,7 +537,7 @@ module Kickflow
526
537
  # Calculates hash code according to all attributes.
527
538
  # @return [Integer] Hash code
528
539
  def hash
529
- [id, title, description, field_type, required, approver, author, options, code, size, regexp_format, formula, default_value, min_value, max_value, min_length, max_length, decimal_digit, delimited, prefix, suffix, hidden].hash
540
+ [id, title, description, field_type, required, approver, author, options, code, size, regexp_format, formula, default_value, min_value, max_value, min_length, max_length, decimal_digit, delimited, prefix, suffix, hidden, readonly_on_ui].hash
530
541
  end
531
542
 
532
543
  # Builds the object from hash
@@ -82,6 +82,9 @@ module Kickflow
82
82
  # 隠しフィールドである場合true
83
83
  attr_accessor :hidden
84
84
 
85
+ # trueの時、申請者・承認者が画面上から値を入力することを禁止します。 ボタン(外部API連携)による代入や、REST API経由での入力はこのオプションの対象外です。
86
+ attr_accessor :readonly_on_ui
87
+
85
88
  attr_accessor :general_master
86
89
 
87
90
  attr_accessor :default_general_master_item
@@ -137,6 +140,7 @@ module Kickflow
137
140
  :'prefix' => :'prefix',
138
141
  :'suffix' => :'suffix',
139
142
  :'hidden' => :'hidden',
143
+ :'readonly_on_ui' => :'readonlyOnUi',
140
144
  :'general_master' => :'generalMaster',
141
145
  :'default_general_master_item' => :'defaultGeneralMasterItem',
142
146
  :'external_api_setting' => :'externalApiSetting',
@@ -174,6 +178,7 @@ module Kickflow
174
178
  :'prefix' => :'String',
175
179
  :'suffix' => :'String',
176
180
  :'hidden' => :'Boolean',
181
+ :'readonly_on_ui' => :'Boolean',
177
182
  :'general_master' => :'GeneralMaster',
178
183
  :'default_general_master_item' => :'GeneralMasterItem',
179
184
  :'external_api_setting' => :'ExternalApiSetting',
@@ -198,6 +203,7 @@ module Kickflow
198
203
  :'prefix',
199
204
  :'suffix',
200
205
  :'hidden',
206
+ :'readonly_on_ui',
201
207
  :'general_master',
202
208
  :'default_general_master_item',
203
209
  :'external_api_setting',
@@ -357,6 +363,10 @@ module Kickflow
357
363
  self.hidden = attributes[:'hidden']
358
364
  end
359
365
 
366
+ if attributes.key?(:'readonly_on_ui')
367
+ self.readonly_on_ui = attributes[:'readonly_on_ui']
368
+ end
369
+
360
370
  if attributes.key?(:'general_master')
361
371
  self.general_master = attributes[:'general_master']
362
372
  end
@@ -558,6 +568,7 @@ module Kickflow
558
568
  prefix == o.prefix &&
559
569
  suffix == o.suffix &&
560
570
  hidden == o.hidden &&
571
+ readonly_on_ui == o.readonly_on_ui &&
561
572
  general_master == o.general_master &&
562
573
  default_general_master_item == o.default_general_master_item &&
563
574
  external_api_setting == o.external_api_setting &&
@@ -573,7 +584,7 @@ module Kickflow
573
584
  # Calculates hash code according to all attributes.
574
585
  # @return [Integer] Hash code
575
586
  def hash
576
- [id, title, description, field_type, required, approver, author, options, code, size, regexp_format, formula, default_value, min_value, max_value, min_length, max_length, decimal_digit, delimited, prefix, suffix, hidden, general_master, default_general_master_item, external_api_setting, climber_cloud_setting].hash
587
+ [id, title, description, field_type, required, approver, author, options, code, size, regexp_format, formula, default_value, min_value, max_value, min_length, max_length, decimal_digit, delimited, prefix, suffix, hidden, readonly_on_ui, general_master, default_general_master_item, external_api_setting, climber_cloud_setting].hash
577
588
  end
578
589
 
579
590
  # Builds the object from hash
@@ -32,7 +32,7 @@ module Kickflow
32
32
 
33
33
  attr_accessor :ticket_id
34
34
 
35
- # 添付ファイルの署名入りID。 フィールドがファイルタイプのときのみ指定してください。
35
+ # 添付ファイルの署名済みID。 フィールドがファイルタイプのときのみ指定してください。
36
36
  attr_accessor :files
37
37
 
38
38
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -61,9 +61,9 @@ module Kickflow
61
61
  :'form_field_code' => :'String',
62
62
  :'value' => :'PostTicketsRequestSlipItemsInnerInputsInnerValue',
63
63
  :'general_master_item_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerGeneralMasterItemId',
64
- :'user_id' => :'PostTicketsRequestInputsInnerUserId',
65
- :'team_id' => :'PostTicketsRequestInputsInnerTeamId',
66
- :'ticket_id' => :'PostTicketsRequestInputsInnerTicketId',
64
+ :'user_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerUserId',
65
+ :'team_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerTeamId',
66
+ :'ticket_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerTicketId',
67
67
  :'files' => :'Array<String>'
68
68
  }
69
69
  end
@@ -24,10 +24,15 @@ module Kickflow
24
24
 
25
25
  attr_accessor :value
26
26
 
27
- # 汎用マスタアイテムのUUID。フィールドが汎用マスタタイプのときのみ指定してください。
28
27
  attr_accessor :general_master_item_id
29
28
 
30
- # 添付ファイルの署名入りID。 フィールドがファイルタイプのときのみ指定してください。
29
+ attr_accessor :user_id
30
+
31
+ attr_accessor :team_id
32
+
33
+ attr_accessor :ticket_id
34
+
35
+ # 添付ファイルの署名済みID。 フィールドがファイルタイプのときのみ指定してください。
31
36
  attr_accessor :files
32
37
 
33
38
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -37,6 +42,9 @@ module Kickflow
37
42
  :'slip_field_code' => :'slipFieldCode',
38
43
  :'value' => :'value',
39
44
  :'general_master_item_id' => :'generalMasterItemId',
45
+ :'user_id' => :'userId',
46
+ :'team_id' => :'teamId',
47
+ :'ticket_id' => :'ticketId',
40
48
  :'files' => :'files'
41
49
  }
42
50
  end
@@ -52,7 +60,10 @@ module Kickflow
52
60
  :'slip_field_id' => :'String',
53
61
  :'slip_field_code' => :'String',
54
62
  :'value' => :'PostTicketsRequestSlipItemsInnerInputsInnerValue',
55
- :'general_master_item_id' => :'String',
63
+ :'general_master_item_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerGeneralMasterItemId',
64
+ :'user_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerUserId',
65
+ :'team_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerTeamId',
66
+ :'ticket_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerTicketId',
56
67
  :'files' => :'Array<String>'
57
68
  }
58
69
  end
@@ -62,7 +73,6 @@ module Kickflow
62
73
  Set.new([
63
74
  :'slip_field_id',
64
75
  :'slip_field_code',
65
- :'general_master_item_id',
66
76
  :'files'
67
77
  ])
68
78
  end
@@ -98,6 +108,18 @@ module Kickflow
98
108
  self.general_master_item_id = attributes[:'general_master_item_id']
99
109
  end
100
110
 
111
+ if attributes.key?(:'user_id')
112
+ self.user_id = attributes[:'user_id']
113
+ end
114
+
115
+ if attributes.key?(:'team_id')
116
+ self.team_id = attributes[:'team_id']
117
+ end
118
+
119
+ if attributes.key?(:'ticket_id')
120
+ self.ticket_id = attributes[:'ticket_id']
121
+ end
122
+
101
123
  if attributes.key?(:'files')
102
124
  if (value = attributes[:'files']).is_a?(Array)
103
125
  self.files = value
@@ -129,6 +151,9 @@ module Kickflow
129
151
  slip_field_code == o.slip_field_code &&
130
152
  value == o.value &&
131
153
  general_master_item_id == o.general_master_item_id &&
154
+ user_id == o.user_id &&
155
+ team_id == o.team_id &&
156
+ ticket_id == o.ticket_id &&
132
157
  files == o.files
133
158
  end
134
159
 
@@ -141,7 +166,7 @@ module Kickflow
141
166
  # Calculates hash code according to all attributes.
142
167
  # @return [Integer] Hash code
143
168
  def hash
144
- [slip_field_id, slip_field_code, value, general_master_item_id, files].hash
169
+ [slip_field_id, slip_field_code, value, general_master_item_id, user_id, team_id, ticket_id, files].hash
145
170
  end
146
171
 
147
172
  # Builds the object from hash
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module Kickflow
17
17
  class PostFiles200Response
18
- # 添付ファイルの署名入りID
18
+ # 添付ファイルの署名済みID
19
19
  attr_accessor :signed_id
20
20
 
21
21
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -18,7 +18,7 @@ module Kickflow
18
18
  # 本文
19
19
  attr_accessor :body
20
20
 
21
- # 添付ファイルの署名入りID
21
+ # 添付ファイルの署名済みID
22
22
  attr_accessor :files
23
23
 
24
24
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -32,7 +32,7 @@ module Kickflow
32
32
 
33
33
  attr_accessor :ticket_id
34
34
 
35
- # 添付ファイルの署名入りID。 フィールドがファイルタイプのときのみ指定してください。
35
+ # 添付ファイルの署名済みID。 フィールドがファイルタイプのときのみ指定してください。
36
36
  attr_accessor :files
37
37
 
38
38
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -61,9 +61,9 @@ module Kickflow
61
61
  :'form_field_code' => :'String',
62
62
  :'value' => :'PostTicketsRequestSlipItemsInnerInputsInnerValue',
63
63
  :'general_master_item_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerGeneralMasterItemId',
64
- :'user_id' => :'PostTicketsRequestInputsInnerUserId',
65
- :'team_id' => :'PostTicketsRequestInputsInnerTeamId',
66
- :'ticket_id' => :'PostTicketsRequestInputsInnerTicketId',
64
+ :'user_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerUserId',
65
+ :'team_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerTeamId',
66
+ :'ticket_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerTicketId',
67
67
  :'files' => :'Array<String>'
68
68
  }
69
69
  end
@@ -26,7 +26,13 @@ module Kickflow
26
26
 
27
27
  attr_accessor :general_master_item_id
28
28
 
29
- # 添付ファイルの署名入りID。 フィールドがファイルタイプのときのみ指定してください。
29
+ attr_accessor :user_id
30
+
31
+ attr_accessor :team_id
32
+
33
+ attr_accessor :ticket_id
34
+
35
+ # 添付ファイルの署名済みID。 フィールドがファイルタイプのときのみ指定してください。
30
36
  attr_accessor :files
31
37
 
32
38
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -36,6 +42,9 @@ module Kickflow
36
42
  :'slip_field_code' => :'slipFieldCode',
37
43
  :'value' => :'value',
38
44
  :'general_master_item_id' => :'generalMasterItemId',
45
+ :'user_id' => :'userId',
46
+ :'team_id' => :'teamId',
47
+ :'ticket_id' => :'ticketId',
39
48
  :'files' => :'files'
40
49
  }
41
50
  end
@@ -52,6 +61,9 @@ module Kickflow
52
61
  :'slip_field_code' => :'String',
53
62
  :'value' => :'PostTicketsRequestSlipItemsInnerInputsInnerValue',
54
63
  :'general_master_item_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerGeneralMasterItemId',
64
+ :'user_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerUserId',
65
+ :'team_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerTeamId',
66
+ :'ticket_id' => :'PostTicketsRequestSlipItemsInnerInputsInnerTicketId',
55
67
  :'files' => :'Array<String>'
56
68
  }
57
69
  end
@@ -96,6 +108,18 @@ module Kickflow
96
108
  self.general_master_item_id = attributes[:'general_master_item_id']
97
109
  end
98
110
 
111
+ if attributes.key?(:'user_id')
112
+ self.user_id = attributes[:'user_id']
113
+ end
114
+
115
+ if attributes.key?(:'team_id')
116
+ self.team_id = attributes[:'team_id']
117
+ end
118
+
119
+ if attributes.key?(:'ticket_id')
120
+ self.ticket_id = attributes[:'ticket_id']
121
+ end
122
+
99
123
  if attributes.key?(:'files')
100
124
  if (value = attributes[:'files']).is_a?(Array)
101
125
  self.files = value
@@ -127,6 +151,9 @@ module Kickflow
127
151
  slip_field_code == o.slip_field_code &&
128
152
  value == o.value &&
129
153
  general_master_item_id == o.general_master_item_id &&
154
+ user_id == o.user_id &&
155
+ team_id == o.team_id &&
156
+ ticket_id == o.ticket_id &&
130
157
  files == o.files
131
158
  end
132
159
 
@@ -139,7 +166,7 @@ module Kickflow
139
166
  # Calculates hash code according to all attributes.
140
167
  # @return [Integer] Hash code
141
168
  def hash
142
- [slip_field_id, slip_field_code, value, general_master_item_id, files].hash
169
+ [slip_field_id, slip_field_code, value, general_master_item_id, user_id, team_id, ticket_id, files].hash
143
170
  end
144
171
 
145
172
  # Builds the object from hash
@@ -0,0 +1,106 @@
1
+ =begin
2
+ #kickflow REST API v1
3
+
4
+ #kickflowの開発者用REST API (v1)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Kickflow
17
+ # チームUUID。フィールドがチームタイプのときのみ指定してください。
18
+ module PostTicketsRequestSlipItemsInnerInputsInnerTeamId
19
+ class << self
20
+ # List of class defined in oneOf (OpenAPI v3)
21
+ def openapi_one_of
22
+ [
23
+ :'Array<String>',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of oneOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - We do not attempt to check whether exactly one item matches.
35
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
36
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
37
+ # - TODO: scalar values are de facto behaving as if they were nullable.
38
+ # - TODO: logging when debugging is set.
39
+ openapi_one_of.each do |klass|
40
+ begin
41
+ next if klass == :AnyType # "nullable: true"
42
+ typed_data = find_and_cast_into_type(klass, data)
43
+ return typed_data if typed_data
44
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
45
+ end
46
+ end
47
+
48
+ openapi_one_of.include?(:AnyType) ? data : nil
49
+ end
50
+
51
+ private
52
+
53
+ SchemaMismatchError = Class.new(StandardError)
54
+
55
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
56
+ def find_and_cast_into_type(klass, data)
57
+ return if data.nil?
58
+
59
+ case klass.to_s
60
+ when 'Boolean'
61
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
62
+ when 'Float'
63
+ return data if data.instance_of?(Float)
64
+ when 'Integer'
65
+ return data if data.instance_of?(Integer)
66
+ when 'Time'
67
+ return Time.parse(data)
68
+ when 'Date'
69
+ return Date.parse(data)
70
+ when 'String'
71
+ return data if data.instance_of?(String)
72
+ when 'Object' # "type: object"
73
+ return data if data.instance_of?(Hash)
74
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
75
+ if data.instance_of?(Array)
76
+ sub_type = Regexp.last_match[:sub_type]
77
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
78
+ end
79
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
80
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
81
+ sub_type = Regexp.last_match[:sub_type]
82
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
83
+ end
84
+ else # model
85
+ const = Kickflow.const_get(klass)
86
+ if const
87
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
88
+ model = const.build(data)
89
+ return model if model
90
+ else
91
+ # raise if data contains keys that are not known to the model
92
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
93
+ model = const.build_from_hash(data)
94
+ return model if model
95
+ end
96
+ end
97
+ end
98
+
99
+ raise # if no match by now, raise
100
+ rescue
101
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
102
+ end
103
+ end
104
+ end
105
+
106
+ end
@@ -0,0 +1,106 @@
1
+ =begin
2
+ #kickflow REST API v1
3
+
4
+ #kickflowの開発者用REST API (v1)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Kickflow
17
+ # チケットUUID。フィールドがチケットタイプのときのみ指定してください。
18
+ module PostTicketsRequestSlipItemsInnerInputsInnerTicketId
19
+ class << self
20
+ # List of class defined in oneOf (OpenAPI v3)
21
+ def openapi_one_of
22
+ [
23
+ :'Array<String>',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of oneOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - We do not attempt to check whether exactly one item matches.
35
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
36
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
37
+ # - TODO: scalar values are de facto behaving as if they were nullable.
38
+ # - TODO: logging when debugging is set.
39
+ openapi_one_of.each do |klass|
40
+ begin
41
+ next if klass == :AnyType # "nullable: true"
42
+ typed_data = find_and_cast_into_type(klass, data)
43
+ return typed_data if typed_data
44
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
45
+ end
46
+ end
47
+
48
+ openapi_one_of.include?(:AnyType) ? data : nil
49
+ end
50
+
51
+ private
52
+
53
+ SchemaMismatchError = Class.new(StandardError)
54
+
55
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
56
+ def find_and_cast_into_type(klass, data)
57
+ return if data.nil?
58
+
59
+ case klass.to_s
60
+ when 'Boolean'
61
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
62
+ when 'Float'
63
+ return data if data.instance_of?(Float)
64
+ when 'Integer'
65
+ return data if data.instance_of?(Integer)
66
+ when 'Time'
67
+ return Time.parse(data)
68
+ when 'Date'
69
+ return Date.parse(data)
70
+ when 'String'
71
+ return data if data.instance_of?(String)
72
+ when 'Object' # "type: object"
73
+ return data if data.instance_of?(Hash)
74
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
75
+ if data.instance_of?(Array)
76
+ sub_type = Regexp.last_match[:sub_type]
77
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
78
+ end
79
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
80
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
81
+ sub_type = Regexp.last_match[:sub_type]
82
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
83
+ end
84
+ else # model
85
+ const = Kickflow.const_get(klass)
86
+ if const
87
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
88
+ model = const.build(data)
89
+ return model if model
90
+ else
91
+ # raise if data contains keys that are not known to the model
92
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
93
+ model = const.build_from_hash(data)
94
+ return model if model
95
+ end
96
+ end
97
+ end
98
+
99
+ raise # if no match by now, raise
100
+ rescue
101
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
102
+ end
103
+ end
104
+ end
105
+
106
+ end