yandex360 1.0.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +12 -0
  3. data/.github/workflows/ci.yml +51 -0
  4. data/.gitignore +2 -0
  5. data/.rspec +5 -0
  6. data/Gemfile +0 -9
  7. data/Gemfile.lock +40 -1
  8. data/README.md +71 -3
  9. data/lib/yandex360/resources/departments.rb +12 -10
  10. data/lib/yandex360/resources/groups.rb +12 -10
  11. data/lib/yandex360/resources/users.rb +2 -2
  12. data/lib/yandex360/version.rb +1 -1
  13. data/lib/yandex360.rb +2 -1
  14. data/spec/antispam_spec.rb +46 -0
  15. data/spec/client_spec.rb +24 -0
  16. data/spec/departments_spec.rb +131 -0
  17. data/spec/groups_spec.rb +133 -0
  18. data/spec/spec_helper.rb +59 -0
  19. data/spec/users_spec.rb +203 -0
  20. data/spec/vcr/anispam/create.yml +43 -0
  21. data/spec/vcr/anispam/delete.yml +41 -0
  22. data/spec/vcr/anispam/list.yml +41 -0
  23. data/spec/vcr/departments/add_alias.yml +43 -0
  24. data/spec/vcr/departments/create.yml +43 -0
  25. data/spec/vcr/departments/delete.yml +41 -0
  26. data/spec/vcr/departments/delete_alias.yml +41 -0
  27. data/spec/vcr/departments/delete_error.yml +37 -0
  28. data/spec/vcr/departments/info.yml +41 -0
  29. data/spec/vcr/departments/list.yml +41 -0
  30. data/spec/vcr/departments/update.yml +44 -0
  31. data/spec/vcr/groups/add_user.yml +43 -0
  32. data/spec/vcr/groups/create.yml +43 -0
  33. data/spec/vcr/groups/delete.yml +41 -0
  34. data/spec/vcr/groups/delete_user.yml +41 -0
  35. data/spec/vcr/groups/list.yml +48 -0
  36. data/spec/vcr/groups/params.yml +41 -0
  37. data/spec/vcr/groups/update.yml +43 -0
  38. data/spec/vcr/groups/users.yml +41 -0
  39. data/spec/vcr/users/add.yml +43 -0
  40. data/spec/vcr/users/add_alias.yml +43 -0
  41. data/spec/vcr/users/delete_alias.yml +41 -0
  42. data/spec/vcr/users/get2FA.yml +41 -0
  43. data/spec/vcr/users/get2FA_error.yml +37 -0
  44. data/spec/vcr/users/has2FA.yml +41 -0
  45. data/spec/vcr/users/info.yml +41 -0
  46. data/spec/vcr/users/list.yml +41 -0
  47. data/spec/vcr/users/list_error.yml +37 -0
  48. data/spec/vcr/users/update.yml +44 -0
  49. data/yandex360.gemspec +10 -2
  50. metadata +146 -4
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api360.yandex.net/directory/v1/org/1234567/users/1130000018743049/2fa
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v1.10.2
12
+ Authorization:
13
+ - TOKEN
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Thu, 13 Oct 2022 15:16:14 GMT
27
+ Grpc-Status:
28
+ - '0'
29
+ Grpc-Message:
30
+ - OK
31
+ Content-Length:
32
+ - '44'
33
+ Server:
34
+ - api360
35
+ X-Request-Id:
36
+ - 6e744476-417c-4839-8294-b99c402c3d4c
37
+ body:
38
+ encoding: UTF-8
39
+ string: '{"userId":"1130000018743049","has2fa":false}'
40
+ recorded_at: Thu, 13 Oct 2022 15:16:14 GMT
41
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api360.yandex.net/directory/v1/org/123/users/123/2fa
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v1.10.2
12
+ Authorization:
13
+ - TOKEN
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 403
21
+ message: Forbidden
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Thu, 13 Oct 2022 15:16:14 GMT
27
+ Content-Length:
28
+ - '48'
29
+ Server:
30
+ - api360
31
+ X-Request-Id:
32
+ - c155f3be-3376-468d-8fab-4bd1d8fceb39
33
+ body:
34
+ encoding: UTF-8
35
+ string: '{"code":7,"message":"Not an admin","details":[]}'
36
+ recorded_at: Thu, 13 Oct 2022 15:16:14 GMT
37
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api360.yandex.net/directory/v1/org/1234567/users/1130000018743049/2fa
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v1.10.2
12
+ Authorization:
13
+ - TOKEN
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Thu, 13 Oct 2022 15:20:25 GMT
27
+ Grpc-Status:
28
+ - '0'
29
+ Grpc-Message:
30
+ - OK
31
+ Content-Length:
32
+ - '44'
33
+ Server:
34
+ - api360
35
+ X-Request-Id:
36
+ - a4f30fb0-8c46-4d63-916e-fdf1f517d66f
37
+ body:
38
+ encoding: UTF-8
39
+ string: '{"userId":"1130000018743049","has2fa":false}'
40
+ recorded_at: Thu, 13 Oct 2022 15:20:25 GMT
41
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api360.yandex.net/directory/v1/org/1234567/users/987654321
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v1.10.2
12
+ Authorization:
13
+ - TOKEN
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Thu, 13 Oct 2022 15:16:15 GMT
27
+ Grpc-Status:
28
+ - '0'
29
+ Grpc-Message:
30
+ - OK
31
+ Content-Length:
32
+ - '752'
33
+ Server:
34
+ - api360
35
+ X-Request-Id:
36
+ - 73dc9585-d689-4d01-9397-ec54a861e412
37
+ body:
38
+ encoding: UTF-8
39
+ string: '{"id":"987654321","nickname":"yndx-forms-cnt-robot","departmentId":0,"email":"yndx-forms-cnt-robot@yandex.ru","name":{"first":"Робот сервиса Forms","last":"","middle":""},"gender":"male","position":"","avatarId":"","about":"","birthday":"2019-04-25","contacts":[{"type":"staff","value":"https://staff.yandex.ru/yndx-forms-cnt-robot?org_id=1234567&uid=987654321","main":false,"alias":false,"synthetic":true},{"type":"email","value":"yndx-forms-cnt-robot@yandex.ru","main":true,"alias":false,"synthetic":true}],"aliases":[],"groups":[4],"externalId":"","isAdmin":false,"isRobot":true,"isDismissed":false,"isEnabled":false,"timezone":"Europe/Moscow","language":"ru","createdAt":"2019-04-25T08:03:56.823Z","updatedAt":"2019-04-25T08:03:56.823Z"}'
40
+ recorded_at: Thu, 13 Oct 2022 15:16:15 GMT
41
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api360.yandex.net/directory/v1/org/1234567/users?page=1&perPage=10
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v1.10.2
12
+ Authorization:
13
+ - TOKEN
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Thu, 13 Oct 2022 15:16:14 GMT
27
+ Grpc-Status:
28
+ - '0'
29
+ Grpc-Message:
30
+ - OK
31
+ Content-Length:
32
+ - '7181'
33
+ Server:
34
+ - api360
35
+ X-Request-Id:
36
+ - 405163b1-69ed-4f85-8418-764bfa565867
37
+ body:
38
+ encoding: UTF-8
39
+ string: '{"users":[{"id":"987654321","nickname":"yndx-forms-cnt-robot","departmentId":0,"email":"yndx-forms-cnt-robot@yandex.ru","name":{"first":"Робот сервиса Forms","last":"","middle":""},"gender":"male","position":"","avatarId":"","about":"","birthday":"2019-04-25","contacts":[{"type":"staff","value":"https://staff.yandex.ru/yndx-forms-cnt-robot?org_id=1234567&uid=987654321","main":false,"alias":false,"synthetic":true},{"type":"email","value":"yndx-forms-cnt-robot@yandex.ru","main":true,"alias":false,"synthetic":true}],"aliases":[],"groups":[4],"externalId":"","isAdmin":false,"isRobot":true,"isDismissed":false,"isEnabled":false,"timezone":"Europe/Moscow","language":"ru","createdAt":"2019-04-25T08:03:56.823Z","updatedAt":"2019-04-25T08:03:56.823Z"}],"page":1,"pages":1,"perPage":10,"total":1}'
40
+ recorded_at: Thu, 13 Oct 2022 15:16:14 GMT
41
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api360.yandex.net/directory/v1/org/3287461283/users?page=1&perPage=10
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v1.10.2
12
+ Authorization:
13
+ - TOKEN
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 403
21
+ message: Forbidden
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Date:
26
+ - Thu, 13 Oct 2022 15:16:14 GMT
27
+ Content-Length:
28
+ - '48'
29
+ Server:
30
+ - api360
31
+ X-Request-Id:
32
+ - ebf16ca2-a192-4979-bc1e-cc16573b30ff
33
+ body:
34
+ encoding: UTF-8
35
+ string: '{"code":7,"message":"Not an admin","details":[]}'
36
+ recorded_at: Thu, 13 Oct 2022 15:16:14 GMT
37
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: patch
5
+ uri: https://api360.yandex.net/directory/v1/org/1234567/users/1130000061922106
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"about":"Yandex360 - Ruby API gem","name":{"first":"Ruby","last":"gem","middle":"API"},"nickname":"yandex360-ruby-api-client","password":"passswrrdwithstrrngscrrty"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v1.10.2
12
+ Authorization:
13
+ - TOKEN
14
+ Content-Type:
15
+ - application/json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Content-Type:
26
+ - application/json
27
+ Date:
28
+ - Thu, 13 Oct 2022 16:10:27 GMT
29
+ Grpc-Status:
30
+ - '0'
31
+ Grpc-Message:
32
+ - OK
33
+ Content-Length:
34
+ - '714'
35
+ Server:
36
+ - api360
37
+ X-Request-Id:
38
+ - 9f6b952c-be44-4539-9298-b2e06c5ab037
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"id":"1130000061922106","nickname":"yandex360","departmentId":1,"email":"yandex360@example.ru","name":{"first":"Ruby","last":"gem","middle":"API"},"gender":"","position":"","avatarId":"","about":"Yandex360
42
+ - Ruby API gem","birthday":"","contacts":[{"type":"staff","value":"https://staff.yandex.ru/yandex360?org_id=1234567&uid=1130000061922106","main":false,"alias":false,"synthetic":true},{"type":"email","value":"yandex360@example.ru","main":true,"alias":false,"synthetic":true}],"aliases":[],"groups":[],"externalId":"","isAdmin":false,"isRobot":false,"isDismissed":false,"isEnabled":true,"timezone":"Europe/Moscow","language":"ru","createdAt":"2022-10-13T15:54:40.945Z","updatedAt":"2022-10-13T16:10:26.976Z"}'
43
+ recorded_at: Thu, 13 Oct 2022 16:10:27 GMT
44
+ recorded_with: VCR 6.1.0
data/yandex360.gemspec CHANGED
@@ -8,8 +8,8 @@ require "yandex360/version"
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "yandex360"
10
10
  s.version = Yandex360::VERSION
