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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 119ee596e8cc8a04f1d9bd725708df328f45e6a132e0ff12f763ddf61cd0ffc5
4
+ data.tar.gz: d7626dc544854a7c36266d2b63366a2417beb69cd685fe742c8f5ba26c6c5335
5
+ SHA512:
6
+ metadata.gz: 22b2e259dc75dac178cdf18f7c914798d5c5b4a7437733f2f73db40923ec3534fa0070cdb6005643c669cfab0a6ae2364dc28d7dc733fe8935e58345c8e865d2
7
+ data.tar.gz: a66d08915cb9e5e6908caea7db6ff4565af70031211d650f48df14497c41f712bbac6de9f17c22e7d406fdcc258dd814ae102076d3c1df4cca10007cdc93d675
@@ -0,0 +1,17 @@
1
+ Timesheets client generator
2
+ ---
3
+
4
+ Generation of the Timesheets client depends on the openapi-generator tools. see https://openapi-generator.tech/
5
+
6
+ To generate a client, install the openapi-generator tools.
7
+
8
+ ```
9
+ brew install openapi-generator
10
+ ```
11
+
12
+ Once this has been done, you can generate the ruby gem source using the below command:
13
+
14
+ ```
15
+ openapi-generator generate -i '<SOURCE>/apidocs/1.0.json?type=swagger' -g ruby -c ruby.config.yaml --minimal-update --template-dir ruby-templates/
16
+ ```
17
+
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.66.0'
9
+ end
data/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # quake_timesheets_client
2
+
3
+ Quake::Timesheets - the Ruby gem for the TimesheetsApi (params in:formData)
4
+
5
+
6
+ <p>Another API description</p>
7
+
8
+
9
+ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
10
+
11
+ - API version: 1.0
12
+ - Package version: 0.1.0
13
+ - Build package: org.openapitools.codegen.languages.RubyClientCodegen
14
+
15
+ ## Generating
16
+
17
+ To re-generate the source for this gem, use the command:
18
+ ```shell
19
+ ./build.sh
20
+ ```
21
+
22
+ To generate from a local timesheets installation (e.g. during development) use:
23
+ ```shell
24
+ ./build.sh local
25
+ ```
26
+
27
+ ## Installation
28
+
29
+ ### Build a gem
30
+
31
+ To build the Ruby code into a gem:
32
+
33
+ ```shell
34
+ gem build quake_timesheets_client.gemspec
35
+ ```
36
+
37
+ Then either install the gem locally:
38
+
39
+ ```shell
40
+ gem install ./quake_timesheets_client-0.1.0.gem
41
+ ```
42
+
43
+ (for development, run `gem install --dev ./quake_timesheets_client-0.1.0.gem` to install the development dependencies)
44
+
45
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
46
+
47
+ Finally add this to the Gemfile:
48
+
49
+ gem 'quake_timesheets_client', '~> 0.1.0'
50
+
51
+ ### Install from Git
52
+
53
+ If the Ruby gem is hosted at a git repository: https://github.com/quake-saas/timesheets-client-ruby, then add the following in the Gemfile:
54
+
55
+ gem 'quake_timesheets_client', :git => 'https://github.com/quake-saas/timesheets-client-ruby.git'
56
+
57
+ ### Include the Ruby code directly
58
+
59
+ Include the Ruby code directly using `-I` as follows:
60
+
61
+ ```shell
62
+ ruby -Ilib script.rb
63
+ ```
64
+
65
+ ## Getting Started
66
+
67
+ Please follow the [installation](#installation) procedure and then run the following code:
68
+
69
+ ```ruby
70
+ # Load the gem
71
+ require 'quake_timesheets_client'
72
+
73
+ # Setup authorization
74
+ Quake::Timesheets.configure do |config|
75
+ # Configure API key authorization: authToken
76
+ config.api_key['authToken'] = 'YOUR API KEY'
77
+ end
78
+
79
+ # Optionally, for local development, you can override the endpoint being used with the below:
80
+ Quake::Timesheets.configure do |config|
81
+ config.endpoint = 'http://localhost:3000'
82
+ end
83
+
84
+ api_instance = Quake::Timesheets::ApprovalTypesApi.new
85
+ opts = {
86
+ dataset_id: 'dataset_id_example' # String | Filter to the approval types belonging to one of the identified datasets
87
+ }
88
+
89
+ begin
90
+ #Search for approval types matching filters
91
+ result = api_instance.get_api_v1_approval_types(opts)
92
+ p result
93
+ rescue Quake::Timesheets::ApiError => e
94
+ puts "Exception when calling ApprovalTypesApi->get_api_v1_approval_types: #{e}"
95
+ end
96
+
97
+ ```
98
+
99
+ ## Documentation for API Endpoints
100
+
101
+ All URIs are relative to *https://timesheetsapi.svc.lumbry.co.uk:443*
102
+
103
+ Class | Method | HTTP request | Description
104
+ ------------ | ------------- | ------------- | -------------
105
+ *Quake::Timesheets::ApprovalTypesApi* | [**get_api_v1_approval_types**](docs/ApprovalTypesApi.md#get_api_v1_approval_types) | **GET** /api/v1/approval_types | Search for approval types matching filters
106
+ *Quake::Timesheets::ApprovalTypesApi* | [**post_api_v1_approval_types**](docs/ApprovalTypesApi.md#post_api_v1_approval_types) | **POST** /api/v1/approval_types | Create a new Approval Type
107
+ *Quake::Timesheets::ApprovalsApi* | [**get_api_v1_approvals**](docs/ApprovalsApi.md#get_api_v1_approvals) | **GET** /api/v1/approvals | Search for approval types matching filters
108
+ *Quake::Timesheets::ApprovalsApi* | [**post_api_v1_approvals**](docs/ApprovalsApi.md#post_api_v1_approvals) | **POST** /api/v1/approvals | Create a new Approval
109
+ *Quake::Timesheets::DatasetsApi* | [**get_api_v1_datasets**](docs/DatasetsApi.md#get_api_v1_datasets) | **GET** /api/v1/datasets | List all available datasets
110
+ *Quake::Timesheets::DatasetsApi* | [**get_api_v1_datasets_id**](docs/DatasetsApi.md#get_api_v1_datasets_id) | **GET** /api/v1/datasets/{id} | Show details about a specific dataset
111
+ *Quake::Timesheets::DatasetsApi* | [**post_api_v1_datasets**](docs/DatasetsApi.md#post_api_v1_datasets) | **POST** /api/v1/datasets | Create a new Dataset record
112
+ *Quake::Timesheets::EntriesApi* | [**get_api_v1_entries**](docs/EntriesApi.md#get_api_v1_entries) | **GET** /api/v1/entries | Search for entries matching filters
113
+ *Quake::Timesheets::EntriesApi* | [**post_api_v1_entries**](docs/EntriesApi.md#post_api_v1_entries) | **POST** /api/v1/entries | Create a new Entry
114
+ *Quake::Timesheets::EntriesApi* | [**post_api_v1_entries_id**](docs/EntriesApi.md#post_api_v1_entries_id) | **POST** /api/v1/entries/{id} | Update an existing Entry
115
+ *Quake::Timesheets::PeopleApi* | [**get_api_v1_people**](docs/PeopleApi.md#get_api_v1_people) | **GET** /api/v1/people | Search for people matching filters
116
+ *Quake::Timesheets::PeopleApi* | [**post_api_v1_people**](docs/PeopleApi.md#post_api_v1_people) | **POST** /api/v1/people | Create a new Person record
117
+
118
+
119
+ ## Documentation for Models
120
+
121
+ - [Quake::Timesheets::Approval](docs/Approval.md)
122
+ - [Quake::Timesheets::ApprovalType](docs/ApprovalType.md)
123
+ - [Quake::Timesheets::Dataset](docs/Dataset.md)
124
+ - [Quake::Timesheets::Entry](docs/Entry.md)
125
+ - [Quake::Timesheets::Person](docs/Person.md)
126
+
127
+
128
+ ## Documentation for Authorization
129
+
130
+
131
+ ### authToken
132
+
133
+
134
+ - **Type**: API key
135
+ - **API key parameter name**: authorization
136
+ - **Location**: HTTP header
137
+
138
+
139
+ ## Debugging
140
+
141
+ When enabled, the additional information can be provided to the logger. To enable debug logging:
142
+
143
+ ```ruby
144
+ Quake::Timesheets.configure do |config|
145
+ config.debugging = true
146
+ end
147
+ ```
148
+
149
+ ## Middleware
150
+
151
+ This gem uses Faraday to manage the underlying http requests. Faraday supports middleware that can
152
+ interact with the request and response directly before and after they are sent or received. This
153
+ can be used to provide additional logic such as adding custom logging. See
154
+ [https://lostisland.github.io/faraday/middleware/] for details
155
+
156
+ To add a middleware to be used do something like below:
157
+ ```ruby
158
+ Quake::Timesheets.configure do |config|
159
+ config.faraday_middlewares.push(MyMiddleware)
160
+ end
161
+ ```
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
data/build.sh ADDED
@@ -0,0 +1,10 @@
1
+ # /bin/sh
2
+
3
+ # passing the parameter "local" builds against the local instance
4
+ if [ "local" = "$1" ]; then
5
+ SOURCE='http://localhost:3000/apidocs/1.0.json?type=swagger'
6
+ else
7
+ SOURCE='https://timesheetsapi.svc.lumbry.co.uk/apidocs/1.0.json?type=swagger'
8
+ fi
9
+
10
+ openapi-generator generate --generator-name ruby --input-spec $SOURCE --config ruby.config.yaml --template-dir ruby-templates --git-user-id quake-saas --git-repo-id timesheets-client-ruby
data/commands ADDED
@@ -0,0 +1,13 @@
1
+ require 'quake_timesheets_client'
2
+
3
+ config = Quake::Timesheets::Configuration.new
4
+ config.api_key['authToken'] = 'supersecretkey'
5
+
6
+ config.server_settings = [{url: 'http://localhost:3000'}]
7
+
8
+ client = Quake::Timesheets::ApiClient.new(config)
9
+ api_instance = Quake::Timesheets::ApprovalTypesApi.new(client)
10
+ result = api_instance.get_api_v1_approval_types(dataset_id: '05033a75-de02-4689-9c55-04b575d33b2c')
11
+
12
+ result.first.name == 'my approval'
13
+ result.first.weight == 2.0
data/docs/Approval.md ADDED
@@ -0,0 +1,34 @@
1
+ # Quake::Timesheets::Approval
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | The ID of the approval type | |
8
+ | **dataset_id** | **String** | ID of the dataset this approval type is linked to | |
9
+ | **entry_ids** | **Array&lt;String&gt;** | The ID of the Entry this Approval is linked to | |
10
+ | **approver_id** | **String** | The ID of the Person who created this Approval | |
11
+ | **approval_type_id** | **String** | The ID of the Approval Type of this Approval | |
12
+ | **state** | **String** | | |
13
+ | **notes** | **String** | | |
14
+ | **created_at** | **String** | Time at which the record was created | |
15
+ | **updated_at** | **String** | Time at which the record was updated | |
16
+
17
+ ## Example
18
+
19
+ ```ruby
20
+ require 'quake_timesheets_client'
21
+
22
+ instance = Quake::Timesheets::Approval.new(
23
+ id: null,
24
+ dataset_id: null,
25
+ entry_ids: null,
26
+ approver_id: null,
27
+ approval_type_id: null,
28
+ state: null,
29
+ notes: null,
30
+ created_at: null,
31
+ updated_at: null
32
+ )
33
+ ```
34
+
@@ -0,0 +1,24 @@
1
+ # Quake::Timesheets::ApprovalType
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | The ID of the approval type | |
8
+ | **dataset_id** | **String** | ID of the dataset this approval type is linked to | |
9
+ | **name** | **String** | The name of the approval type | |
10
+ | **weight** | **Float** | The weight provided by approvals of this type | |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'quake_timesheets_client'
16
+
17
+ instance = Quake::Timesheets::ApprovalType.new(
18
+ id: null,
19
+ dataset_id: null,
20
+ name: null,
21
+ weight: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,153 @@
1
+ # Quake::Timesheets::ApprovalTypesApi
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_approval_types**](ApprovalTypesApi.md#get_api_v1_approval_types) | **GET** /api/v1/approval_types | Search for approval types matching filters |
8
+ | [**post_api_v1_approval_types**](ApprovalTypesApi.md#post_api_v1_approval_types) | **POST** /api/v1/approval_types | Create a new Approval Type |
9
+
10
+
11
+ ## get_api_v1_approval_types
12
+
13
+ > <Array<ApprovalType>> get_api_v1_approval_types(opts)
14
+
15
+ Search for approval types 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::ApprovalTypesApi.new
31
+ opts = {
32
+ dataset_id: 'dataset_id_example' # String | Filter to the approval types belonging to one of the identified datasets
33
+ }
34
+
35
+ begin
36
+ # Search for approval types matching filters
37
+ result = api_instance.get_api_v1_approval_types(opts)
38
+ p result
39
+ rescue Quake::Timesheets::ApiError => e
40
+ puts "Error when calling ApprovalTypesApi->get_api_v1_approval_types: #{e}"
41
+ end
42
+ ```
43
+
44
+ #### Using the get_api_v1_approval_types_with_http_info variant
45
+
46
+ This returns an Array which contains the response data, status code and headers.
47
+
48
+ > <Array(<Array<ApprovalType>>, Integer, Hash)> get_api_v1_approval_types_with_http_info(opts)
49
+
50
+ ```ruby
51
+ begin
52
+ # Search for approval types matching filters
53
+ data, status_code, headers = api_instance.get_api_v1_approval_types_with_http_info(opts)
54
+ p status_code # => 2xx
55
+ p headers # => { ... }
56
+ p data # => <Array<ApprovalType>>
57
+ rescue Quake::Timesheets::ApiError => e
58
+ puts "Error when calling ApprovalTypesApi->get_api_v1_approval_types_with_http_info: #{e}"
59
+ end
60
+ ```
61
+
62
+ ### Parameters
63
+
64
+ | Name | Type | Description | Notes |
65
+ | ---- | ---- | ----------- | ----- |
66
+ | **dataset_id** | **String** | Filter to the approval types belonging to one of the identified datasets | [optional] |
67
+
68
+ ### Return type
69
+
70
+ [**Array&lt;ApprovalType&gt;**](ApprovalType.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_approval_types
83
+
84
+ > <ApprovalType> post_api_v1_approval_types(weight, name, dataset_id)
85
+
86
+ Create a new Approval Type
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::ApprovalTypesApi.new
102
+ weight = 8.14 # Float | The weight provided by approvals of this type
103
+ name = 'name_example' # String | The name of the approval type
104
+ dataset_id = 'dataset_id_example' # String | ID of the dataset this approval type is linked to
105
+
106
+ begin
107
+ # Create a new Approval Type
108
+ result = api_instance.post_api_v1_approval_types(weight, name, dataset_id)
109
+ p result
110
+ rescue Quake::Timesheets::ApiError => e
111
+ puts "Error when calling ApprovalTypesApi->post_api_v1_approval_types: #{e}"
112
+ end
113
+ ```
114
+
115
+ #### Using the post_api_v1_approval_types_with_http_info variant
116
+
117
+ This returns an Array which contains the response data, status code and headers.
118
+
119
+ > <Array(<ApprovalType>, Integer, Hash)> post_api_v1_approval_types_with_http_info(weight, name, dataset_id)
120
+
121
+ ```ruby
122
+ begin
123
+ # Create a new Approval Type
124
+ data, status_code, headers = api_instance.post_api_v1_approval_types_with_http_info(weight, name, dataset_id)
125
+ p status_code # => 2xx
126
+ p headers # => { ... }
127
+ p data # => <ApprovalType>
128
+ rescue Quake::Timesheets::ApiError => e
129
+ puts "Error when calling ApprovalTypesApi->post_api_v1_approval_types_with_http_info: #{e}"
130
+ end
131
+ ```
132
+
133
+ ### Parameters
134
+
135
+ | Name | Type | Description | Notes |
136
+ | ---- | ---- | ----------- | ----- |
137
+ | **weight** | **Float** | The weight provided by approvals of this type | |
138
+ | **name** | **String** | The name of the approval type | |
139
+ | **dataset_id** | **String** | ID of the dataset this approval type is linked to | |
140
+
141
+ ### Return type
142
+
143
+ [**ApprovalType**](ApprovalType.md)
144
+
145
+ ### Authorization
146
+
147
+ [authToken](../README.md#authToken)
148
+
149
+ ### HTTP request headers
150
+
151
+ - **Content-Type**: application/x-www-form-urlencoded, multipart/form-data
152
+ - **Accept**: */*
153
+