true-conf 0.2.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00ff9c51d74805eb57bf177b08b9e1756aebe22657f63b305d8367496e7e2bfa
4
- data.tar.gz: e1593f9f88add18b5603ca84c0e5d7006c6f4f585195cd787e7ef20e711f036e
3
+ metadata.gz: 3229994ae56f8e147da589145beb40c4b9b4d92b34ef24e977b04fa49703f299
4
+ data.tar.gz: a9b95791b3bb3ee75befae3c2049ce76800f2a35bf2228fc9922370bcd0951f2
5
5
  SHA512:
6
- metadata.gz: d495a41c2efbf4383833006ae42ac12c766f50f40d21e529fc377d5bb2d23caa930d6c1b43103cf43b0673500ded6e91821e1a911a9cfaade5bd395fe709b8b8
7
- data.tar.gz: e28f7951f0fe8f1b84d2e6d796af1ed290d2a6e3dabfac2063159187abb4cd929881d3225bb2cff23435f15f81ab82e6dc5e4c5e9498cb55bbec23db7783ef95
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 Token to authenticate API request. By defaut, a OAuth2 client will be used.
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
- client = 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
- # Token
36
- client = TrueConf::Client.new auth_method: 'token',
37
- client_token: '<client_token>', # required
38
- api_server: '<server_name>', # required
39
- version: '3.2' # optional, default: 3.2
40
- ```
41
-
42
- ```ruby
43
- client.success?
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
- ### Users
51
- https://developers.trueconf.ru/api/server/#api-Users
57
+ conference = client.conferences.create(**params)
58
+ # => TrueConf::Entity::Conference
52
59
 
53
- **Entities**
60
+ conference = client.by_conference(conference_id: 12345).get
61
+ # => TrueConf::Entity::Conference
54
62
 
55
- ```ruby
56
- TrueConf::Entity::User
63
+ conference = client.by_conference(conference_id: 12345).update(**params)
64
+ # => TrueConf::Entity::Conference
57
65
 
58
- user = client.by_user(id: "andy").get
59
- user.disabled? # false
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
- ```ruby
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
- ```ruby
75
- TrueConf::Entity::UserSimple
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
- ### Error
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
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/true-conf. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
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
 
@@ -33,7 +33,7 @@ module TrueConf
33
33
  scope :by_call do
34
34
  option :id, proc(&:to_s)
35
35
 
36
- path { "/calls/#{id}" }
36
+ path { "/calls/#{URI.encode_www_form_component(id)}" }
37
37
  format "json"
38
38
 
39
39
  operation :get do
@@ -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 :client_token, proc(&:to_s), optional: true
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 :token_missed if auth_method.token? && client_token.nil? }
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) : client_token
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: "Invalid auth method"
8
- token_missed: API token missed
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
@@ -8,6 +8,10 @@ module TrueConf
8
8
  option :date, proc(&:to_s)
9
9
  option :timezone_type, proc(&:to_i)
10
10
  option :timezone, proc(&:to_s)
11
+
12
+ def as_time
13
+ Time.parse(date)
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -4,7 +4,7 @@ module TrueConf
4
4
  class AuthMethodType < String
5
5
  extend TrueConf::Callable
6
6
 
7
- METHODS = %w[oauth token].freeze
7
+ METHODS = %w[oauth api_key].freeze
8
8
 
9
9
  METHODS.each do |method|
10
10
  define_method("#{method}?") do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TrueConf
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.3"
5
5
  end
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.0
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-30 00:00:00.000000000 Z
11
+ date: 2020-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evil-client