11
- s.summary = "WIP - Yandex 360 API client"
12
- s.description = "WIP - Yandex 360 API wrapper written in Ruby"
11
+ s.summary = "Yandex 360 API client"
12
+ s.description = "Yandex 360 API wrapper written in Ruby"
13
13
  s.authors = ["Ilya Brin"]
14
14
  s.email = "ilya@codeplay.ru"
15
15
  s.files = `git ls-files -z`.split("\x0")
@@ -24,4 +24,12 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.add_dependency "addressable", "~> 2.3", ">= 2.3.7"
26
26
  s.add_dependency "faraday", "~> 1.7"
27
+
28
+ s.add_development_dependency "bundler"
29
+ s.add_development_dependency "rake", "~> 12.3.3"
30
+ s.add_development_dependency "rspec", "~> 3.0"
31
+ s.add_development_dependency "simplecov", "~> 0.9"
32
+ s.add_development_dependency "simplecov-lcov", "~> 0.7.0"
33
+ s.add_development_dependency "vcr", "~> 6.1"
34
+ s.add_development_dependency "webmock", "~> 3.18", ">= 3.18.1"
27
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex360
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Brin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2022-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -44,13 +44,120 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.7'
47
- description: WIP - Yandex 360 API wrapper written in Ruby
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 12.3.3
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 12.3.3
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: simplecov
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.9'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.9'
103
+ - !ruby/object:Gem::Dependency
104
+ name: simplecov-lcov
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 0.7.0
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: 0.7.0
117
+ - !ruby/object:Gem::Dependency
118
+ name: vcr
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '6.1'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '6.1'
131
+ - !ruby/object:Gem::Dependency
132
+ name: webmock
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '3.18'
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: 3.18.1
141
+ type: :development
142
+ prerelease: false
143
+ version_requirements: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: '3.18'
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: 3.18.1
151
+ description: Yandex 360 API wrapper written in Ruby
48
152
  email: ilya@codeplay.ru
