unienv_api 1.0.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1ef0257ec3ffbcb4d0b412000d9f53d4c1d0fa871e8d18e501cc4135f9235193
4
+ data.tar.gz: 2821ca07f44585f0bd596e00466fbc7b508cb48e88c19a5cf868ceb923d38dde
5
+ SHA512:
6
+ metadata.gz: 61e2bad048c35e02924aaa274546d7b8a208b271c70bcca0c857abe4cccaf073d6b32b4cda797854d0d10e63cb236b4765c600e4fdc36e4e22aa22139f3badbe
7
+ data.tar.gz: bd923657fd644d971bb5b5d8b47a5dfc7bfa490be17338614f94ad911104c1a2a9aea8d4607930773a7035af4fb0a48483b11a9746fc4f3ad5c008f9e8e555ae
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 (30-Oct-21)
4
+
5
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ MIT License
2
+ Copyright (c) 2021 UniEnvAPI, Gizatullin Amirkhan
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+ The above copyright notice and this permission notice shall be
11
+ included in all copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
15
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
16
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
17
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # unienv_api
2
+
3
+ ## Быстрый старт
4
+ **Гем UniEnv** - устанавливаемый из пакетного менеджера модуль, который позволяет взаимодействовать с платформой UniEnv: производить авторизацию пользователей через OAuth и выполнять API запросы.
5
+
6
+
7
+ ```ruby
8
+ require 'unienv_api'
9
+
10
+ # Авторизация
11
+ @unienv = UniEnv.new(client_id, client_secret, redirect_uri)
12
+
13
+ # получение ссылки
14
+ auth_url = @unienv.authorize
15
+
16
+ # получение токена
17
+ token = @unienv.get_token(code)
18
+
19
+ # отзыв токена
20
+ re_token = @unienv.revoke_token
21
+
22
+ # получение нового токена
23
+ new_token = auth.refresh_token
24
+
25
+ # API
26
+ # получение профиля
27
+ profile = @unienv.get_profile
28
+ ```
29
+
30
+
31
+ ## Авторизация
32
+ Реализованы следующие методы:
33
+ + `authorize` - возвращает ссылку для переадресации пользователя на страницу авторизации
34
+ + `get_token(code)` - получение access token c дополнительными данными для выполнения следующих запросов
35
+ + `revoke_token` - отзыв токена (выход)
36
+ + `refresh_token` - обновление токена
37
+
38
+ ## API
39
+ Реализованы методы для обращения к API UniEnv
40
+ Методы сгенерировались на основе документации в формате OpenAPI (Swagger):
41
+ + `get_profile` - получение профиля
@@ -0,0 +1,103 @@
1
+ # swagger_client
2
+
3
+ SwaggerClient - the Ruby gem for the UniEnv Core API
4
+
5
+ Документация по API UniEnv
6
+
7
+ This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
+
9
+ - API version: v1.0
10
+ - Package version: 1.0.0
11
+ - Build package: io.swagger.codegen.languages.RubyClientCodegen
12
+
13
+ ## Installation
14
+
15
+ ### Build a gem
16
+
17
+ To build the Ruby code into a gem:
18
+
19
+ ```shell
20
+ gem build swagger_client.gemspec
21
+ ```
22
+
23
+ Then either install the gem locally:
24
+
25
+ ```shell
26
+ gem install ./swagger_client-1.0.0.gem
27
+ ```
28
+ (for development, run `gem install --dev ./swagger_client-1.0.0.gem` to install the development dependencies)
29
+
30
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
31
+
32
+ Finally add this to the Gemfile:
33
+
34
+ gem 'swagger_client', '~> 1.0.0'
35
+
36
+ ### Install from Git
37
+
38
+ If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
39
+
40
+ gem 'swagger_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
41
+
42
+ ### Include the Ruby code directly
43
+
44
+ Include the Ruby code directly using `-I` as follows:
45
+
46
+ ```shell
47
+ ruby -Ilib script.rb
48
+ ```
49
+
50
+ ## Getting Started
51
+
52
+ Please follow the [installation](#installation) procedure and then run the following code:
53
+ ```ruby
54
+ # Load the gem
55
+ require 'swagger_client'
56
+
57
+ # Setup authorization
58
+ SwaggerClient.configure do |config|
59
+ # Configure HTTP basic authorization: Basic
60
+ config.username = 'YOUR USERNAME'
61
+ config.password = 'YOUR PASSWORD'
62
+ end
63
+
64
+ api_instance = SwaggerClient::ProfileApi.new
65
+
66
+ opts = {
67
+ limit: 56, # Integer | Number of results to return per page.
68
+ offset: 56 # Integer | The initial index from which to return the results.
69
+ }
70
+
71
+ begin
72
+ #Получение профиля
73
+ result = api_instance.profile_get(opts)
74
+ p result
75
+ rescue SwaggerClient::ApiError => e
76
+ puts "Exception when calling ProfileApi->profile_get: #{e}"
77
+ end
78
+
79
+ ```
80
+
81
+ ## Documentation for API Endpoints
82
+
83
+ All URIs are relative to *http://uenv-core.kpfu.ru/api/v1.0/*
84
+
85
+ Class | Method | HTTP request | Description
86
+ ------------ | ------------- | ------------- | -------------
87
+ *SwaggerClient::ProfileApi* | [**profile_get**](docs/ProfileApi.md#profile_get) | **GET** /profile/ | Получение профиля
88
+
89
+
90
+ ## Documentation for Models
91
+
92
+ - [SwaggerClient::Group](docs/Group.md)
93
+ - [SwaggerClient::Institute](docs/Institute.md)
94
+ - [SwaggerClient::Profile](docs/Profile.md)
95
+
96
+
97
+ ## Documentation for Authorization
98
+
99
+
100
+ ### Basic
101
+
102
+ - **Type**: HTTP basic authentication
103
+
@@ -0,0 +1,12 @@
1
+ # SwaggerClient::Group
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **Integer** | | [optional]
7
+ **title** | **String** | |
8
+ **start_year** | **Integer** | | [optional]
9
+ **end_year** | **Integer** | | [optional]
10
+ **current_course** | **String** | Номер курса | [optional]
11
+
12
+
@@ -0,0 +1,10 @@
1
+ # SwaggerClient::Institute
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **Integer** | | [optional]
7
+ **title** | **String** | |
8
+ **short_title** | **String** | | [optional]
9
+
10
+
@@ -0,0 +1,17 @@
1
+ # SwaggerClient::Profile
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **Integer** | | [optional]
7
+ **email** | **String** | | [optional]
8
+ **first_name** | **String** | |
9
+ **last_name** | **String** | |
10
+ **middle_name** | **String** | | [optional]
11
+ **role** | **String** | | [optional]
12
+ **student_group** | [**Group**](Group.md) | | [optional]
13
+ **institute** | [**Institute**](Institute.md) | |
14
+ **photo_url** | **String** | | [optional]
15
+ **gitlab_auth_time** | **String** | Авторизация в Gitlab: дата последней авторизации или null, если авторизации еще не было | [optional]
16
+
17
+
@@ -0,0 +1,65 @@
1
+ # SwaggerClient::ProfileApi
2
+
3
+ All URIs are relative to *http://uenv-core.kpfu.ru/api/v1.0/*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**profile_get**](ProfileApi.md#profile_get) | **GET** /profile/ | Получение профиля
8
+
9
+
10
+ # **profile_get**
11
+ > Profile profile_get(opts)
12
+
13
+ Получение профиля
14
+
15
+
16
+
17
+ ### Example
18
+ ```ruby
19
+ # load the gem
20
+ require 'swagger_client'
21
+ # setup authorization
22
+ SwaggerClient.configure do |config|
23
+ # Configure HTTP basic authorization: Basic
24
+ config.username = 'YOUR USERNAME'
25
+ config.password = 'YOUR PASSWORD'
26
+ end
27
+
28
+ api_instance = SwaggerClient::ProfileApi.new
29
+
30
+ opts = {
31
+ limit: 56, # Integer | Number of results to return per page.
32
+ offset: 56 # Integer | The initial index from which to return the results.
33
+ }
34
+
35
+ begin
36
+ #Получение профиля
37
+ result = api_instance.profile_get(opts)
38
+ p result
39
+ rescue SwaggerClient::ApiError => e
40
+ puts "Exception when calling ProfileApi->profile_get: #{e}"
41
+ end
42
+ ```
43
+
44
+ ### Parameters
45
+
46
+ Name | Type | Description | Notes
47
+ ------------- | ------------- | ------------- | -------------
48
+ **limit** | **Integer**| Number of results to return per page. | [optional]
49
+ **offset** | **Integer**| The initial index from which to return the results. | [optional]
50
+
51
+ ### Return type
52
+
53
+ [**Profile**](Profile.md)
54
+
55
+ ### Authorization
56
+
57
+ [Basic](../README.md#Basic)
58
+
59
+ ### HTTP request headers
60
+
61
+ - **Content-Type**: application/json
62
+ - **Accept**: application/json
63
+
64
+
65
+
@@ -0,0 +1,77 @@
1
+ =begin
2
+ #UniEnv Core API
3
+
4
+ #Документация по API UniEnv
5
+
6
+ OpenAPI spec version: v1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.24-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module SwaggerClient
16
+ class ProfileApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Получение профиля
23
+ #
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [Integer] :limit Number of results to return per page.
26
+ # @option opts [Integer] :offset The initial index from which to return the results.
27
+ # @return [Profile]
28
+ def profile_get(opts = {})
29
+ data, _status_code, _headers = profile_get_with_http_info(opts)
30
+ data
31
+ end
32
+
33
+ # Получение профиля
34
+ #
35
+ # @param [Hash] opts the optional parameters
36
+ # @option opts [Integer] :limit Number of results to return per page.
37
+ # @option opts [Integer] :offset The initial index from which to return the results.
38
+ # @return [Array<(Profile, Fixnum, Hash)>] Profile data, response status code and response headers
39
+ def profile_get_with_http_info(opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: ProfileApi.profile_get ...'
42
+ end
43
+ # resource path
44
+ local_var_path = '/profile/'
45
+
46
+ # query parameters
47
+ query_params = {}
48
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
49
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
50
+
51
+ # header parameters
52
+ header_params = {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
55
+ # HTTP header 'Content-Type'
56
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
57
+
58
+ # form parameters
59
+ form_params = {}
60
+
61
+ # http body (model)
62
+ post_body = nil
63
+ auth_names = ['Basic']
64
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
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 => 'Profile')
71
+ if @api_client.config.debugging
72
+ @api_client.config.logger.debug "API called: ProfileApi#profile_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
73
+ end
74
+ return data, status_code, headers
75
+ end
76
+ end
77
+ end