quake_timesheets_client 0.1.0 → 0.1.1

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -21
  3. data/build.sh +1 -1
  4. data/docs/ApprovalTypesApi.md +36 -38
  5. data/docs/ApprovalsApi.md +36 -40
  6. data/docs/CreateApprovalTypesInput.md +22 -0
  7. data/docs/CreateApprovalsInput.md +24 -0
  8. data/docs/CreateDatasetsInput.md +18 -0
  9. data/docs/CreateEntriesInput.md +28 -0
  10. data/docs/CreatePeopleInput.md +20 -0
  11. data/docs/DatasetsApi.md +51 -49
  12. data/docs/EntriesApi.md +52 -72
  13. data/docs/PeopleApi.md +36 -36
  14. data/docs/UpdateEntriesInput.md +28 -0
  15. data/lib/quake_timesheets_client.rb +7 -1
  16. data/lib/quake_timesheets_client/api/approval_types_api.rb +33 -52
  17. data/lib/quake_timesheets_client/api/approvals_api.rb +34 -65
  18. data/lib/quake_timesheets_client/api/datasets_api.rb +45 -50
  19. data/lib/quake_timesheets_client/api/entries_api.rb +53 -93
  20. data/lib/quake_timesheets_client/api/people_api.rb +33 -45
  21. data/lib/quake_timesheets_client/api_client.rb +1 -1
  22. data/lib/quake_timesheets_client/api_error.rb +1 -1
  23. data/lib/quake_timesheets_client/configuration.rb +1 -1
  24. data/lib/quake_timesheets_client/models/approval.rb +1 -1
  25. data/lib/quake_timesheets_client/models/approval_type.rb +1 -1
  26. data/lib/quake_timesheets_client/models/create_approval_types_input.rb +254 -0
  27. data/lib/quake_timesheets_client/models/create_approvals_input.rb +304 -0
  28. data/lib/quake_timesheets_client/models/create_datasets_input.rb +224 -0
  29. data/lib/quake_timesheets_client/models/create_entries_input.rb +301 -0
  30. data/lib/quake_timesheets_client/models/create_people_input.rb +239 -0
  31. data/lib/quake_timesheets_client/models/dataset.rb +1 -1
  32. data/lib/quake_timesheets_client/models/entry.rb +1 -1
  33. data/lib/quake_timesheets_client/models/person.rb +1 -1
  34. data/lib/quake_timesheets_client/models/update_entries_input.rb +301 -0
  35. data/lib/quake_timesheets_client/version.rb +2 -2
  36. data/quake_timesheets_client.gemspec +1 -1
  37. data/ruby.config.yaml +1 -1
  38. data/spec/api_client_spec.rb +1 -1
  39. data/spec/configuration_spec.rb +1 -1
  40. data/spec/models/create_approval_types_input_spec.rb +46 -0
  41. data/spec/models/create_approvals_input_spec.rb +56 -0
  42. data/spec/models/create_datasets_input_spec.rb +34 -0
  43. data/spec/models/create_entries_input_spec.rb +68 -0
  44. data/spec/models/create_people_input_spec.rb +40 -0
  45. data/spec/models/update_entries_input_spec.rb +68 -0
  46. data/spec/spec_helper.rb +1 -1
  47. metadata +26 -2
@@ -1,5 +1,5 @@
1
1
  =begin
2
- #TimesheetsApi (params in:formData)
2
+ #TimesheetsApi (params in:body)
3
3
 
4
4
  # <p>Another API description</p>
5
5
 
@@ -19,49 +19,50 @@ module Quake::Timesheets
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # Search for people matching filters
22
+ # Create a new Person record
23
23
  # @param [Hash] opts the optional parameters
24
- # @option opts [String] :dataset_id Filter to the people belonging to one of the identified datasets
25
- # @return [Array<Person>]
26
- def get_api_v1_people(opts = {})
27
- data, _status_code, _headers = get_api_v1_people_with_http_info(opts)
24
+ # @option opts [CreatePeopleInput] :create_people_input
25
+ # @return [Person]
26
+ def create_people(opts = {})
27
+ data, _status_code, _headers = create_people_with_http_info(opts)
28
28
  data
29
29
  end
30
30
 
31
- # Search for people matching filters
31
+ # Create a new Person record
32
32
  # @param [Hash] opts the optional parameters
33
- # @option opts [String] :dataset_id Filter to the people belonging to one of the identified datasets
34
- # @return [Array<(Array<Person>, Integer, Hash)>] Array<Person> data, response status code and response headers
35
- def get_api_v1_people_with_http_info(opts = {})
33
+ # @option opts [CreatePeopleInput] :create_people_input
34
+ # @return [Array<(Person, Integer, Hash)>] Person data, response status code and response headers
35
+ def create_people_with_http_info(opts = {})
36
36
  if @api_client.config.debugging
