quake_timesheets_client 0.1.0 → 0.1.5

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +74 -0
  3. data/README.md +27 -21
  4. data/build.sh +1 -1
  5. data/docs/ApprovalTypesApi.md +36 -38
  6. data/docs/ApprovalsApi.md +36 -40
  7. data/docs/CreateApprovalTypesInput.md +22 -0
  8. data/docs/CreateApprovalsInput.md +24 -0
  9. data/docs/CreateDatasetsInput.md +18 -0
  10. data/docs/CreateEntriesInput.md +30 -0
  11. data/docs/CreatePeopleInput.md +20 -0
  12. data/docs/DatasetsApi.md +51 -49
  13. data/docs/EntriesApi.md +52 -72
  14. data/docs/Entry.md +2 -0
  15. data/docs/PeopleApi.md +36 -36
  16. data/docs/UpdateEntriesInput.md +30 -0
  17. data/lib/quake_timesheets_client.rb +7 -1
  18. data/lib/quake_timesheets_client/api/approval_types_api.rb +33 -52
  19. data/lib/quake_timesheets_client/api/approvals_api.rb +34 -65
  20. data/lib/quake_timesheets_client/api/datasets_api.rb +45 -50
  21. data/lib/quake_timesheets_client/api/entries_api.rb +54 -94
  22. data/lib/quake_timesheets_client/api/people_api.rb +33 -45
  23. data/lib/quake_timesheets_client/api_client.rb +1 -1
  24. data/lib/quake_timesheets_client/api_error.rb +1 -1
  25. data/lib/quake_timesheets_client/configuration.rb +1 -1
  26. data/lib/quake_timesheets_client/models/approval.rb +1 -1
  27. data/lib/quake_timesheets_client/models/approval_type.rb +1 -1
  28. data/lib/quake_timesheets_client/models/create_approval_types_input.rb +254 -0
  29. data/lib/quake_timesheets_client/models/create_approvals_input.rb +304 -0
  30. data/lib/quake_timesheets_client/models/create_datasets_input.rb +224 -0
  31. data/lib/quake_timesheets_client/models/create_entries_input.rb +313 -0
  32. data/lib/quake_timesheets_client/models/create_people_input.rb +239 -0
  33. data/lib/quake_timesheets_client/models/dataset.rb +1 -1
  34. data/lib/quake_timesheets_client/models/entry.rb +19 -2
  35. data/lib/quake_timesheets_client/models/person.rb +1 -1
  36. data/lib/quake_timesheets_client/models/update_entries_input.rb +313 -0
  37. data/lib/quake_timesheets_client/version.rb +2 -2
  38. data/quake_timesheets_client.gemspec +1 -1
  39. data/ruby-templates/api.mustache +206 -0
  40. data/ruby.config.yaml +1 -1
  41. data/spec/api_client_spec.rb +1 -1
  42. data/spec/configuration_spec.rb +1 -1
  43. data/spec/models/create_approval_types_input_spec.rb +46 -0
  44. data/spec/models/create_approvals_input_spec.rb +56 -0
  45. data/spec/models/create_datasets_input_spec.rb +34 -0
  46. data/spec/models/create_entries_input_spec.rb +68 -0
  47. data/spec/models/create_people_input_spec.rb +40 -0
  48. data/spec/models/update_entries_input_spec.rb +68 -0
  49. data/spec/spec_helper.rb +1 -1
  50. metadata +34 -9
  51. data/commands +0 -13
