quake_timesheets_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/GENERATING_README.md +17 -0
  3. data/Gemfile +9 -0
  4. data/README.md +161 -0
  5. data/Rakefile +10 -0
  6. data/build.sh +10 -0
  7. data/commands +13 -0
  8. data/docs/Approval.md +34 -0
  9. data/docs/ApprovalType.md +24 -0
  10. data/docs/ApprovalTypesApi.md +153 -0
  11. data/docs/ApprovalsApi.md +153 -0
  12. data/docs/Dataset.md +24 -0
  13. data/docs/DatasetsApi.md +214 -0
  14. data/docs/EntriesApi.md +251 -0
  15. data/docs/Entry.md +36 -0
  16. data/docs/PeopleApi.md +151 -0
  17. data/docs/Person.md +22 -0
  18. data/git_push.sh +58 -0
  19. data/lib/quake_timesheets_client.rb +58 -0
  20. data/lib/quake_timesheets_client/api/approval_types_api.rb +158 -0
  21. data/lib/quake_timesheets_client/api/approvals_api.rb +174 -0
  22. data/lib/quake_timesheets_client/api/datasets_api.rb +202 -0
  23. data/lib/quake_timesheets_client/api/entries_api.rb +253 -0
  24. data/lib/quake_timesheets_client/api/people_api.rb +151 -0
  25. data/lib/quake_timesheets_client/api_client.rb +396 -0
  26. data/lib/quake_timesheets_client/api_error.rb +57 -0
  27. data/lib/quake_timesheets_client/configuration.rb +302 -0
  28. data/lib/quake_timesheets_client/models/approval.rb +378 -0
  29. data/lib/quake_timesheets_client/models/approval_type.rb +269 -0
  30. data/lib/quake_timesheets_client/models/dataset.rb +268 -0
  31. data/lib/quake_timesheets_client/models/entry.rb +361 -0
  32. data/lib/quake_timesheets_client/models/person.rb +254 -0
  33. data/lib/quake_timesheets_client/version.rb +24 -0
  34. data/quake_timesheets_client.gemspec +38 -0
  35. data/ruby-templates/README.mustache +187 -0
  36. data/ruby-templates/api_client.mustache +263 -0
  37. data/ruby-templates/api_client_faraday_partial.mustache +140 -0
  38. data/ruby-templates/configuration.mustache +379 -0
  39. data/ruby-templates/gem.mustache +59 -0
  40. data/ruby-templates/version.mustache +16 -0
  41. data/ruby.config.yaml +10 -0
  42. data/spec/api/approval_types_api_spec.rb +59 -0
  43. data/spec/api/approvals_api_spec.rb +60 -0
  44. data/spec/api/datasets_api_spec.rb +67 -0
  45. data/spec/api/entries_api_spec.rb +82 -0
  46. data/spec/api/people_api_spec.rb +58 -0
  47. data/spec/api_client_spec.rb +188 -0
  48. data/spec/configuration_spec.rb +42 -0
  49. data/spec/models/approval_spec.rb +86 -0
  50. data/spec/models/approval_type_spec.rb +52 -0
  51. data/spec/models/dataset_spec.rb +52 -0
  52. data/spec/models/entry_spec.rb +92 -0
  53. data/spec/models/person_spec.rb +46 -0
  54. data/spec/spec_helper.rb +111 -0
  55. metadata +149 -0
