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
data/docs/Entry.md ADDED
@@ -0,0 +1,36 @@
1
+ # Quake::Timesheets::Entry
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | The ID for the entry | |
8
+ | **dataset_id** | **String** | ID of the dataset to which this entry is linked | |
9
+ | **person_id** | **String** | ID of the person to which this entry pertains | [optional] |
10
+ | **start_at** | **String** | Time period at which this entry starts | [optional] |
11
+ | **end_at** | **String** | Time period at which this entry ends | [optional] |
12
+ | **quantity** | **Float** | | [optional] |
13
+ | **unit** | **String** | | [optional] |
14
+ | **external_reference** | **String** | Unique identifier of the activity this Entry relates to | [optional] |
15
+ | **created_at** | **String** | Time at which the record was created | |
16
+ | **updated_at** | **String** | Time at which the record was updated | |
17
+
18
+ ## Example
19
+
20
+ ```ruby
21
+ require 'quake_timesheets_client'
22
+
23
+ instance = Quake::Timesheets::Entry.new(
24
+ id: null,
25
+ dataset_id: null,
26
+ person_id: null,
27
+ start_at: null,
28
+ end_at: null,
29
+ quantity: null,
30
+ unit: null,
31
+ external_reference: null,
32
+ created_at: null,
33
+ updated_at: null
34
+ )
35
+ ```
36
+
data/docs/PeopleApi.md ADDED
@@ -0,0 +1,151 @@
1
+ # Quake::Timesheets::PeopleApi
2
+
3
+ All URIs are relative to *https://timesheetsapi.svc.lumbry.co.uk:443*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**get_api_v1_people**](PeopleApi.md#get_api_v1_people) | **GET** /api/v1/people | Search for people matching filters |
8
+ | [**post_api_v1_people**](PeopleApi.md#post_api_v1_people) | **POST** /api/v1/people | Create a new Person record |
9
+
10
+
11
+ ## get_api_v1_people
12
+
13
+ > <Array<Person>> get_api_v1_people(opts)
14
+
15
+ Search for people matching filters
16
+
17
+ ### Examples
18
+
19
+ ```ruby
20
+ require 'time'
21
+ require 'quake_timesheets_client'
22
+ # setup authorization
23
+ Quake::Timesheets.configure do |config|
24
+ # Configure API key authorization: authToken
25
+ config.api_key['authToken'] = 'YOUR API KEY'
26
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
27
+ # config.api_key_prefix['authToken'] = 'Bearer'
28
+ end
29
+
30
+ api_instance = Quake::Timesheets::PeopleApi.new
31
+ opts = {
32
+ dataset_id: 'dataset_id_example' # String | Filter to the people belonging to one of the identified datasets
33
+ }
34
+
35
+ begin
36
+ # Search for people matching filters
37
+ result = api_instance.get_api_v1_people(opts)
38
+ p result
39
+ rescue Quake::Timesheets::ApiError => e
40
+ puts "Error when calling PeopleApi->get_api_v1_people: #{e}"
41
+ end
42
+ ```
43
+
44
+ #### Using the get_api_v1_people_with_http_info variant
45
+
46
+ This returns an Array which contains the response data, status code and headers.
47
+
48
+ > <Array(<Array<Person>>, Integer, Hash)> get_api_v1_people_with_http_info(opts)
49
+
50
+ ```ruby
51
+ begin
52
+ # Search for people matching filters
53
+ data, status_code, headers = api_instance.get_api_v1_people_with_http_info(opts)
54
+ p status_code # => 2xx
55
+ p headers # => { ... }
56
+ p data # => <Array<Person>>
57
+ rescue Quake::Timesheets::ApiError => e
58
+ puts "Error when calling PeopleApi->get_api_v1_people_with_http_info: #{e}"
59
+ end
60
+ ```
61
+
62
+ ### Parameters
63
+
64
+ | Name | Type | Description | Notes |
65
+ | ---- | ---- | ----------- | ----- |
66
+ | **dataset_id** | **String** | Filter to the people belonging to one of the identified datasets | [optional] |
67
+
68
+ ### Return type
69
+
70
+ [**Array&lt;Person&gt;**](Person.md)
71
+
72
+ ### Authorization
73
+
74
+ [authToken](../README.md#authToken)
75
+
76
+ ### HTTP request headers
77
+
78
+ - **Content-Type**: Not defined
79
+ - **Accept**: */*
80
+
81
+
82
+ ## post_api_v1_people
83
+
84
+ > <Person> post_api_v1_people(name, dataset_id)
85
+
86
+ Create a new Person record
87
+
88
+ ### Examples
89
+
90
+ ```ruby
91
+ require 'time'
92
+ require 'quake_timesheets_client'
93
+ # setup authorization
94
+ Quake::Timesheets.configure do |config|
95
+ # Configure API key authorization: authToken
96
+ config.api_key['authToken'] = 'YOUR API KEY'
97
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
98
+ # config.api_key_prefix['authToken'] = 'Bearer'
99
+ end
100
+
101
+ api_instance = Quake::Timesheets::PeopleApi.new
102
+ name = 'name_example' # String | Human readable name for the Person object (usually the subject's real name)
103
+ dataset_id = 'dataset_id_example' # String | Dataset to which the Person object should belong
104
+
105
+ begin
106
+ # Create a new Person record
107
+ result = api_instance.post_api_v1_people(name, dataset_id)
108
+ p result
109
+ rescue Quake::Timesheets::ApiError => e
110
+ puts "Error when calling PeopleApi->post_api_v1_people: #{e}"
111
+ end
112
+ ```
113
+
114
+ #### Using the post_api_v1_people_with_http_info variant
115
+
116
+ This returns an Array which contains the response data, status code and headers.
117
+
118
+ > <Array(<Person>, Integer, Hash)> post_api_v1_people_with_http_info(name, dataset_id)
119
+
120
+ ```ruby
121
+ begin
122
+ # Create a new Person record
123
+ data, status_code, headers = api_instance.post_api_v1_people_with_http_info(name, dataset_id)
124
+ p status_code # => 2xx
125
+ p headers # => { ... }
126
+ p data # => <Person>
127
+ rescue Quake::Timesheets::ApiError => e
128
+ puts "Error when calling PeopleApi->post_api_v1_people_with_http_info: #{e}"
129
+ end
130
+ ```
131
+
132
+ ### Parameters
133
+
134
+ | Name | Type | Description | Notes |
135
+ | ---- | ---- | ----------- | ----- |
136
+ | **name** | **String** | Human readable name for the Person object (usually the subject&#39;s real name) | |
137
+ | **dataset_id** | **String** | Dataset to which the Person object should belong | |
138
+
139
+ ### Return type
140
+
141
+ [**Person**](Person.md)
142
+
143
+ ### Authorization
144
+
145
+ [authToken](../README.md#authToken)
146
+
147
+ ### HTTP request headers
148
+
149
+ - **Content-Type**: application/x-www-form-urlencoded, multipart/form-data
150
+ - **Accept**: */*
151
+
data/docs/Person.md ADDED
@@ -0,0 +1,22 @@
1
+ # Quake::Timesheets::Person
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | The ID of the person | |
8
+ | **dataset_id** | **String** | ID of the dataset this person is linked to | |
9
+ | **name** | **String** | The name of the person | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'quake_timesheets_client'
15
+
16
+ instance = Quake::Timesheets::Person.new(
17
+ id: null,
18
+ dataset_id: null,
19
+ name: null
20
+ )
21
+ ```
22
+
data/git_push.sh ADDED
@@ -0,0 +1,58 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host="github.com"
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id="quake-saas"
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id="timesheets-client-ruby"
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note="Minor update"
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=`git remote`
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'
58
+
@@ -0,0 +1,58 @@
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
+ # Pre-define base modules
14
+ 'Quake::Timesheets'.split('::').reduce(Object) do |previous, mod|
15
+ if previous.const_defined?(mod.to_sym)
16
+ previous.const_get(mod.to_sym)
17
+ else
18
+ previous.const_set(mod.to_sym, Module.new)
19
+ end
20
+ end
21
+
22
+ # Common files
23
+ require 'quake_timesheets_client/api_client'
24
+ require 'quake_timesheets_client/api_error'
25
+ require 'quake_timesheets_client/version'
26
+ require 'quake_timesheets_client/configuration'
27
+
28
+ # Models
29
+ require 'quake_timesheets_client/models/approval'
30
+ require 'quake_timesheets_client/models/approval_type'
31
+ require 'quake_timesheets_client/models/dataset'
32
+ require 'quake_timesheets_client/models/entry'
33
+ require 'quake_timesheets_client/models/person'
34
+
35
+ # APIs
36
+ require 'quake_timesheets_client/api/approval_types_api'
37
+ require 'quake_timesheets_client/api/approvals_api'
38
+ require 'quake_timesheets_client/api/datasets_api'
39
+ require 'quake_timesheets_client/api/entries_api'
40
+ require 'quake_timesheets_client/api/people_api'
41
+
42
+ module Quake::Timesheets
43
+ class << self
44
+ # Customize default settings for the SDK using block.
45
+ # Quake::Timesheets.configure do |config|
46
+ # config.username = "xxx"
47
+ # config.password = "xxx"
48
+ # end
49
+ # If no block given, return the default Configuration object.
50
+ def configure
51
+ if block_given?
52
+ yield(Configuration.default)
53
+ else
54
+ Configuration.default
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,158 @@
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 ApprovalTypesApi
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 [Hash] opts the optional parameters
24
+ # @option opts [String] :dataset_id Filter to the approval types belonging to one of the identified datasets
25
+ # @return [Array<ApprovalType>]
26
+ def get_api_v1_approval_types(opts = {})
27
+ data, _status_code, _headers = get_api_v1_approval_types_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Search for approval types matching filters
32
+ # @param [Hash] opts the optional parameters
33
+ # @option opts [String] :dataset_id Filter to the approval types belonging to one of the identified datasets
34
+ # @return [Array<(Array<ApprovalType>, Integer, Hash)>] Array<ApprovalType> data, response status code and response headers
35
+ def get_api_v1_approval_types_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: ApprovalTypesApi.get_api_v1_approval_types ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/api/v1/approval_types'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+ query_params[:'dataset_id'] = opts[:'dataset_id'] if !opts[:'dataset_id'].nil?
45
+
46
+ # header parameters
47
+ header_params = opts[:header_params] || {}
48
+ # HTTP header 'Accept' (if needed)
49
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
50
+
51
+ # form parameters
52
+ form_params = opts[:form_params] || {}
53
+
54
+ # http body (model)
55
+ post_body = opts[:debug_body]
56
+
57
+ # return_type
58
+ return_type = opts[:debug_return_type] || 'Array<ApprovalType>'
59
+
60
+ # auth_names
61
+ auth_names = opts[:debug_auth_names] || ['authToken']
62
+
63
+ new_options = opts.merge(
64
+ :operation => :"ApprovalTypesApi.get_api_v1_approval_types",
65
+ :header_params => header_params,
66
+ :query_params => query_params,
67
+ :form_params => form_params,
68
+ :body => post_body,
69
+ :auth_names => auth_names,
70
+ :return_type => return_type
71
+ )
72
+
73
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
74
+ if @api_client.config.debugging
75
+ @api_client.config.logger.debug "API called: ApprovalTypesApi#get_api_v1_approval_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
76
+ end
77
+ return data, status_code, headers
78
+ end
79
+
80
+ # Create a new Approval Type
81
+ # @param weight [Float] The weight provided by approvals of this type
82
+ # @param name [String] The name of the approval type
83
+ # @param dataset_id [String] ID of the dataset this approval type is linked to
84
+ # @param [Hash] opts the optional parameters
85
+ # @return [ApprovalType]
86
+ def post_api_v1_approval_types(weight, name, dataset_id, opts = {})
87
+ data, _status_code, _headers = post_api_v1_approval_types_with_http_info(weight, name, dataset_id, opts)
88
+ data
89
+ end
90
+
91
+ # Create a new Approval Type
92
+ # @param weight [Float] The weight provided by approvals of this type
93
+ # @param name [String] The name of the approval type
94
+ # @param dataset_id [String] ID of the dataset this approval type is linked to
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [Array<(ApprovalType, Integer, Hash)>] ApprovalType data, response status code and response headers
97
+ def post_api_v1_approval_types_with_http_info(weight, name, dataset_id, opts = {})
98
+ if @api_client.config.debugging
99
+ @api_client.config.logger.debug 'Calling API: ApprovalTypesApi.post_api_v1_approval_types ...'
100
+ end
101
+ # verify the required parameter 'weight' is set
102
+ if @api_client.config.client_side_validation && weight.nil?
103
+ fail ArgumentError, "Missing the required parameter 'weight' when calling ApprovalTypesApi.post_api_v1_approval_types"
104
+ end
105
+ # verify the required parameter 'name' is set
106
+ if @api_client.config.client_side_validation && name.nil?
107
+ fail ArgumentError, "Missing the required parameter 'name' when calling ApprovalTypesApi.post_api_v1_approval_types"
108
+ end
109
+ # verify the required parameter 'dataset_id' is set
110
+ if @api_client.config.client_side_validation && dataset_id.nil?
111
+ fail ArgumentError, "Missing the required parameter 'dataset_id' when calling ApprovalTypesApi.post_api_v1_approval_types"
112
+ end
113
+ # resource path
114
+ local_var_path = '/api/v1/approval_types'
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
123
+ # HTTP header 'Content-Type'
124
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded', 'multipart/form-data'])
125
+
126
+ # form parameters
127
+ form_params = opts[:form_params] || {}
128
+ form_params['weight'] = weight
129
+ form_params['name'] = name
130
+ form_params['dataset_id'] = dataset_id
131
+
132
+ # http body (model)
133
+ post_body = opts[:debug_body]
134
+
135
+ # return_type
136
+ return_type = opts[:debug_return_type] || 'ApprovalType'
137
+
138
+ # auth_names
139
+ auth_names = opts[:debug_auth_names] || ['authToken']
140
+
141
+ new_options = opts.merge(
142
+ :operation => :"ApprovalTypesApi.post_api_v1_approval_types",
143
+ :header_params => header_params,
144
+ :query_params => query_params,
145
+ :form_params => form_params,
146
+ :body => post_body,
147
+ :auth_names => auth_names,
148
+ :return_type => return_type
149
+ )
150
+
151
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
152
+ if @api_client.config.debugging
153
+ @api_client.config.logger.debug "API called: ApprovalTypesApi#post_api_v1_approval_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
154
+ end
155
+ return data, status_code, headers
156
+ end
157
+ end
158
+ end