49
153
  executables: []
50
154
  extensions: []
51
155
  extra_rdoc_files: []
52
156
  files:
157
+ - ".github/dependabot.yml"
158
+ - ".github/workflows/ci.yml"
53
159
  - ".gitignore"
160
+ - ".rspec"
54
161
  - ".rubocop.yml"
55
162
  - Gemfile
56
163
  - Gemfile.lock
@@ -69,6 +176,41 @@ files:
69
176
  - lib/yandex360/resources/groups.rb
70
177
  - lib/yandex360/resources/users.rb
71
178
  - lib/yandex360/version.rb
179
+ - spec/antispam_spec.rb
180
+ - spec/client_spec.rb
181
+ - spec/departments_spec.rb
182
+ - spec/groups_spec.rb
183
+ - spec/spec_helper.rb
184
+ - spec/users_spec.rb
185
+ - spec/vcr/anispam/create.yml
186
+ - spec/vcr/anispam/delete.yml
187
+ - spec/vcr/anispam/list.yml
188
+ - spec/vcr/departments/add_alias.yml
189
+ - spec/vcr/departments/create.yml
190
+ - spec/vcr/departments/delete.yml
191
+ - spec/vcr/departments/delete_alias.yml
192
+ - spec/vcr/departments/delete_error.yml
193
+ - spec/vcr/departments/info.yml
194
+ - spec/vcr/departments/list.yml
195
+ - spec/vcr/departments/update.yml
196
+ - spec/vcr/groups/add_user.yml
197
+ - spec/vcr/groups/create.yml
198
+ - spec/vcr/groups/delete.yml
199
+ - spec/vcr/groups/delete_user.yml
200
+ - spec/vcr/groups/list.yml
201
+ - spec/vcr/groups/params.yml
202
+ - spec/vcr/groups/update.yml
203
+ - spec/vcr/groups/users.yml
204
+ - spec/vcr/users/add.yml
205
+ - spec/vcr/users/add_alias.yml
206
+ - spec/vcr/users/delete_alias.yml
207
+ - spec/vcr/users/get2FA.yml
208
+ - spec/vcr/users/get2FA_error.yml
209
+ - spec/vcr/users/has2FA.yml
210
+ - spec/vcr/users/info.yml
211
+ - spec/vcr/users/list.yml
212
+ - spec/vcr/users/list_error.yml
213
+ - spec/vcr/users/update.yml
72
214
  - yandex360.gemspec
73
215
  homepage: https://github.com/ruby-api-client/yandex360
74
216
  licenses:
@@ -93,5 +235,5 @@ requirements: []
93
235
  rubygems_version: 3.2.3
94
236
  signing_key:
95
237
  specification_version: 4
96
- summary: WIP - Yandex 360 API client
238
+ summary: Yandex 360 API client
97
239
  test_files: []