true-conf 0.2.0 → 0.2.3
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 +4 -4
- data/README.md +78 -63
- data/lib/true-conf/call.rb +1 -1
- data/lib/true-conf/client.rb +3 -3
- data/lib/true-conf/config/locales/en.yml +2 -2
- data/lib/true-conf/entity/date_time.rb +4 -0
- data/lib/true-conf/types/auth_method_type.rb +1 -1
- data/lib/true-conf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3229994ae56f8e147da589145beb40c4b9b4d92b34ef24e977b04fa49703f299
|
4
|
+
data.tar.gz: a9b95791b3bb3ee75befae3c2049ce76800f2a35bf2228fc9922370bcd0951f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca9807bc3c3a0927d88abacfb658e72fe7a324042e3801dbbff5644563abeee948b5a31bd23363c11cdbe9ff97401720f24da6feb02a694bab9174295f4ccaa1
|
7
|
+
data.tar.gz: 55fdba5292239545083fc73b7b742fd1d3b232d89bbb32d1bee2c711af976b688a0647dc387c564103d32f4343f630047797f95a444fe2a2b320432f4cc33b6f
|
data/README.md
CHANGED
@@ -22,60 +22,60 @@ Or install it yourself as:
|
|
22
22
|
$ gem install true-conf
|
23
23
|
|
24
24
|
## Usage
|
25
|
-
The TrueConf API uses OAuth2 or
|
25
|
+
The TrueConf API uses OAuth2 or API Key to authenticate API request. By defaut, a OAuth2 client will be used.
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
# OAuth
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
client.error?
|
29
|
+
response = TrueConf::Client.new auth_method: 'oauth', # default: oauth
|
30
|
+
client_id: '<client_id>', # required
|
31
|
+
client_secret: '<client_secret>', # required
|
32
|
+
api_server: '<server_name>', # required
|
33
|
+
version: '3.2' # optional, default: 3.2
|
34
|
+
|
35
|
+
# API Key
|
36
|
+
response = TrueConf::Client.new auth_method: 'api_key',
|
37
|
+
api_key: '<api_key>', # required
|
38
|
+
api_server: '<server_name>', # required
|
39
|
+
version: '3.2' # optional, default: 3.2
|
40
|
+
|
41
|
+
# => TrueConf::Client
|
42
|
+
response.success?
|
43
|
+
response.error?
|
45
44
|
```
|
46
45
|
|
47
46
|
### Conferences
|
47
|
+
https://developers.trueconf.ru/api/server/#api-Conferences
|
48
48
|
|
49
|
+
```ruby
|
50
|
+
params = {
|
51
|
+
topic: "My first conference"
|
52
|
+
owner: "andy@example.com",
|
53
|
+
type: 0,
|
54
|
+
schedule: { type: -1 }
|
55
|
+
}
|
49
56
|
|
50
|
-
|
51
|
-
|
57
|
+
conference = client.conferences.create(**params)
|
58
|
+
# => TrueConf::Entity::Conference
|
52
59
|
|
53
|
-
|
60
|
+
conference = client.by_conference(conference_id: 12345).get
|
61
|
+
# => TrueConf::Entity::Conference
|
54
62
|
|
55
|
-
|
56
|
-
TrueConf::Entity::
|
63
|
+
conference = client.by_conference(conference_id: 12345).update(**params)
|
64
|
+
# => TrueConf::Entity::Conference
|
57
65
|
|
58
|
-
|
59
|
-
|
60
|
-
user.enabled? # true
|
61
|
-
user.not_active? # false
|
62
|
-
user.invalid? # false
|
63
|
-
user.offline? # false
|
64
|
-
user.online? # true
|
65
|
-
user.busy? # false
|
66
|
-
user.multihost? # false
|
66
|
+
conference = client.by_conference(conference_id: 12345).delete
|
67
|
+
# => TrueConf::Entity::ConferenceSimple
|
67
68
|
|
68
|
-
|
69
|
-
|
70
|
-
TrueConf::Entity::UserList
|
69
|
+
conference = client.by_conference(conference_id: 12345).start
|
70
|
+
# => TrueConf::Entity::ConferenceSimple
|
71
71
|
|
72
|
+
conference = client.by_conference(conference_id: 12345).stop
|
73
|
+
# => TrueConf::Entity::ConferenceSimple
|
72
74
|
```
|
73
75
|
|
74
|
-
|
75
|
-
|
76
|
+
### Users
|
77
|
+
https://developers.trueconf.ru/api/server/#api-Users
|
76
78
|
|
77
|
-
```
|
78
|
-
**Actions**
|
79
79
|
```ruby
|
80
80
|
users = client.users.all url_type: "dynamic", # optional
|
81
81
|
page_id: 1, # optional
|
@@ -92,6 +92,14 @@ user = client.users.create(**params)
|
|
92
92
|
|
93
93
|
user = client.by_user(id: "andy").get
|
94
94
|
# => TrueConf::Entity::User
|
95
|
+
user.disabled? # false
|
96
|
+
user.enabled? # true
|
97
|
+
user.not_active? # false
|
98
|
+
user.invalid? # false
|
99
|
+
user.offline? # false
|
100
|
+
user.online? # true
|
101
|
+
user.busy? # false
|
102
|
+
user.multihost? # false
|
95
103
|
|
96
104
|
user = client.by_user(id: "andy").update(**params)
|
97
105
|
# => TrueConf::Entity::User
|
@@ -106,29 +114,6 @@ user = client.by_user(id: "andy").disconnect
|
|
106
114
|
### Invitations
|
107
115
|
https://developers.trueconf.ru/api/server/#api-Conferences_Invitations
|
108
116
|
|
109
|
-
**Entities**
|
110
|
-
|
111
|
-
```ruby
|
112
|
-
TrueConf::Entity::Invitation
|
113
|
-
|
114
|
-
invitation = client.by_conference(conference_id: "3390770247")
|
115
|
-
.by_invitation(id: "user")
|
116
|
-
.get
|
117
|
-
|
118
|
-
invitation.owner? # true
|
119
|
-
invitation.user? # true
|
120
|
-
invitation.custom? # false
|
121
|
-
|
122
|
-
```
|
123
|
-
```ruby
|
124
|
-
TrueConf::Entity::InvitationList
|
125
|
-
```
|
126
|
-
|
127
|
-
```ruby
|
128
|
-
TrueConf::Entity::InvitationSimple
|
129
|
-
```
|
130
|
-
|
131
|
-
**Actions**
|
132
117
|
```ruby
|
133
118
|
# Add Invitation
|
134
119
|
invitation = client.by_conference(conference_id: "3390770247")
|
@@ -148,6 +133,10 @@ invitation = client.by_conference(conference_id: "3390770247")
|
|
148
133
|
.get
|
149
134
|
# => TrueConf::Entity::Invitation
|
150
135
|
|
136
|
+
invitation.owner? # true
|
137
|
+
invitation.user? # true
|
138
|
+
invitation.custom? # false
|
139
|
+
|
151
140
|
# Update Invitation
|
152
141
|
invitation = client.by_conference(conference_id: "3390770247")
|
153
142
|
.by_invitation(id: "user")
|
@@ -161,13 +150,39 @@ invitation = client.by_conference(conference_id: "3390770247")
|
|
161
150
|
# => TrueConf::Entity::InvitationSimple
|
162
151
|
```
|
163
152
|
|
164
|
-
###
|
153
|
+
### Records
|
154
|
+
https://developers.trueconf.ru/api/server/#api-Conferences_Records
|
155
|
+
```ruby
|
156
|
+
records = client.by_conference(conference_id: "3390770247").records.all
|
157
|
+
# => TrueConf::Entity::RecordList
|
158
|
+
|
159
|
+
record = client.by_conference(conference_id: "3390770247").by_record(id: 12345).get
|
160
|
+
# => TrueConf::Entity::Record
|
165
161
|
|
162
|
+
record = client.by_conference(conference_id: "3390770247").by_record(id: 12345).download
|
163
|
+
# => TrueConf::Entity::Record
|
164
|
+
```
|
165
|
+
### Calls
|
166
|
+
https://developers.trueconf.ru/api/server/#api-Logs
|
166
167
|
|
168
|
+
```ruby
|
169
|
+
calls = client.logs.calls.all()
|
170
|
+
# => TrueConf::Entity::CallList
|
171
|
+
|
172
|
+
call = client.logs.by_call(id: "3390770247").get
|
173
|
+
# => TrueConf::Entity::Call
|
174
|
+
|
175
|
+
participants = client.logs.by_call(id: "3390770247").participants
|
176
|
+
# => TrueConf::Entity::CallParticipantList
|
177
|
+
```
|
167
178
|
|
168
179
|
## Contributing
|
180
|
+
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
169
181
|
|
170
|
-
|
182
|
+
- [Report bugs](https://github.com/paderinandrey/true-conf/issues)
|
183
|
+
- Fix bugs and [submit pull requests](https://github.com/paderinandrey/true-conf/pulls)
|
184
|
+
- Write, clarify, or fix documentation
|
185
|
+
- Suggest or add new features
|
171
186
|
|
172
187
|
## License
|
173
188
|
|
data/lib/true-conf/call.rb
CHANGED
data/lib/true-conf/client.rb
CHANGED
@@ -10,7 +10,7 @@ module TrueConf
|
|
10
10
|
option :auth_method, AuthMethodType, default: -> { "oauth" }
|
11
11
|
option :client_id, proc(&:to_s), optional: true
|
12
12
|
option :client_secret, proc(&:to_s), optional: true
|
13
|
-
option :
|
13
|
+
option :api_key, proc(&:to_s), optional: true
|
14
14
|
option :api_server, proc(&:to_s)
|
15
15
|
option :token_url, proc(&:to_s), default: -> { "/oauth2/v1/token" }
|
16
16
|
option :version, proc(&:to_s), default: -> { "v3.1" }
|
@@ -20,7 +20,7 @@ module TrueConf
|
|
20
20
|
|
21
21
|
errors.add :invalid_auth_method, field: "auth_method", level: "error"
|
22
22
|
end
|
23
|
-
validate { errors.add :
|
23
|
+
validate { errors.add :apikey_missed if auth_method.api_key? && api_key.nil? }
|
24
24
|
validate { errors.add :client_id_missed if auth_method.oauth? && client_id.nil? }
|
25
25
|
validate { errors.add :client_secret_missed if auth_method.oauth? && client_secret.nil? }
|
26
26
|
validate { errors.add :unsupported_api_version unless %w[v3.1 v3.2].include?(version) }
|
@@ -41,7 +41,7 @@ module TrueConf
|
|
41
41
|
end
|
42
42
|
|
43
43
|
security do
|
44
|
-
token = auth_method.oauth? ? access_token(client_id, client_secret) :
|
44
|
+
token = auth_method.oauth? ? access_token(client_id, client_secret) : api_key
|
45
45
|
token_auth(token, inside: :query)
|
46
46
|
end
|
47
47
|
end
|
@@ -4,8 +4,8 @@ en:
|
|
4
4
|
client:
|
5
5
|
errors:
|
6
6
|
true_conf/client:
|
7
|
-
invalid_auth_method:
|
8
|
-
|
7
|
+
invalid_auth_method: Invalid Auth method
|
8
|
+
apikey_missed: API key missed
|
9
9
|
client_id_missed: Client ID missed
|
10
10
|
client_secret_missed: Client Secret missed
|
11
11
|
unsupported_api_version: Unsupported api version on TrueConf server
|
data/lib/true-conf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: true-conf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Paderin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evil-client
|