@@ -0,0 +1,313 @@
1
+ =begin
2
+ #TimesheetsApi (params in:body)
3
+
4
+ # <p>Another API description</p>
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Quake::Timesheets
17
+ class CreateEntriesInput
18
+ # ID of the person to which this entry pertains
19
+ attr_accessor :person_id
20
+
21
+ # Time period at which this entry starts
22
+ attr_accessor :start_at
23
+
24
+ # Time period at which this entry ends
25
+ attr_accessor :end_at
26
+
27
+ attr_accessor :quantity
28
+
29
+ attr_accessor :unit
30
+
31
+ # Unique identifier of the activity this Entry relates to
32
+ attr_accessor :external_reference
33
+
34
+ # The Tags attached to this entries. Can take an Array of UUIDs of existing Tags, or any String which will find or create a Tag with that value
35
+ attr_accessor :tags
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'person_id' => :'person_id',
63
+ :'start_at' => :'start_at',
64
+ :'end_at' => :'end_at',
65
+ :'quantity' => :'quantity',
66
+ :'unit' => :'unit',
67
+ :'external_reference' => :'external_reference',
68
+ :'tags' => :'tags'
69
+ }
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'person_id' => :'String',
81
+ :'start_at' => :'String',
82
+ :'end_at' => :'String',
83
+ :'quantity' => :'Float',
84
+ :'unit' => :'String',
85
+ :'external_reference' => :'String',
86
+ :'tags' => :'Array<String>'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Quake::Timesheets::CreateEntriesInput` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Quake::Timesheets::CreateEntriesInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'person_id')
112
+ self.person_id = attributes[:'person_id']
113
+ end
114
+
115
+ if attributes.key?(:'start_at')
116
+ self.start_at = attributes[:'start_at']
117
+ end
118
+
119
+ if attributes.key?(:'end_at')
120
+ self.end_at = attributes[:'end_at']
121
+ end
122
+
123
+ if attributes.key?(:'quantity')
124
+ self.quantity = attributes[:'quantity']
125
+ end
126
+
127
+ if attributes.key?(:'unit')
128
+ self.unit = attributes[:'unit']
129
+ end
130
+
131
+ if attributes.key?(:'external_reference')
132
+ self.external_reference = attributes[:'external_reference']
133
+ end
134
+
135
+ if attributes.key?(:'tags')
136
+ if (value = attributes[:'tags']).is_a?(Array)
137
+ self.tags = value
138
+ end
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ invalid_properties = Array.new
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ unit_validator = EnumAttributeValidator.new('String', ["hour", "day", "week", "month", "other"])
153
+ return false unless unit_validator.valid?(@unit)
154
+ true
155
+ end
156
+
157
+ # Custom attribute writer method checking allowed values (enum).
158
+ # @param [Object] unit Object to be assigned
159
+ def unit=(unit)
160
+ validator = EnumAttributeValidator.new('String', ["hour", "day", "week", "month", "other"])
161
+ unless validator.valid?(unit)
162
+ fail ArgumentError, "invalid value for \"unit\", must be one of #{validator.allowable_values}."
163
+ end
164
+ @unit = unit
165
+ end
166
+
167
+ # Checks equality by comparing each attribute.
168
+ # @param [Object] Object to be compared
169
+ def ==(o)
170
+ return true if self.equal?(o)
171
+ self.class == o.class &&
172
+ person_id == o.person_id &&
173
+ start_at == o.start_at &&
174
+ end_at == o.end_at &&
175
+ quantity == o.quantity &&
176
+ unit == o.unit &&
177
+ external_reference == o.external_reference &&
178
+ tags == o.tags
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Integer] Hash code
189
+ def hash
190
+ [person_id, start_at, end_at, quantity, unit, external_reference, tags].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def self.build_from_hash(attributes)
197
+ new.build_from_hash(attributes)
198
+ end
199
+
200
+ # Builds the object from hash
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ # @return [Object] Returns the model itself
203
+ def build_from_hash(attributes)
204
+ return nil unless attributes.is_a?(Hash)
205
+ self.class.openapi_types.each_pair do |key, type|
206
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
207
+ self.send("#{key}=", nil)
208
+ elsif type =~ /\AArray<(.*)>/i
209
+ # check to ensure the input is an array given that the attribute
210
+ # is documented as an array but the input is not
211
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
212
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
213
+ end
214
+ elsif !attributes[self.class.attribute_map[key]].nil?
215
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
216
+ end
217
+ end
218
+
219
+ self
220
+ end
221
+
222
+ # Deserializes the data based on type
223
+ # @param string type Data type
224
+ # @param string value Value to be deserialized
225
+ # @return [Object] Deserialized data
226
+ def _deserialize(type, value)
227
+ case type.to_sym
228
+ when :Time
229
+ Time.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :Boolean
239
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when :Object
245
+ # generic object (usually a Hash), return directly
246
+ value
247
+ when /\AArray<(?<inner_type>.+)>\z/
248
+ inner_type = Regexp.last_match[:inner_type]
249
+ value.map { |v| _deserialize(inner_type, v) }
250
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
251
+ k_type = Regexp.last_match[:k_type]
252
+ v_type = Regexp.last_match[:v_type]
253
+ {}.tap do |hash|
254
+ value.each do |k, v|
255
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
256
+ end
257
+ end
258
+ else # model
259
+ # models (e.g. Pet) or oneOf
260
+ klass = Quake::Timesheets.const_get(type)
261
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
262
+ end
263
+ end
264
+
265
+ # Returns the string representation of the object
266
+ # @return [String] String presentation of the object
267
+ def to_s
268
+ to_hash.to_s
269
+ end
270
+
271
+ # to_body is an alias to to_hash (backward compatibility)
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_body
274
+ to_hash
275
+ end
276
+
277
+ # Returns the object in the form of hash
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_hash
280
+ hash = {}
281
+ self.class.attribute_map.each_pair do |attr, param|
282
+ value = self.send(attr)
283
+ if value.nil?
284
+ is_nullable = self.class.openapi_nullable.include?(attr)
285
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
286
+ end
287
+
288
+ hash[param] = _to_hash(value)
289
+ end
290
+ hash
291
+ end
292
+
293
+ # Outputs non-array value in the form of hash
294
+ # For object, use to_hash. Otherwise, just return the value
295
+ # @param [Object] value Any valid value
296
+ # @return [Hash] Returns the value in the form of hash
297
+ def _to_hash(value)
298
+ if value.is_a?(Array)
299
+ value.compact.map { |v| _to_hash(v) }
300
+ elsif value.is_a?(Hash)
301
+ {}.tap do |hash|
302
+ value.each { |k, v| hash[k] = _to_hash(v) }
303
+ end
304
+ elsif value.respond_to? :to_hash
305
+ value.to_hash
306
+ else
307
+ value
308
+ end
309
+ end
310
+
311
+ end
312
+
313
+ end
@@ -0,0 +1,239 @@
1
+ =begin
2
+ #TimesheetsApi (params in:body)
3
+
4
+ # <p>Another API description</p>
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Quake::Timesheets
17
+ class CreatePeopleInput
18
+ # Dataset to which the Person object should belong
19
+ attr_accessor :dataset_id
20
+
21
+ # Human readable name for the Person object (usually the subject's real name)
22
+ attr_accessor :name
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'dataset_id' => :'dataset_id',
28
+ :'name' => :'name'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'dataset_id' => :'String',
41
+ :'name' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Quake::Timesheets::CreatePeopleInput` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ 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 `Quake::Timesheets::CreatePeopleInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'dataset_id')
67
+ self.dataset_id = attributes[:'dataset_id']
68
+ end
69
+
70
+ if attributes.key?(:'name')
71
+ self.name = attributes[:'name']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @dataset_id.nil?
80
+ invalid_properties.push('invalid value for "dataset_id", dataset_id cannot be nil.')
81
+ end
82
+
83
+ if @name.nil?
84
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
85
+ end
86
+
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ return false if @dataset_id.nil?
94
+ return false if @name.nil?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ dataset_id == o.dataset_id &&
104
+ name == o.name
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [dataset_id, name].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ new.build_from_hash(attributes)
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.openapi_types.each_pair do |key, type|
132
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = Quake::Timesheets.const_get(type)
187
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end