@@ -0,0 +1,174 @@
1
+ =begin
2
+ #TimesheetsApi (params in:formData)
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 'cgi'
14
+
15
+ module Quake::Timesheets
16
+ class ApprovalsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Search for approval types matching filters
23
+ # @param dataset_id [String] Filter to the approvals belonging to one of the identified datasets
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Array<Approval>]
26
+ def get_api_v1_approvals(dataset_id, opts = {})
27
+ data, _status_code, _headers = get_api_v1_approvals_with_http_info(dataset_id, opts)
28
+ data
29
+ end
30
+
31
+ # Search for approval types matching filters
32
+ # @param dataset_id [String] Filter to the approvals belonging to one of the identified datasets
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Array<Approval>, Integer, Hash)>] Array<Approval> data, response status code and response headers
35
+ def get_api_v1_approvals_with_http_info(dataset_id, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: ApprovalsApi.get_api_v1_approvals ...'
38
+ end
39
+ # verify the required parameter 'dataset_id' is set
40
+ if @api_client.config.client_side_validation && dataset_id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'dataset_id' when calling ApprovalsApi.get_api_v1_approvals"
42
+ end
43
+ # resource path
44
+ local_var_path = '/api/v1/approvals'
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+ query_params[:'dataset_id'] = dataset_id
49
+
50
+ # header parameters
51
+ header_params = opts[:header_params] || {}
52
+ # HTTP header 'Accept' (if needed)
53
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
54
+
55
+ # form parameters
56
+ form_params = opts[:form_params] || {}
57
+
58
+ # http body (model)
59
+ post_body = opts[:debug_body]
60
+
61
+ # return_type
62
+ return_type = opts[:debug_return_type] || 'Array<Approval>'
63
+
64
+ # auth_names
65
+ auth_names = opts[:debug_auth_names] || ['authToken']
66
+
67
+ new_options = opts.merge(
68
+ :operation => :"ApprovalsApi.get_api_v1_approvals",
69
+ :header_params => header_params,
70
+ :query_params => query_params,
71
+ :form_params => form_params,
72
+ :body => post_body,
73
+ :auth_names => auth_names,
74
+ :return_type => return_type
75
+ )
76
+
77
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
78
+ if @api_client.config.debugging
79
+ @api_client.config.logger.debug "API called: ApprovalsApi#get_api_v1_approvals\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
80
+ end
81
+ return data, status_code, headers
82
+ end
83
+
84
+ # Create a new Approval
85
+ # @param state [String]
86
+ # @param approval_type_id [String] The ID of the Approval Type of this Approval
87
+ # @param entry_ids [Array<String>] The ID of the Entry this Approval is linked to
88
+ # @param dataset_id [String] ID of the dataset this approval type is linked to
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [Approval]
91
+ def post_api_v1_approvals(state, approval_type_id, entry_ids, dataset_id, opts = {})
92
+ data, _status_code, _headers = post_api_v1_approvals_with_http_info(state, approval_type_id, entry_ids, dataset_id, opts)
93
+ data
94
+ end
95
+
96
+ # Create a new Approval
97
+ # @param state [String]
98
+ # @param approval_type_id [String] The ID of the Approval Type of this Approval
99
+ # @param entry_ids [Array<String>] The ID of the Entry this Approval is linked to
100
+ # @param dataset_id [String] ID of the dataset this approval type is linked to
101
+ # @param [Hash] opts the optional parameters
102
+ # @return [Array<(Approval, Integer, Hash)>] Approval data, response status code and response headers
103
+ def post_api_v1_approvals_with_http_info(state, approval_type_id, entry_ids, dataset_id, opts = {})
104
+ if @api_client.config.debugging
105
+ @api_client.config.logger.debug 'Calling API: ApprovalsApi.post_api_v1_approvals ...'
106
+ end
107
+ # verify the required parameter 'state' is set
108
+ if @api_client.config.client_side_validation && state.nil?
109
+ fail ArgumentError, "Missing the required parameter 'state' when calling ApprovalsApi.post_api_v1_approvals"
110
+ end
111
+ # verify enum value
112
+ allowable_values = ["requested", "approved", "withdrawn"]
113
+ if @api_client.config.client_side_validation && !allowable_values.include?(state)
114
+ fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
115
+ end
116
+ # verify the required parameter 'approval_type_id' is set
117
+ if @api_client.config.client_side_validation && approval_type_id.nil?
118
+ fail ArgumentError, "Missing the required parameter 'approval_type_id' when calling ApprovalsApi.post_api_v1_approvals"
119
+ end
120
+ # verify the required parameter 'entry_ids' is set
121
+ if @api_client.config.client_side_validation && entry_ids.nil?
122
+ fail ArgumentError, "Missing the required parameter 'entry_ids' when calling ApprovalsApi.post_api_v1_approvals"
123
+ end
124
+ # verify the required parameter 'dataset_id' is set
125
+ if @api_client.config.client_side_validation && dataset_id.nil?
126
+ fail ArgumentError, "Missing the required parameter 'dataset_id' when calling ApprovalsApi.post_api_v1_approvals"
127
+ end
128
+ # resource path
129
+ local_var_path = '/api/v1/approvals'
130
+
131
+ # query parameters
132
+ query_params = opts[:query_params] || {}
133
+
134
+ # header parameters
135
+ header_params = opts[:header_params] || {}
136
+ # HTTP header 'Accept' (if needed)
137
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
138
+ # HTTP header 'Content-Type'
139
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded', 'multipart/form-data'])
140
+
141
+ # form parameters
142
+ form_params = opts[:form_params] || {}
143
+ form_params['state'] = state
144
+ form_params['approval_type_id'] = approval_type_id
145
+ form_params['entry_ids'] = @api_client.build_collection_param(entry_ids, :csv)
146
+ form_params['dataset_id'] = dataset_id
147
+
148
+ # http body (model)
149
+ post_body = opts[:debug_body]
150
+
151
+ # return_type
152
+ return_type = opts[:debug_return_type] || 'Approval'
153
+
154
+ # auth_names
155
+ auth_names = opts[:debug_auth_names] || ['authToken']
156
+
157
+ new_options = opts.merge(
158
+ :operation => :"ApprovalsApi.post_api_v1_approvals",
159
+ :header_params => header_params,
160
+ :query_params => query_params,
161
+ :form_params => form_params,
162
+ :body => post_body,
163
+ :auth_names => auth_names,
164
+ :return_type => return_type
165
+ )
166
+
167
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
168
+ if @api_client.config.debugging
169
+ @api_client.config.logger.debug "API called: ApprovalsApi#post_api_v1_approvals\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
170
+ end
171
+ return data, status_code, headers
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,202 @@
1
+ =begin
2
+ #TimesheetsApi (params in:formData)
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 'cgi'
14
+
15
+ module Quake::Timesheets
16
+ class DatasetsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List all available datasets
23
+ # @param [Hash] opts the optional parameters
24
+ # @return [Array<Dataset>]
25
+ def get_api_v1_datasets(opts = {})
26
+ data, _status_code, _headers = get_api_v1_datasets_with_http_info(opts)
27
+ data
28
+ end
29
+
30
+ # List all available datasets
31
+ # @param [Hash] opts the optional parameters
32
+ # @return [Array<(Array<Dataset>, Integer, Hash)>] Array<Dataset> data, response status code and response headers
33
+ def get_api_v1_datasets_with_http_info(opts = {})
34
+ if @api_client.config.debugging
35
+ @api_client.config.logger.debug 'Calling API: DatasetsApi.get_api_v1_datasets ...'
36
+ end
37
+ # resource path
38
+ local_var_path = '/api/v1/datasets'
39
+
40
+ # query parameters
41
+ query_params = opts[:query_params] || {}
42
+
43
+ # header parameters
44
+ header_params = opts[:header_params] || {}
45
+ # HTTP header 'Accept' (if needed)
46
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
47
+
48
+ # form parameters
49
+ form_params = opts[:form_params] || {}
50
+
51
+ # http body (model)
52
+ post_body = opts[:debug_body]
53
+
54
+ # return_type
55
+ return_type = opts[:debug_return_type] || 'Array<Dataset>'
56
+
57
+ # auth_names
58
+ auth_names = opts[:debug_auth_names] || ['authToken']
59
+
60
+ new_options = opts.merge(
61
+ :operation => :"DatasetsApi.get_api_v1_datasets",
62
+ :header_params => header_params,
63
+ :query_params => query_params,
64
+ :form_params => form_params,
65
+ :body => post_body,
66
+ :auth_names => auth_names,
67
+ :return_type => return_type
68
+ )
69
+
70
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
71
+ if @api_client.config.debugging
72
+ @api_client.config.logger.debug "API called: DatasetsApi#get_api_v1_datasets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
73
+ end
74
+ return data, status_code, headers
75
+ end
76
+
77
+ # Show details about a specific dataset
78
+ # @param id [String] ID of the dataset
79
+ # @param [Hash] opts the optional parameters
80
+ # @return [Dataset]
81
+ def get_api_v1_datasets_id(id, opts = {})
82
+ data, _status_code, _headers = get_api_v1_datasets_id_with_http_info(id, opts)
83
+ data
84
+ end
85
+
86
+ # Show details about a specific dataset
87
+ # @param id [String] ID of the dataset
88
+ # @param [Hash] opts the optional parameters
89
+ # @return [Array<(Dataset, Integer, Hash)>] Dataset data, response status code and response headers
90
+ def get_api_v1_datasets_id_with_http_info(id, opts = {})
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug 'Calling API: DatasetsApi.get_api_v1_datasets_id ...'
93
+ end
94
+ # verify the required parameter 'id' is set
95
+ if @api_client.config.client_side_validation && id.nil?
96
+ fail ArgumentError, "Missing the required parameter 'id' when calling DatasetsApi.get_api_v1_datasets_id"
97
+ end
98
+ # resource path
99
+ local_var_path = '/api/v1/datasets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
100
+
101
+ # query parameters
102
+ query_params = opts[:query_params] || {}
103
+
104
+ # header parameters
105
+ header_params = opts[:header_params] || {}
106
+ # HTTP header 'Accept' (if needed)
107
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
108
+
109
+ # form parameters
110
+ form_params = opts[:form_params] || {}
111
+
112
+ # http body (model)
113
+ post_body = opts[:debug_body]
114
+
115
+ # return_type
116
+ return_type = opts[:debug_return_type] || 'Dataset'
117
+
118
+ # auth_names
119
+ auth_names = opts[:debug_auth_names] || ['authToken']
120
+
121
+ new_options = opts.merge(
122
+ :operation => :"DatasetsApi.get_api_v1_datasets_id",
123
+ :header_params => header_params,
124
+ :query_params => query_params,
125
+ :form_params => form_params,
126
+ :body => post_body,
127
+ :auth_names => auth_names,
128
+ :return_type => return_type
129
+ )
130
+
131
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
132
+ if @api_client.config.debugging
133
+ @api_client.config.logger.debug "API called: DatasetsApi#get_api_v1_datasets_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
134
+ end
135
+ return data, status_code, headers
136
+ end
137
+
138
+ # Create a new Dataset record
139
+ # @param name [String] Name for the Dataset object
140
+ # @param [Hash] opts the optional parameters
141
+ # @return [Dataset]
142
+ def post_api_v1_datasets(name, opts = {})
143
+ data, _status_code, _headers = post_api_v1_datasets_with_http_info(name, opts)
144
+ data
145
+ end
146
+
147
+ # Create a new Dataset record
148
+ # @param name [String] Name for the Dataset object
149
+ # @param [Hash] opts the optional parameters
150
+ # @return [Array<(Dataset, Integer, Hash)>] Dataset data, response status code and response headers
151
+ def post_api_v1_datasets_with_http_info(name, opts = {})
152
+ if @api_client.config.debugging
153
+ @api_client.config.logger.debug 'Calling API: DatasetsApi.post_api_v1_datasets ...'
154
+ end
155
+ # verify the required parameter 'name' is set
156
+ if @api_client.config.client_side_validation && name.nil?
157
+ fail ArgumentError, "Missing the required parameter 'name' when calling DatasetsApi.post_api_v1_datasets"
158
+ end
159
+ # resource path
160
+ local_var_path = '/api/v1/datasets'
161
+
162
+ # query parameters
163
+ query_params = opts[:query_params] || {}
164
+
165
+ # header parameters
166
+ header_params = opts[:header_params] || {}
167
+ # HTTP header 'Accept' (if needed)
168
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
169
+ # HTTP header 'Content-Type'
170
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded', 'multipart/form-data'])
171
+
172
+ # form parameters
173
+ form_params = opts[:form_params] || {}
174
+ form_params['name'] = name
175
+
176
+ # http body (model)
177
+ post_body = opts[:debug_body]
178
+
179
+ # return_type
180
+ return_type = opts[:debug_return_type] || 'Dataset'
181
+
182
+ # auth_names
183
+ auth_names = opts[:debug_auth_names] || ['authToken']
184
+
185
+ new_options = opts.merge(
186
+ :operation => :"DatasetsApi.post_api_v1_datasets",
187
+ :header_params => header_params,
188
+ :query_params => query_params,
189
+ :form_params => form_params,
190
+ :body => post_body,
191
+ :auth_names => auth_names,
192
+ :return_type => return_type
193
+ )
194
+
195
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
196
+ if @api_client.config.debugging
197
+ @api_client.config.logger.debug "API called: DatasetsApi#post_api_v1_datasets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
198
+ end
199
+ return data, status_code, headers
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,253 @@
1
+ =begin
2
+ #TimesheetsApi (params in:formData)
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 'cgi'
14
+
15
+ module Quake::Timesheets
16
+ class EntriesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Search for entries matching filters
23
+ # @param [Hash] opts the optional parameters
24
+ # @option opts [String] :dataset_id Filter to the entries belonging to one of the identified datasets
25
+ # @option opts [String] :person_id Filter to the entries belonging to one of the identified people
26
+ # @option opts [String] :from_date Return only entries after this DateTime (inclusive)
27
+ # @option opts [String] :to_date Return only entries before this DateTime (inclusive)
28
+ # @return [Array<Entry>]
29
+ def get_api_v1_entries(opts = {})
30
+ data, _status_code, _headers = get_api_v1_entries_with_http_info(opts)
31
+ data
32
+ end
33
+
34
+ # Search for entries matching filters
35
+ # @param [Hash] opts the optional parameters
36
+ # @option opts [String] :dataset_id Filter to the entries belonging to one of the identified datasets
37
+ # @option opts [String] :person_id Filter to the entries belonging to one of the identified people
38
+ # @option opts [String] :from_date Return only entries after this DateTime (inclusive)
39
+ # @option opts [String] :to_date Return only entries before this DateTime (inclusive)
40
+ # @return [Array<(Array<Entry>, Integer, Hash)>] Array<Entry> data, response status code and response headers
41
+ def get_api_v1_entries_with_http_info(opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: EntriesApi.get_api_v1_entries ...'
44
+ end
45
+ # resource path
46
+ local_var_path = '/api/v1/entries'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+ query_params[:'dataset_id'] = opts[:'dataset_id'] if !opts[:'dataset_id'].nil?
51
+ query_params[:'person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
52
+ query_params[:'from_date'] = opts[:'from_date'] if !opts[:'from_date'].nil?
53
+ query_params[:'to_date'] = opts[:'to_date'] if !opts[:'to_date'].nil?
54
+
55
+ # header parameters
56
+ header_params = opts[:header_params] || {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
59
+
60
+ # form parameters
61
+ form_params = opts[:form_params] || {}
62
+
63
+ # http body (model)
64
+ post_body = opts[:debug_body]
65
+
66
+ # return_type
67
+ return_type = opts[:debug_return_type] || 'Array<Entry>'
68
+
69
+ # auth_names
70
+ auth_names = opts[:debug_auth_names] || ['authToken']
71
+
72
+ new_options = opts.merge(
73
+ :operation => :"EntriesApi.get_api_v1_entries",
74
+ :header_params => header_params,
75
+ :query_params => query_params,
76
+ :form_params => form_params,
77
+ :body => post_body,
78
+ :auth_names => auth_names,
79
+ :return_type => return_type
80
+ )
81
+
82
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
83
+ if @api_client.config.debugging
84
+ @api_client.config.logger.debug "API called: EntriesApi#get_api_v1_entries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
85
+ end
86
+ return data, status_code, headers
87
+ end
88
+
89
+ # Create a new Entry
90
+ # @param [Hash] opts the optional parameters
91
+ # @option opts [String] :person_id ID of the person to which this entry pertains
92
+ # @option opts [String] :start_at Time period at which this entry starts
93
+ # @option opts [String] :end_at Time period at which this entry ends
94
+ # @option opts [Float] :quantity
95
+ # @option opts [String] :unit
96
+ # @option opts [String] :external_reference Unique identifier of the activity this Entry relates to
97
+ # @return [Entry]
98
+ def post_api_v1_entries(opts = {})
99
+ data, _status_code, _headers = post_api_v1_entries_with_http_info(opts)
100
+ data
101
+ end
102
+
103
+ # Create a new Entry
104
+ # @param [Hash] opts the optional parameters
105
+ # @option opts [String] :person_id ID of the person to which this entry pertains
106
+ # @option opts [String] :start_at Time period at which this entry starts
107
+ # @option opts [String] :end_at Time period at which this entry ends
108
+ # @option opts [Float] :quantity
109
+ # @option opts [String] :unit
110
+ # @option opts [String] :external_reference Unique identifier of the activity this Entry relates to
111
+ # @return [Array<(Entry, Integer, Hash)>] Entry data, response status code and response headers
112
+ def post_api_v1_entries_with_http_info(opts = {})
113
+ if @api_client.config.debugging
114
+ @api_client.config.logger.debug 'Calling API: EntriesApi.post_api_v1_entries ...'
115
+ end
116
+ allowable_values = ["hour", "day", "week", "month", "other"]
117
+ if @api_client.config.client_side_validation && opts[:'unit'] && !allowable_values.include?(opts[:'unit'])
118
+ fail ArgumentError, "invalid value for \"unit\", must be one of #{allowable_values}"
119
+ end
120
+ # resource path
121
+ local_var_path = '/api/v1/entries'
122
+
123
+ # query parameters
124
+ query_params = opts[:query_params] || {}
125
+
126
+ # header parameters
127
+ header_params = opts[:header_params] || {}
128
+ # HTTP header 'Accept' (if needed)
129
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
130
+ # HTTP header 'Content-Type'
131
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded', 'multipart/form-data'])
132
+
133
+ # form parameters
134
+ form_params = opts[:form_params] || {}
135
+ form_params['person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
136
+ form_params['start_at'] = opts[:'start_at'] if !opts[:'start_at'].nil?
137
+ form_params['end_at'] = opts[:'end_at'] if !opts[:'end_at'].nil?
138
+ form_params['quantity'] = opts[:'quantity'] if !opts[:'quantity'].nil?
139
+ form_params['unit'] = opts[:'unit'] if !opts[:'unit'].nil?
140
+ form_params['external_reference'] = opts[:'external_reference'] if !opts[:'external_reference'].nil?
141
+
142
+ # http body (model)
143
+ post_body = opts[:debug_body]
144
+
145
+ # return_type
146
+ return_type = opts[:debug_return_type] || 'Entry'
147
+
148
+ # auth_names
149
+ auth_names = opts[:debug_auth_names] || ['authToken']
150
+
151
+ new_options = opts.merge(
152
+ :operation => :"EntriesApi.post_api_v1_entries",
153
+ :header_params => header_params,
154
+ :query_params => query_params,
155
+ :form_params => form_params,
156
+ :body => post_body,
157
+ :auth_names => auth_names,
158
+ :return_type => return_type
159
+ )
160
+
161
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
162
+ if @api_client.config.debugging
163
+ @api_client.config.logger.debug "API called: EntriesApi#post_api_v1_entries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
164
+ end
165
+ return data, status_code, headers
166
+ end
167
+
168
+ # Update an existing Entry
169
+ # @param id [String] The ID for the Entry
170
+ # @param [Hash] opts the optional parameters
171
+ # @option opts [String] :person_id ID of the person to which this entry pertains
172
+ # @option opts [String] :start_at Time period at which this entry starts
173
+ # @option opts [String] :end_at Time period at which this entry ends
174
+ # @option opts [Float] :quantity
175
+ # @option opts [String] :unit
176
+ # @option opts [String] :external_reference Unique identifier of the activity this Entry relates to
177
+ # @return [Entry]
178
+ def post_api_v1_entries_id(id, opts = {})
179
+ data, _status_code, _headers = post_api_v1_entries_id_with_http_info(id, opts)
180
+ data
181
+ end
182
+
183
+ # Update an existing Entry
184
+ # @param id [String] The ID for the Entry
185
+ # @param [Hash] opts the optional parameters
186
+ # @option opts [String] :person_id ID of the person to which this entry pertains
187
+ # @option opts [String] :start_at Time period at which this entry starts
188
+ # @option opts [String] :end_at Time period at which this entry ends
189
+ # @option opts [Float] :quantity
190
+ # @option opts [String] :unit
191
+ # @option opts [String] :external_reference Unique identifier of the activity this Entry relates to
192
+ # @return [Array<(Entry, Integer, Hash)>] Entry data, response status code and response headers
193
+ def post_api_v1_entries_id_with_http_info(id, opts = {})
194
+ if @api_client.config.debugging
195
+ @api_client.config.logger.debug 'Calling API: EntriesApi.post_api_v1_entries_id ...'
196
+ end
197
+ # verify the required parameter 'id' is set
198
+ if @api_client.config.client_side_validation && id.nil?
199
+ fail ArgumentError, "Missing the required parameter 'id' when calling EntriesApi.post_api_v1_entries_id"
200
+ end
201
+ allowable_values = ["hour", "day", "week", "month", "other"]
202
+ if @api_client.config.client_side_validation && opts[:'unit'] && !allowable_values.include?(opts[:'unit'])
203
+ fail ArgumentError, "invalid value for \"unit\", must be one of #{allowable_values}"
204
+ end
205
+ # resource path
206
+ local_var_path = '/api/v1/entries/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
207
+
208
+ # query parameters
209
+ query_params = opts[:query_params] || {}
210
+
211
+ # header parameters
212
+ header_params = opts[:header_params] || {}
213
+ # HTTP header 'Accept' (if needed)
214
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
215
+ # HTTP header 'Content-Type'
216
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded', 'multipart/form-data'])
217
+
218
+ # form parameters
219
+ form_params = opts[:form_params] || {}
220
+ form_params['person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
221
+ form_params['start_at'] = opts[:'start_at'] if !opts[:'start_at'].nil?
222
+ form_params['end_at'] = opts[:'end_at'] if !opts[:'end_at'].nil?
223
+ form_params['quantity'] = opts[:'quantity'] if !opts[:'quantity'].nil?
224
+ form_params['unit'] = opts[:'unit'] if !opts[:'unit'].nil?
225
+ form_params['external_reference'] = opts[:'external_reference'] if !opts[:'external_reference'].nil?
226
+
227
+ # http body (model)
228
+ post_body = opts[:debug_body]
229
+
230
+ # return_type
231
+ return_type = opts[:debug_return_type] || 'Entry'
232
+
233
+ # auth_names
234
+ auth_names = opts[:debug_auth_names] || ['authToken']
235
+
236
+ new_options = opts.merge(
237
+ :operation => :"EntriesApi.post_api_v1_entries_id",
238
+ :header_params => header_params,
239
+ :query_params => query_params,
240
+ :form_params => form_params,
241
+ :body => post_body,
242
+ :auth_names => auth_names,
243
+ :return_type => return_type
244
+ )
245
+
246
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
247
+ if @api_client.config.debugging
248
+ @api_client.config.logger.debug "API called: EntriesApi#post_api_v1_entries_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
249
+ end
250
+ return data, status_code, headers
251
+ end
252
+ end
253
+ end