uiza 1.1.1 → 1.2.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.
@@ -1,26 +1,29 @@
1
1
  ## Storage
2
2
  You can add your storage (FTP, AWS S3) with UIZA.
3
- After synced, you can select your content easier from your storage to [create entity](https://docs.uiza.io/#create-entity).
3
+ After synced, you can select your content easier from your storage to [create entity](https://docs.uiza.io/v4/#create-entity).
4
4
 
5
- See details [here](https://docs.uiza.io/#storage).
5
+ See details [here](https://docs.uiza.io/v4/#storage).
6
6
 
7
7
  ## Add a storage
8
8
  You can sync your storage (FTP, AWS S3) with UIZA.
9
9
  After synced, you can select your content easier from your storage to [create entity](https://docs.uiza.io/#create-entity).
10
10
 
11
- See details [here](https://docs.uiza.io/#add-a-storage).
11
+ See details [here](https://docs.uiza.io/v4/#add-a-storage).
12
12
 
13
13
  ```ruby
14
14
  require "uiza"
15
15
 
16
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
16
+ Uiza.app_id = "your-app-id"
17
17
  Uiza.authorization = "your-authorization"
18
18
 
19
19
  params = {
20
20
  name: "FTP Uiza",
21
21
  description: "FTP of Uiza, use for transcode",
22
22
  storageType: "ftp",
23
- host: "ftp-example.uiza.io"
23
+ host: "ftp-example.uiza.io",
24
+ username: "example user",
25
+ password: "example password",
26
+ description: "example description"
24
27
  }
25
28
 
26
29
  begin
@@ -37,35 +40,45 @@ end
37
40
  ```
38
41
 
39
42
  Example Response
40
- ```ruby
43
+ ```json
41
44
  {
42
- "id": "cd003123-7ec9-4f3a-9d7c-f2de93e83e49",
43
- "name": "FTP Uiza",
44
- "description": "FTP of Uiza, use for transcode",
45
- "storageType": "ftp",
46
- "usageType": "input",
47
- "bucket": null,
48
- "prefix": null,
49
- "host": "ftp-exemple.uiza.io",
50
- "awsAccessKey": null,
51
- "awsSecretKey": null,
52
- "username": "uiza",
53
- "password": "=5;9x@LPsd+w7qW",
54
- "region": null,
55
- "port": 21,
56
- "createdAt": "2018-06-19T03:01:56.000Z",
57
- "updatedAt": "2018-06-19T03:01:56.000Z"
45
+ "data": {
46
+ "id": "f8819781-df28-410f-8cb1-ee3a29523840",
47
+ "name": "FTP Uiza",
48
+ "description": "example description",
49
+ "storageType": "ftp",
50
+ "usageType": "input",
51
+ "bucket": nil,
52
+ "prefix": nil,
53
+ "host": "ftp-example.uiza.io",
54
+ "awsAccessKey": nil,
55
+ "awsSecretKey": nil,
56
+ "username": "example user",
57
+ "password": "example password",
58
+ "region": nil,
59
+ "port": nil,
60
+ "createdAt": "2019-03-13T11:21:26.000Z",
61
+ "updatedAt": nil
62
+ },
63
+ "version": 4,
64
+ "datetime": "2019-03-13T11:21:26.707Z",
65
+ "policy": "public",
66
+ "requestId": "9e49aa2e-2e52-497f-b858-3ae172986a54",
67
+ "serviceName": "api-v4",
68
+ "message": "OK",
69
+ "code": 200,
70
+ "type": "SUCCESS"
58
71
  }
59
72
  ```
60
73
 
61
74
  ## Retrieve a storage
62
75
  Get information of your added storage (`FTP` or `AWS S3`).
63
76
 
64
- See details [here](https://docs.uiza.io/#retrieve-a-storage).
77
+ See details [here](https://docs.uiza.io/v4/#retrieve-a-storage).
65
78
 
66
79
  ```ruby
67
80
 
68
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
81
+ Uiza.app_id = "your-app-id"
69
82
  Uiza.authorization = "your-authorization"
70
83
 
71
84
  begin
@@ -82,44 +95,53 @@ end
82
95
  ```
83
96
 
84
97
  Example Response
85
- ```ruby
98
+ ```json
86
99
  {
87
- "id": "cd003123-7ec9-4f3a-9d7c-f2de93e83e49",
88
- "name": "FTP Uiza",
89
- "description": "FTP of Uiza, use for transcode",
90
- "storageType": "ftp",
91
- "usageType": "input",
92
- "bucket": null,
93
- "prefix": null,
94
- "host": "ftp-exemple.uiza.io",
95
- "awsAccessKey": null,
96
- "awsSecretKey": null,
97
- "username": "uiza",
98
- "password": "=5;9x@LPsd+w7qW",
99
- "region": null,
100
- "port": 21,
101
- "createdAt": "2018-06-19T03:01:56.000Z",
102
- "updatedAt": "2018-06-19T03:01:56.000Z"
100
+ "data": {
101
+ "id": "f8819781-df28-410f-8cb1-ee3a29523840",
102
+ "name": "FTP Uiza",
103
+ "description": "example description",
104
+ "storageType": "ftp",
105
+ "usageType": "input",
106
+ "bucket": nil,
107
+ "prefix": nil,
108
+ "host": "ftp-example.uiza.io",
109
+ "awsAccessKey": nil,
110
+ "awsSecretKey": nil,
111
+ "username": "example user",
112
+ "password": "example password",
113
+ "region": nil,
114
+ "port": nil,
115
+ "createdAt": "2019-03-13T11:21:26.000Z",
116
+ "updatedAt": nil
117
+ },
118
+ "version": 4,
119
+ "datetime": "2019-03-13T11:21:26.707Z",
120
+ "policy": "public",
121
+ "requestId": "9e49aa2e-2e52-497f-b858-3ae172986a54",
122
+ "serviceName": "api-v4",
123
+ "message": "OK",
124
+ "code": 200,
125
+ "type": "SUCCESS"
103
126
  }
104
127
  ```
105
128
 
106
129
  ## Update storage
107
130
  Update storage's information.
108
131
 
109
- See details [here](https://docs.uiza.io/#update-storage).
132
+ See details [here](https://docs.uiza.io/v4/#update-storage).
110
133
 
111
134
  ```ruby
112
135
  require "uiza"
113
136
 
114
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
137
+ Uiza.app_id = "your-app-id"
115
138
  Uiza.authorization = "your-authorization"
116
139
 
117
140
  params = {
118
141
  id: "your-storage-id",
119
142
  name: "FTP Uiza edited",
120
143
  host: "ftp-example.uiza.io",
121
- port: 21,
122
- storageType: "ftp"
144
+ storageType: "s3"
123
145
  }
124
146
 
125
147
  begin
@@ -136,36 +158,46 @@ end
136
158
  ```
137
159
 
138
160
  Example Response
139
- ```ruby
161
+ ```json
140
162
  {
141
- "id": "cd003123-7ec9-4f3a-9d7c-f2de93e83e49",
142
- "name": "FTP Uiza edited",
143
- "description": "FTP of Uiza, use for transcode",
144
- "storageType": "ftp",
145
- "usageType": "input",
146
- "bucket": null,
147
- "prefix": null,
148
- "host": "ftp-exemple.uiza.io",
149
- "awsAccessKey": null,
150
- "awsSecretKey": null,
151
- "username": "uiza",
152
- "password": "=5;9x@LPsd+w7qW",
153
- "region": null,
154
- "port": 21,
155
- "createdAt": "2018-06-19T03:01:56.000Z",
156
- "updatedAt": "2018-06-19T03:01:56.000Z"
163
+ "data": {
164
+ "id": "f8819781-df28-410f-8cb1-ee3a29523840",
165
+ "name": "FTP Uiza edited",
166
+ "description": "example description",
167
+ "storageType": "s3",
168
+ "usageType": "input",
169
+ "bucket": nil,
170
+ "prefix": nil,
171
+ "host": "ftp-example.uiza.io",
172
+ "awsAccessKey": nil,
173
+ "awsSecretKey": nil,
174
+ "username": "example username",
175
+ "password": "example password",
176
+ "region": nil,
177
+ "port": 80,
178
+ "createdAt": "2019-03-13T11:21:26.000Z",
179
+ "updatedAt": nil
180
+ },
181
+ "version": 4,
182
+ "datetime": "2019-03-13T11:40:36.334Z",
183
+ "policy": "public",
184
+ "requestId": "da83e775-33a5-4ced-8074-144d1eeb5d9e",
185
+ "serviceName": "api-v4",
186
+ "message": "OK",
187
+ "code": 200,
188
+ "type": "SUCCESS"
157
189
  }
158
190
  ```
159
191
 
160
192
  ## Remove storage
161
193
  Remove storage that added to Uiza.
162
194
 
163
- See details [here](https://docs.uiza.io/#remove-storage).
195
+ See details [here](https://docs.uiza.io/v4/#delete-a-storage).
164
196
 
165
197
  ```ruby
166
198
  require "uiza"
167
199
 
168
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
200
+ Uiza.app_id = "your-app-id"
169
201
  Uiza.authorization = "your-authorization"
170
202
 
171
203
  begin
@@ -181,8 +213,33 @@ end
181
213
  ```
182
214
 
183
215
  Example Response
184
- ```ruby
216
+ ```json
185
217
  {
186
- "id": "cd003123-7ec9-4f3a-9d7c-f2de93e83e49"
218
+ "data": {
219
+ "id": "f8819781-df28-410f-8cb1-ee3a29523840",
220
+ "name": "FTP Uiza edited",
221
+ "description": "example description",
222
+ "storageType": "s3",
223
+ "usageType": "input",
224
+ "bucket": nil,
225
+ "prefix": nil,
226
+ "host": "ftp-example.uiza.io",
227
+ "awsAccessKey": nil,
228
+ "awsSecretKey": nil,
229
+ "username": "example username",
230
+ "password": "example password",
231
+ "region": nil,
232
+ "port": 80,
233
+ "createdAt": "2019-03-13T11:21:26.000Z",
234
+ "updatedAt": nil
235
+ },
236
+ "version": 4,
237
+ "datetime": "2019-03-13T11:42:38.205Z",
238
+ "policy": "public",
239
+ "requestId": "d864a038-401c-470e-87b0-c282122a4d64",
240
+ "serviceName": "api-v4",
241
+ "message": "OK",
242
+ "code": 200,
243
+ "type": "SUCCESS"
187
244
  }
188
245
  ```
@@ -3,68 +3,18 @@ You can manage user with APIs user. Uiza have 2 levels of user:
3
3
  Admin - This account will have the highest priority, can have permission to create & manage users.
4
4
  User - This account level is under Admin level. It only manages APIs that relates to this account.
5
5
 
6
- See details [here](https://docs.uiza.io/#user-management).
6
+ See details [here](https://docs.uiza.io/#user-management).
7
7
 
8
- ## Create an user
9
- Create an user account for workspace
10
-
11
- See details [here](https://docs.uiza.io/#create-an-user).
12
-
13
- ```ruby
14
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
15
- Uiza.authorization = "your-authorization"
16
-
17
- params = {
18
- status: 1,
19
- username: "user_test",
20
- email: "user_test@uiza.io",
21
- password: "FMpsr<4[dGPu?B#u",
22
- gender: 0,
23
- dob: "05/15/2018",
24
- avatar: "https://exemple.com/avatar.jpeg",
25
- fullname: "User Test",
26
- isAdmin: 0
27
- }
28
-
29
- begin
30
- user = Uiza::User.create params
31
- puts user.id
32
- puts user.username
33
- rescue Uiza::Error::UizaError => e
34
- puts "description_link: #{e.description_link}"
35
- puts "code: #{e.code}"
36
- puts "message: #{e.message}"
37
- rescue StandardError => e
38
- puts "message: #{e.message}"
39
- end
40
- ```
41
-
42
- Example Response
43
- ```ruby
44
- {
45
- "id": "37d6706e-be91-463e-b3b3-b69451dd4752",
46
- "isAdmin": 0,
47
- "username": "user_test",
48
- "email": "user_test@uiza.io",
49
- "avatar": "https://exemple.com/avatar.jpeg",
50
- "fullname": "User Test",
51
- "updatedAt": "2018-06-22T18:05:47.000Z",
52
- "createdAt": "2018-06-22T18:05:47.000Z"
53
- }
54
- ```
55
-
56
- ## Retrieve an user
8
+ ## Retrieve an user
57
9
  Retrieves the details of an existing user.
58
10
  You need only supply the unique userId that was returned upon user creation.
59
11
 
60
- See details [here](https://docs.uiza.io/#retrieve-an-user).
61
-
62
- ```ruby
12
+ See details [here](https://docs.uiza.io/#retrieve-an-user).
63
13
 
64
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
14
+ ```ruby
15
+ Uiza.app_id = "your-app-id"
65
16
  Uiza.authorization = "your-authorization"
66
-
67
- begin
17
+ begin
68
18
  user = Uiza::User.retrieve "your-user-id"
69
19
  puts user.id
70
20
  puts user.username
@@ -77,36 +27,48 @@ rescue StandardError => e
77
27
  end
78
28
  ```
79
29
 
80
- Example Response
81
- ```ruby
30
+ Example Response
31
+ ```json
82
32
  {
83
- "id": "37d6706e-be91-463e-b3b3-b69451dd4752",
84
- "isAdmin": 0,
85
- "username": "user_test",
86
- "email": "user_test@uiza.io",
87
- "avatar": "https://exemple.com/avatar.jpeg",
88
- "fullname": "User Test",
89
- "updatedAt": "2018-06-22T18:05:47.000Z",
90
- "createdAt": "2018-06-22T18:05:47.000Z"
33
+ "data": {
34
+ "id": "fc1e299b-be9f-40d7-9413-1850e6feb1df",
35
+ "email": "vugakl12@gmail.com",
36
+ "dob": nil,
37
+ "name": nil,
38
+ "status": 1,
39
+ "avatar": nil,
40
+ "createdAt": "2019-03-13T11:39:18.000Z",
41
+ "updatedAt": "2019-03-13T11:39:18.000Z"
42
+ },
43
+ "version": 4,
44
+ "datetime": "2019-03-13T12:58:10.973Z",
45
+ "policy": "public",
46
+ "requestId": "da58224d-a431-4b3a-bac5-141ab03d0052",
47
+ "serviceName": "api-v4",
48
+ "message": "OK",
49
+ "code": 200,
50
+ "type": "SUCCESS"
91
51
  }
92
52
  ```
93
53
 
94
- ## List all users
54
+ ## List all users
95
55
  Returns a list of your user. The users are returned sorted by creation date, with the most recent user appearing first.
96
56
  If you use Admin token, you will get all the user.
97
57
  If you use User token, you can only get the information of that user
98
58
 
99
- See details [here](https://docs.uiza.io/#list-all-users).
59
+ See details [here](https://docs.uiza.io/#list-all-users).
100
60
 
101
- ```ruby
61
+ ```ruby
102
62
  require "uiza"
103
-
104
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
63
+ Uiza.app_id = "your-app-id"
105
64
  Uiza.authorization = "your-authorization"
106
-
107
- begin
108
- users = Uiza::User.list
109
- # or users = Uiza::User.list limit: 2, page: 2
65
+ params = {
66
+ limit: 2
67
+ }
68
+ begin
69
+ users = Uiza::User.list params
70
+ # params is optional
71
+ # or users = Uiza::User.list
110
72
  puts users.first.id
111
73
  puts users.first.username
112
74
  rescue Uiza::Error::UizaError => e
@@ -118,51 +80,57 @@ rescue StandardError => e
118
80
  end
119
81
  ```
120
82
 
121
- Example Response
122
- ```ruby
83
+ Example Response
84
+ ```json
123
85
  {
124
- "id": "1a95f752-19e0-4a2e-9951-6d1fc0adbeaf",
125
- "isAdmin": 0,
126
- "username": "user_test",
127
- "email": "user_test@uiza.io",
128
- "updatedAt": "2018-06-22T02:31:14.000Z",
129
- "createdAt": "2018-06-22T02:31:14.000Z"
130
- },
131
- {
132
- "id": "95c1229a-73e6-4ef7-98eb-e64a765c32d5",
133
- "isAdmin": 1,
134
- "username": "user_admin",
135
- "email": "user_admin@uiza.io",
136
- "updatedAt": "2018-06-22T00:00:00.000Z",
137
- "createdAt": "2018-06-22T02:32:29.000Z"
86
+ "data": [
87
+ {
88
+ "id": "fc1e299b-be9f-40d7-9413-1850e6feb1df",
89
+ "email": "vugakl12@gmail.com",
90
+ "dob": nil,
91
+ "name": nil,
92
+ "status": 1,
93
+ "avatar": nil,
94
+ "createdAt": "2019-03-13T11:39:18.000Z",
95
+ "updatedAt": "2019-03-13T11:39:18.000Z"
96
+ },
97
+ {
98
+ "id": "6a597947-83d0-4288-aa26-c32751e099f8",
99
+ "email": "vu.nguyen.thanh1993@gmail.com",
100
+ "dob": nil,
101
+ "name": nil,
102
+ "status": 1,
103
+ "avatar": nil,
104
+ "createdAt": "2019-03-13T11:17:48.000Z",
105
+ "updatedAt": "2019-03-13T11:17:48.000Z"
106
+ }
107
+ ],
108
+ "version": 4,
109
+ "datetime": "2019-03-13T13:01:03.750Z",
110
+ "policy": "public",
111
+ "requestId": "e9e625ea-2bcf-44d1-b43e-d52a083f5831",
112
+ "serviceName": "api-v4",
113
+ "message": "OK",
114
+ "code": 200,
115
+ "type": "SUCCESS"
138
116
  }
139
117
  ```
140
118
 
141
- ## Update an user
119
+ ## Update an user
142
120
  Updates the specified user by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
143
121
 
144
- See details [here](https://docs.uiza.io/#update-an-user).
122
+ See details [here](https://docs.uiza.io/#update-an-user).
145
123
 
146
- ```ruby
124
+ ```ruby
147
125
  require "uiza"
148
-
149
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
126
+ Uiza.app_id = "your-app-id"
150
127
  Uiza.authorization = "your-authorization"
151
-
152
- params = {
153
- id: "37d6706e-be91-463e-b3b3-b69451dd4752"
128
+ params = {
129
+ id: "your-user-id"
154
130
  status: 1,
155
- username: "user_test",
156
- email: "user_test@uiza.io",
157
- password: "FMpsr<4[dGPu?B#u",
158
- gender: 0,
159
- dob: "05/15/2018",
160
- avatar: "https://exemple.com/avatar.jpeg",
161
- fullname: "User Test",
162
- isAdmin: 0
131
+ name: "user_test"
163
132
  }
164
-
165
- begin
133
+ begin
166
134
  user = Uiza::User.update params
167
135
  puts user.id
168
136
  puts user.username
@@ -175,98 +143,40 @@ rescue StandardError => e
175
143
  end
176
144
  ```
177
145
 
178
- Example Response
179
- ```ruby
146
+ Example Response
147
+ ```json
180
148
  {
181
- "id": "37d6706e-be91-463e-b3b3-b69451dd4752",
182
- "isAdmin": 0,
183
- "username": "user_test",
184
- "email": "user_test@uiza.io",
185
- "avatar": "https://exemple.com/avatar.jpeg",
186
- "fullname": "User Test",
187
- "updatedAt": "2018-06-22T18:05:47.000Z",
188
- "createdAt": "2018-06-22T18:05:47.000Z"
149
+ "data": {
150
+ "id": "fc1e299b-be9f-40d7-9413-1850e6feb1df",
151
+ "email": "vugakl12@gmail.com",
152
+ "dob": nil,
153
+ "name": "user_test",
154
+ "status": 1,
155
+ "avatar": nil,
156
+ "createdAt": "2019-03-13T11:39:18.000Z",
157
+ "updatedAt": "2019-03-13T13:06:27.000Z"
158
+ },
159
+ "version": 4,
160
+ "datetime": "2019-03-13T13:06:27.620Z",
161
+ "policy": "public",
162
+ "requestId": "8b0bbbd5-8699-4a69-a314-674ec9f23602",
163
+ "serviceName": "api-v4",
164
+ "message": "OK",
165
+ "code": 200,
166
+ "type": "SUCCESS"
189
167
  }
190
168
  ```
191
169
 
192
- ## Delete an user
193
- Permanently deletes an user. It cannot be undone. Also immediately cancels all token & information of this user.
194
-
195
- See details [here](https://docs.uiza.io/#delete-an-user).
196
-
197
- ```ruby
198
- require "uiza"
199
-
200
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
201
- Uiza.authorization = "your-authorization"
202
-
203
- begin
204
- user = Uiza::User.delete "your-user-id"
205
- puts user.id
206
- rescue Uiza::Error::UizaError => e
207
- puts "description_link: #{e.description_link}"
208
- puts "code: #{e.code}"
209
- puts "message: #{e.message}"
210
- rescue StandardError => e
211
- puts "message: #{e.message}"
212
- end
213
- ```
214
-
215
- Example Response
216
- ```
217
- {
218
- "id": "2c98b4d5-7d7f-4a0f-9258-5689f90fd28c"
219
- }
220
- ```
221
-
222
- ## Update password
223
- Update password allows Admin or User update their current password.
224
-
225
- See details [here](https://docs.uiza.io/#update-password).
226
-
227
- ```ruby
228
- require "uiza"
229
-
230
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
231
- Uiza.authorization = "your-authorization"
232
-
233
- params = {
234
- id: "your-user-id",
235
- oldPassword: "FMpsr<4[dGPu?B#u",
236
- newPassword: "S57Eb{:aMZhW=)G$"
237
- }
238
-
239
- begin
240
- response = Uiza::User.change_password params
241
- puts response.result
242
- rescue Uiza::Error::UizaError => e
243
- puts "description_link: #{e.description_link}"
244
- puts "code: #{e.code}"
245
- puts "message: #{e.message}"
246
- rescue StandardError => e
247
- puts "message: #{e.message}"
248
- end
249
- ```
250
-
251
- Example Response
252
- ```ruby
253
- {
254
- "result": "ok"
255
- }
256
- ```
257
-
258
- ## Log Out
170
+ ## Log Out
259
171
  This API use to log out an user. After logged out, token will be removed.
260
172
 
261
- See details [here](https://docs.uiza.io/#log-out).
173
+ See details [here](https://docs.uiza.io/#log-out).
262
174
 
263
- ```ruby
175
+ ```ruby
264
176
  require "uiza"
265
-
266
- Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
177
+ Uiza.app_id = "your-app-id"
267
178
  Uiza.authorization = "your-authorization"
268
-
269
- begin
179
+ begin
270
180
  response = Uiza::User.logout
271
181
  puts response.message
272
182
  rescue Uiza::Error::UizaError => e
@@ -278,9 +188,19 @@ rescue StandardError => e
278
188
  end
279
189
  ```
280
190
 
281
- Example Response
191
+ Example Response
282
192
  ```ruby
283
193
  {
284
- "message": "Logout success"
194
+ "data": {
195
+ "message": "success"
196
+ },
197
+ "message": "Logout success",
198
+ "version": 4,
199
+ "datetime": "2019-03-13T13:09:56.471Z",
200
+ "policy": "public",
201
+ "requestId": "b3609e7f-a02d-49cb-a6c0-dde57e49cca5",
202
+ "serviceName": "api-v4",
203
+ "code": 200,
204
+ "type": "SUCCESS"
285
205
  }
286
206
  ```