37
- @api_client.config.logger.debug 'Calling API: PeopleApi.get_api_v1_people ...'
37
+ @api_client.config.logger.debug 'Calling API: PeopleApi.create_people ...'
38
38
  end
39
39
  # resource path
40
40
  local_var_path = '/api/v1/people'
41
41
 
42
42
  # query parameters
43
43
  query_params = opts[:query_params] || {}
44
- query_params[:'dataset_id'] = opts[:'dataset_id'] if !opts[:'dataset_id'].nil?
45
44
 
46
45
  # header parameters
47
46
  header_params = opts[:header_params] || {}
48
47
  # HTTP header 'Accept' (if needed)
49
48
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
49
+ # HTTP header 'Content-Type'
50
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
50
51
 
51
52
  # form parameters
52
53
  form_params = opts[:form_params] || {}
53
54
 
54
55
  # http body (model)
55
- post_body = opts[:debug_body]
56
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_people_input'])
56
57
 
57
58
  # return_type
58
- return_type = opts[:debug_return_type] || 'Array<Person>'
59
+ return_type = opts[:debug_return_type] || 'Person'
59
60
 
60
61
  # auth_names
61
62
  auth_names = opts[:debug_auth_names] || ['authToken']
62
63
 
63
64
  new_options = opts.merge(
64
- :operation => :"PeopleApi.get_api_v1_people",
65
+ :operation => :"PeopleApi.create_people",
65
66
  :header_params => header_params,
66
67
  :query_params => query_params,
67
68
  :form_params => form_params,
@@ -70,69 +71,56 @@ module Quake::Timesheets
70
71
  :return_type => return_type
71
72
  )
72
73
 
73
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
74
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
74
75
  if @api_client.config.debugging
75
- @api_client.config.logger.debug "API called: PeopleApi#get_api_v1_people\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
76
+ @api_client.config.logger.debug "API called: PeopleApi#create_people\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
76
77
  end
77
78
  return data, status_code, headers
78
79
  end
79
80
 
80
- # Create a new Person record
81
- # @param name [String] Human readable name for the Person object (usually the subject&#39;s real name)
82
- # @param dataset_id [String] Dataset to which the Person object should belong
81
+ # Search for people matching filters
83
82
  # @param [Hash] opts the optional parameters
84
- # @return [Person]
85
- def post_api_v1_people(name, dataset_id, opts = {})
86
- data, _status_code, _headers = post_api_v1_people_with_http_info(name, dataset_id, opts)
83
+ # @option opts [String] :dataset_id Filter to the people belonging to one of the identified datasets
84
+ # @return [Array<Person>]
85
+ def index_people(opts = {})
86
+ data, _status_code, _headers = index_people_with_http_info(opts)
87
87
  data
88
88
  end
89
89
 
90
- # Create a new Person record
91
- # @param name [String] Human readable name for the Person object (usually the subject&#39;s real name)
92
- # @param dataset_id [String] Dataset to which the Person object should belong
90
+ # Search for people matching filters
93
91
  # @param [Hash] opts the optional parameters
94
- # @return [Array<(Person, Integer, Hash)>] Person data, response status code and response headers
95
- def post_api_v1_people_with_http_info(name, dataset_id, opts = {})
92
+ # @option opts [String] :dataset_id Filter to the people belonging to one of the identified datasets
93
+ # @return [Array<(Array<Person>, Integer, Hash)>] Array<Person> data, response status code and response headers
94
+ def index_people_with_http_info(opts = {})
96
95
  if @api_client.config.debugging
97
- @api_client.config.logger.debug 'Calling API: PeopleApi.post_api_v1_people ...'
98
- end
99
- # verify the required parameter 'name' is set
100
- if @api_client.config.client_side_validation && name.nil?
101
- fail ArgumentError, "Missing the required parameter 'name' when calling PeopleApi.post_api_v1_people"
102
- end
103
- # verify the required parameter 'dataset_id' is set
104
- if @api_client.config.client_side_validation && dataset_id.nil?
105
- fail ArgumentError, "Missing the required parameter 'dataset_id' when calling PeopleApi.post_api_v1_people"
96
+ @api_client.config.logger.debug 'Calling API: PeopleApi.index_people ...'
106
97
  end
107
98
  # resource path
108
99
  local_var_path = '/api/v1/people'
109
100
 
110
101
  # query parameters
111
102
  query_params = opts[:query_params] || {}
103
+ query_params[:'dataset_id'] = opts[:'dataset_id'] if !opts[:'dataset_id'].nil?
112
104
 
113
105
  # header parameters
114
106
  header_params = opts[:header_params] || {}
115
107
  # HTTP header 'Accept' (if needed)
116
108
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])
117
- # HTTP header 'Content-Type'
118
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded', 'multipart/form-data'])
119
109
 
