stackone_hris_client 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,144 @@
1
+ =begin
2
+ #StackOne Unified API
3
+
4
+ #The documentation for the StackOne Unified API
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.4.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module StackOneHrisClient
16
+ class AccountsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ #
23
+ # @param id [String]
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Account]
26
+ def accounts_get(id, opts = {})
27
+ data, _status_code, _headers = accounts_get_with_http_info(id, opts)
28
+ data
29
+ end
30
+
31
+ #
32
+ # @param id [String]
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Account, Integer, Hash)>] Account data, response status code and response headers
35
+ def accounts_get_with_http_info(id, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: AccountsApi.accounts_get ...'
38
+ end
39
+ # verify the required parameter 'id' is set
40
+ if @api_client.config.client_side_validation && id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'id' when calling AccountsApi.accounts_get"
42
+ end
43
+ # resource path
44
+ local_var_path = '/accounts/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+
49
+ # header parameters
50
+ header_params = opts[:header_params] || {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:debug_body]
59
+
60
+ # return_type
61
+ return_type = opts[:debug_return_type] || 'Account'
62
+
63
+ # auth_names
64
+ auth_names = opts[:debug_auth_names] || ['basic']
65
+
66
+ new_options = opts.merge(
67
+ :operation => :"AccountsApi.accounts_get",
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => return_type
74
+ )
75
+
76
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: AccountsApi#accounts_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+
83
+ #
84
+ # @param [Hash] opts the optional parameters
85
+ # @option opts [String] :provider The provider of the results to fetch
86
+ # @option opts [String] :origin_owner_id The origin owner identifier of the results to fetch
87
+ # @return [Array<Account>]
88
+ def accounts_list(opts = {})
89
+ data, _status_code, _headers = accounts_list_with_http_info(opts)
90
+ data
91
+ end
92
+
93
+ #
94
+ # @param [Hash] opts the optional parameters
95
+ # @option opts [String] :provider The provider of the results to fetch
96
+ # @option opts [String] :origin_owner_id The origin owner identifier of the results to fetch
97
+ # @return [Array<(Array<Account>, Integer, Hash)>] Array<Account> data, response status code and response headers
98
+ def accounts_list_with_http_info(opts = {})
99
+ if @api_client.config.debugging
100
+ @api_client.config.logger.debug 'Calling API: AccountsApi.accounts_list ...'
101
+ end
102
+ # resource path
103
+ local_var_path = '/accounts'
104
+
105
+ # query parameters
106
+ query_params = opts[:query_params] || {}
107
+ query_params[:'provider'] = opts[:'provider'] if !opts[:'provider'].nil?
108
+ query_params[:'origin_owner_id'] = opts[:'origin_owner_id'] if !opts[:'origin_owner_id'].nil?
109
+
110
+ # header parameters
111
+ header_params = opts[:header_params] || {}
112
+ # HTTP header 'Accept' (if needed)
113
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
114
+
115
+ # form parameters
116
+ form_params = opts[:form_params] || {}
117
+
118
+ # http body (model)
119
+ post_body = opts[:debug_body]
120
+
121
+ # return_type
122
+ return_type = opts[:debug_return_type] || 'Array<Account>'
123
+
124
+ # auth_names
125
+ auth_names = opts[:debug_auth_names] || ['basic']
126
+
127
+ new_options = opts.merge(
128
+ :operation => :"AccountsApi.accounts_list",
129
+ :header_params => header_params,
130
+ :query_params => query_params,
131
+ :form_params => form_params,
132
+ :body => post_body,
133
+ :auth_names => auth_names,
134
+ :return_type => return_type
135
+ )
136
+
137
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
138
+ if @api_client.config.debugging
139
+ @api_client.config.logger.debug "API called: AccountsApi#accounts_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
140
+ end
141
+ return data, status_code, headers
142
+ end
143
+ end
144
+ end
@@ -0,0 +1,154 @@
1
+ =begin
2
+ #StackOne Unified API
3
+
4
+ #The documentation for the StackOne Unified API
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.4.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module StackOneHrisClient
16
+ class ConnectSessionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ #
23
+ # @param connect_session_authenticate [ConnectSessionAuthenticate] The parameters to authenticate
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [ConnectSession]
26
+ def connect_sessions_authenticate(connect_session_authenticate, opts = {})
27
+ data, _status_code, _headers = connect_sessions_authenticate_with_http_info(connect_session_authenticate, opts)
28
+ data
29
+ end
30
+
31
+ #
32
+ # @param connect_session_authenticate [ConnectSessionAuthenticate] The parameters to authenticate
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(ConnectSession, Integer, Hash)>] ConnectSession data, response status code and response headers
35
+ def connect_sessions_authenticate_with_http_info(connect_session_authenticate, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: ConnectSessionsApi.connect_sessions_authenticate ...'
38
+ end
39
+ # verify the required parameter 'connect_session_authenticate' is set
40
+ if @api_client.config.client_side_validation && connect_session_authenticate.nil?
41
+ fail ArgumentError, "Missing the required parameter 'connect_session_authenticate' when calling ConnectSessionsApi.connect_sessions_authenticate"
42
+ end
43
+ # resource path
44
+ local_var_path = '/connect_sessions/authenticate'
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+
49
+ # header parameters
50
+ header_params = opts[:header_params] || {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
53
+ # HTTP header 'Content-Type'
54
+ content_type = @api_client.select_header_content_type(['application/json'])
55
+ if !content_type.nil?
56
+ header_params['Content-Type'] = content_type
57
+ end
58
+
59
+ # form parameters
60
+ form_params = opts[:form_params] || {}
61
+
62
+ # http body (model)
63
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(connect_session_authenticate)
64
+
65
+ # return_type
66
+ return_type = opts[:debug_return_type] || 'ConnectSession'
67
+
68
+ # auth_names
69
+ auth_names = opts[:debug_auth_names] || ['basic']
70
+
71
+ new_options = opts.merge(
72
+ :operation => :"ConnectSessionsApi.connect_sessions_authenticate",
73
+ :header_params => header_params,
74
+ :query_params => query_params,
75
+ :form_params => form_params,
76
+ :body => post_body,
77
+ :auth_names => auth_names,
78
+ :return_type => return_type
79
+ )
80
+
81
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
82
+ if @api_client.config.debugging
83
+ @api_client.config.logger.debug "API called: ConnectSessionsApi#connect_sessions_authenticate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
84
+ end
85
+ return data, status_code, headers
86
+ end
87
+
88
+ #
89
+ # @param connect_session_create [ConnectSessionCreate]
90
+ # @param [Hash] opts the optional parameters
91
+ # @return [ConnectSessionToken]
92
+ def connect_sessions_create(connect_session_create, opts = {})
93
+ data, _status_code, _headers = connect_sessions_create_with_http_info(connect_session_create, opts)
94
+ data
95
+ end
96
+
97
+ #
98
+ # @param connect_session_create [ConnectSessionCreate]
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [Array<(ConnectSessionToken, Integer, Hash)>] ConnectSessionToken data, response status code and response headers
101
+ def connect_sessions_create_with_http_info(connect_session_create, opts = {})
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug 'Calling API: ConnectSessionsApi.connect_sessions_create ...'
104
+ end
105
+ # verify the required parameter 'connect_session_create' is set
106
+ if @api_client.config.client_side_validation && connect_session_create.nil?
107
+ fail ArgumentError, "Missing the required parameter 'connect_session_create' when calling ConnectSessionsApi.connect_sessions_create"
108
+ end
109
+ # resource path
110
+ local_var_path = '/connect_sessions'
111
+
112
+ # query parameters
113
+ query_params = opts[:query_params] || {}
114
+
115
+ # header parameters
116
+ header_params = opts[:header_params] || {}
117
+ # HTTP header 'Accept' (if needed)
118
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
119
+ # HTTP header 'Content-Type'
120
+ content_type = @api_client.select_header_content_type(['application/json'])
121
+ if !content_type.nil?
122
+ header_params['Content-Type'] = content_type
123
+ end
124
+
125
+ # form parameters
126
+ form_params = opts[:form_params] || {}
127
+
128
+ # http body (model)
129
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(connect_session_create)
130
+
131
+ # return_type
132
+ return_type = opts[:debug_return_type] || 'ConnectSessionToken'
133
+
134
+ # auth_names
135
+ auth_names = opts[:debug_auth_names] || ['basic']
136
+
137
+ new_options = opts.merge(
138
+ :operation => :"ConnectSessionsApi.connect_sessions_create",
139
+ :header_params => header_params,
140
+ :query_params => query_params,
141
+ :form_params => form_params,
142
+ :body => post_body,
143
+ :auth_names => auth_names,
144
+ :return_type => return_type
145
+ )
146
+
147
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
148
+ if @api_client.config.debugging
149
+ @api_client.config.logger.debug "API called: ConnectSessionsApi#connect_sessions_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
150
+ end
151
+ return data, status_code, headers
152
+ end
153
+ end
154
+ end
@@ -28,6 +28,7 @@ module StackOneHrisClient
28
28
  # @option opts [Boolean] :raw Indicates that the raw request result is returned (default to false)
29
29
  # @option opts [Array<String>] :fields The list of fields to return in the response (if empty, all fields are returned)
30
30
  # @option opts [Array<String>] :expand The list of fields that will be expanded in the response
31
+ # @option opts [String] :sync_token The sync token to select the only updated results
31
32
  # @return [EmployeeResult]
32
33
  def employees_get(id, x_account_id, opts = {})
33
34
  data, _status_code, _headers = employees_get_with_http_info(id, x_account_id, opts)
@@ -43,6 +44,7 @@ module StackOneHrisClient
43
44
  # @option opts [Boolean] :raw Indicates that the raw request result is returned (default to false)
44
45
  # @option opts [Array<String>] :fields The list of fields to return in the response (if empty, all fields are returned)
45
46
  # @option opts [Array<String>] :expand The list of fields that will be expanded in the response
47
+ # @option opts [String] :sync_token The sync token to select the only updated results
46
48
  # @return [Array<(EmployeeResult, Integer, Hash)>] EmployeeResult data, response status code and response headers
47
49
  def employees_get_with_http_info(id, x_account_id, opts = {})
48
50
  if @api_client.config.debugging
@@ -66,6 +68,7 @@ module StackOneHrisClient
66
68
  query_params[:'raw'] = opts[:'raw'] if !opts[:'raw'].nil?
67
69
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
68
70
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if !opts[:'expand'].nil?
71
+ query_params[:'sync_token'] = opts[:'sync_token'] if !opts[:'sync_token'].nil?
69
72
 
70
73
  # header parameters
71
74
  header_params = opts[:header_params] || {}
@@ -110,6 +113,7 @@ module StackOneHrisClient
110
113
  # @option opts [Boolean] :raw Indicates that the raw request result is returned (default to false)
111
114
  # @option opts [Array<String>] :fields The list of fields to return in the response (if empty, all fields are returned)
112
115
  # @option opts [Array<String>] :expand The list of fields that will be expanded in the response
116
+ # @option opts [String] :sync_token The sync token to select the only updated results
113
117
  # @return [EmployeesPaginated]
114
118
  def employees_list(x_account_id, opts = {})
115
119
  data, _status_code, _headers = employees_list_with_http_info(x_account_id, opts)
@@ -124,6 +128,7 @@ module StackOneHrisClient
124
128
  # @option opts [Boolean] :raw Indicates that the raw request result is returned (default to false)
125
129
  # @option opts [Array<String>] :fields The list of fields to return in the response (if empty, all fields are returned)
126
130
  # @option opts [Array<String>] :expand The list of fields that will be expanded in the response
131
+ # @option opts [String] :sync_token The sync token to select the only updated results
127
132
  # @return [Array<(EmployeesPaginated, Integer, Hash)>] EmployeesPaginated data, response status code and response headers
128
133
  def employees_list_with_http_info(x_account_id, opts = {})
129
134
  if @api_client.config.debugging
@@ -143,6 +148,7 @@ module StackOneHrisClient
143
148
  query_params[:'raw'] = opts[:'raw'] if !opts[:'raw'].nil?
144
149
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
145
150
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if !opts[:'expand'].nil?
151
+ query_params[:'sync_token'] = opts[:'sync_token'] if !opts[:'sync_token'].nil?
146
152
 
147
153
  # header parameters
148
154
  header_params = opts[:header_params] || {}
@@ -147,12 +147,6 @@ module StackOneHrisClient
147
147
 
148
148
  attr_accessor :force_ending_format
149
149
 
150
- # Defines the region slug used to choose the API base url.
151
- # Default to eu1.
152
- #
153
- # @return [String]
154
- attr_accessor :region_slug
155
-
156
150
  def initialize
157
151
  @scheme = 'https'
158
152
  @host = 'stackone.com'
@@ -174,7 +168,6 @@ module StackOneHrisClient
174
168
  @debugging = false
175
169
  @inject_format = false
176
170
  @force_ending_format = false
177
- @region_slug = 'eu1'
178
171
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
179
172
 
180
173
  yield(self) if block_given?
@@ -205,8 +198,16 @@ module StackOneHrisClient
205
198
  @base_path = '' if @base_path == '/'
206
199
  end
207
200
 
201
+ def extract_region_slug_from_api_key_token
202
+ return nil if api_key_token.nil? || api_key_token.empty?
203
+
204
+ api_key_token.split('.')[1]
205
+ end
206
+
208
207
  def region_slug_subdomain
209
- return '' if region_slug.nil? || region_slug.empty?
208
+ region_slug = extract_region_slug_from_api_key_token
209
+
210
+ return '' if region_slug.nil? || region_slug.empty? || region_slug == 'dev'
210
211
 
211
212
  "api.#{region_slug}."
212
213
  end