120
110
  # form parameters
121
111
  form_params = opts[:form_params] || {}
122
- form_params['name'] = name
123
- form_params['dataset_id'] = dataset_id
124
112
 
125
113
  # http body (model)
126
114
  post_body = opts[:debug_body]
127
115
 
128
116
  # return_type
129
- return_type = opts[:debug_return_type] || 'Person'
117
+ return_type = opts[:debug_return_type] || 'Array<Person>'
130
118
 
131
119
  # auth_names
132
120
  auth_names = opts[:debug_auth_names] || ['authToken']
133
121
 
134
122
  new_options = opts.merge(
135
- :operation => :"PeopleApi.post_api_v1_people",
123
+ :operation => :"PeopleApi.index_people",
136
124
  :header_params => header_params,
137
125
  :query_params => query_params,
138
126
  :form_params => form_params,
@@ -141,9 +129,9 @@ module Quake::Timesheets
141
129
  :return_type => return_type
142
130
  )
143
131
 
144
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
132
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
145
133
  if @api_client.config.debugging
146
- @api_client.config.logger.debug "API called: PeopleApi#post_api_v1_people\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
134
+ @api_client.config.logger.debug "API called: PeopleApi#index_people\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
147
135
  end
148
136
  return data, status_code, headers
149
137
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- #TimesheetsApi (params in:formData)
2
+ #TimesheetsApi (params in:body)
3
3
 
4
4
  # <p>Another API description</p>
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- #TimesheetsApi (params in:formData)
2
+ #TimesheetsApi (params in:body)
3
3
 
4
4
  # <p>Another API description</p>
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- #TimesheetsApi (params in:formData)
2
+ #TimesheetsApi (params in:body)
3
3
 
4
4
  # <p>Another API description</p>
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- #TimesheetsApi (params in:formData)
2
+ #TimesheetsApi (params in:body)
3
3
 
4
4
  # <p>Another API description</p>
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- #TimesheetsApi (params in:formData)
2
+ #TimesheetsApi (params in:body)
3
3
 
4
4
  # <p>Another API description</p>
5
5
 
@@ -0,0 +1,254 @@
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 CreateApprovalTypesInput
18
+ # ID of the dataset this approval type is linked to
19
+ attr_accessor :dataset_id
20
+
21
+ # The name of the approval type
22
+ attr_accessor :name
23
+
24
+ # The weight provided by approvals of this type
25
+ attr_accessor :weight
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'dataset_id' => :'dataset_id',
31
+ :'name' => :'name',
32
+ :'weight' => :'weight'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'dataset_id' => :'String',
45
+ :'name' => :'String',
46
+ :'weight' => :'Float'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Quake::Timesheets::CreateApprovalTypesInput` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Quake::Timesheets::CreateApprovalTypesInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'dataset_id')
72
+ self.dataset_id = attributes[:'dataset_id']
73
+ end
74
+
75
+ if attributes.key?(:'name')
76
+ self.name = attributes[:'name']
77
+ end
78
+
79
+ if attributes.key?(:'weight')
80
+ self.weight = attributes[:'weight']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @dataset_id.nil?
89
+ invalid_properties.push('invalid value for "dataset_id", dataset_id cannot be nil.')
90
+ end
91
+
92
+ if @name.nil?
93
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
94
+ end
95
+
96
+ if @weight.nil?
97
+ invalid_properties.push('invalid value for "weight", weight cannot be nil.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ return false if @dataset_id.nil?
107
+ return false if @name.nil?
108
+ return false if @weight.nil?
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ dataset_id == o.dataset_id &&
118
+ name == o.name &&
119
+ weight == o.weight
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [dataset_id, name, weight].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ new.build_from_hash(attributes)
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.openapi_types.each_pair do |key, type|
147
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
148
+ self.send("#{key}=", nil)
149
+ elsif type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
154
+ end
155
+ elsif !attributes[self.class.attribute_map[key]].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
+ end
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :Time
170
+ Time.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :Boolean
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ # models (e.g. Pet) or oneOf
201
+ klass = Quake::Timesheets.const_get(type)
202
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Outputs non-array value in the form of hash
235
+ # For object, use to_hash. Otherwise, just return the value
236
+ # @param [Object] value Any valid value
237
+ # @return [Hash] Returns the value in the form of hash
238
+ def _to_hash(value)
239
+ if value.is_a?(Array)
240
+ value.compact.map { |v| _to_hash(v) }
241
+ elsif value.is_a?(Hash)
242
+ {}.tap do |hash|
243
+ value.each { |k, v| hash[k] = _to_hash(v) }
244
+ end
245
+ elsif value.respond_to? :to_hash
246
+ value.to_hash
247
+ else
248
+ value
249
+ end
250
+ end
251
+
252
+ end
253
+
254
+ end