uiza_minh_phong 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +535 -0
- data/.rubocop_disable.yml +78 -0
- data/.rubocop_enable.yml +786 -0
- data/CHANGELOG.md +50 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTORS.txt +3 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +73 -0
- data/History.txt +1 -0
- data/LICENSE.txt +21 -0
- data/PULL_REQUEST_TEMPLATE.md +44 -0
- data/README.md +248 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/ANALYTIC.md +143 -0
- data/doc/CALLBACK.md +161 -0
- data/doc/CATEGORY.md +312 -0
- data/doc/EMBED_METADATA.md +4 -0
- data/doc/ENTITY.md +470 -0
- data/doc/ERRORS_CODE.md +60 -0
- data/doc/LIVE_STREAMING.md +452 -0
- data/doc/STORAGE.md +188 -0
- data/doc/USER.md +286 -0
- data/lib/uiza.rb +39 -0
- data/lib/uiza/analytic.rb +42 -0
- data/lib/uiza/api_operation/add.rb +16 -0
- data/lib/uiza/api_operation/create.rb +16 -0
- data/lib/uiza/api_operation/delete.rb +15 -0
- data/lib/uiza/api_operation/list.rb +14 -0
- data/lib/uiza/api_operation/remove.rb +15 -0
- data/lib/uiza/api_operation/retrieve.rb +15 -0
- data/lib/uiza/api_operation/update.rb +16 -0
- data/lib/uiza/callback.rb +16 -0
- data/lib/uiza/category.rb +42 -0
- data/lib/uiza/entity.rb +68 -0
- data/lib/uiza/error/bad_request_error.rb +8 -0
- data/lib/uiza/error/client_error.rb +8 -0
- data/lib/uiza/error/internal_server_error.rb +8 -0
- data/lib/uiza/error/not_found_error.rb +8 -0
- data/lib/uiza/error/server_error.rb +8 -0
- data/lib/uiza/error/service_unavailable_error.rb +8 -0
- data/lib/uiza/error/uiza_error.rb +18 -0
- data/lib/uiza/error/unauthorized_error.rb +8 -0
- data/lib/uiza/error/unprocessable_error.rb +8 -0
- data/lib/uiza/live.rb +86 -0
- data/lib/uiza/storage.rb +17 -0
- data/lib/uiza/uiza_client.rb +86 -0
- data/lib/uiza/uiza_open_struct.rb +18 -0
- data/lib/uiza/user.rb +41 -0
- data/lib/uiza/version.rb +3 -0
- data/uiza.gemspec +36 -0
- metadata +141 -0
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "uiza"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/doc/ANALYTIC.md
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
## Analytic
|
2
|
+
Monitor the four key dimensions of video QoS: playback failures, startup time, rebuffering, and video quality.
|
3
|
+
These 15 metrics help you track playback performance, so your team can know exactly what’s going on.
|
4
|
+
|
5
|
+
See details [here](https://docs.uiza.io/#analytic).
|
6
|
+
|
7
|
+
## Total Line
|
8
|
+
Get data grouped by hour (data refresh every 5 minutes). Track video playback on any metric performance, so you can know exactly what’s happening on every user’s device and debug more effectively.
|
9
|
+
|
10
|
+
See details [here](https://docs.uiza.io/#total-line).
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require "uiza"
|
14
|
+
|
15
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
16
|
+
Uiza.authorization = "your-authorization"
|
17
|
+
|
18
|
+
params = {
|
19
|
+
start_date: "YYYY-MM-DD hh:mm",
|
20
|
+
end_date: "YYYY-MM-DD hh:mm",
|
21
|
+
metric: "rebuffer_count"
|
22
|
+
}
|
23
|
+
|
24
|
+
begin
|
25
|
+
response = Uiza::Analytic.get_total_line params
|
26
|
+
puts response.first.rebuffer_count
|
27
|
+
rescue Uiza::Error::UizaError => e
|
28
|
+
puts "description_link: #{e.description_link}"
|
29
|
+
puts "code: #{e.code}"
|
30
|
+
puts "message: #{e.message}"
|
31
|
+
rescue StandardError => e
|
32
|
+
puts "message: #{e.message}"
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
Example Response
|
37
|
+
```ruby
|
38
|
+
[
|
39
|
+
{
|
40
|
+
"date_time": 1542978000000,
|
41
|
+
"rebuffer_count": 1.6666666666666667
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"date_time": 1543215600000,
|
45
|
+
"rebuffer_count": 5
|
46
|
+
}
|
47
|
+
]
|
48
|
+
```
|
49
|
+
|
50
|
+
## Type
|
51
|
+
Get data base on 4 type of filter: country, device, title, player
|
52
|
+
|
53
|
+
See details [here](https://docs.uiza.io/#type).
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
require "uiza"
|
57
|
+
|
58
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
59
|
+
Uiza.authorization = "your-authorization"
|
60
|
+
|
61
|
+
params = {
|
62
|
+
start_date: "YYYY-MM-DD hh:mm",
|
63
|
+
end_date: "YYYY-MM-DD hh:mm",
|
64
|
+
type_filter: "country"
|
65
|
+
}
|
66
|
+
|
67
|
+
begin
|
68
|
+
response = Uiza::Analytic.get_type params
|
69
|
+
puts response.first.name
|
70
|
+
puts response.first.total_view
|
71
|
+
puts response.first.percentage_of_view
|
72
|
+
rescue Uiza::Error::UizaError => e
|
73
|
+
puts "description_link: #{e.description_link}"
|
74
|
+
puts "code: #{e.code}"
|
75
|
+
puts "message: #{e.message}"
|
76
|
+
rescue StandardError => e
|
77
|
+
puts "message: #{e.message}"
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
Example Response
|
82
|
+
```ruby
|
83
|
+
[
|
84
|
+
{
|
85
|
+
"name": "Vietnam",
|
86
|
+
"total_view": 15,
|
87
|
+
"percentage_of_view": 0.625
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"name": "Other",
|
91
|
+
"total_view": 9,
|
92
|
+
"percentage_of_view": 0.375
|
93
|
+
}
|
94
|
+
]
|
95
|
+
```
|
96
|
+
|
97
|
+
## Line
|
98
|
+
Get data grouped by hour. Get total view in time range. This help you to draw a line chart to visualize data
|
99
|
+
|
100
|
+
See details [here](https://docs.uiza.io/#line).
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
require "uiza"
|
104
|
+
|
105
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
106
|
+
Uiza.authorization = "your-authorization"
|
107
|
+
|
108
|
+
params = {
|
109
|
+
start_date: "YYYY-MM-DD hh:mm",
|
110
|
+
end_date: "YYYY-MM-DD hh:mm",
|
111
|
+
type: "your-metric-type"
|
112
|
+
}
|
113
|
+
|
114
|
+
begin
|
115
|
+
response = Uiza::Analytic.get_line params
|
116
|
+
puts response.first.day_time
|
117
|
+
puts response.first.value
|
118
|
+
rescue Uiza::Error::UizaError => e
|
119
|
+
puts "description_link: #{e.description_link}"
|
120
|
+
puts "code: #{e.code}"
|
121
|
+
puts "message: #{e.message}"
|
122
|
+
rescue StandardError => e
|
123
|
+
puts "message: #{e.message}"
|
124
|
+
end
|
125
|
+
```
|
126
|
+
|
127
|
+
Example Response
|
128
|
+
```ruby
|
129
|
+
[
|
130
|
+
{
|
131
|
+
"day_time": 1541548800000,
|
132
|
+
"value": 4
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"day_time": 1541635200000,
|
136
|
+
"value": 5
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"day_time": 1541721600000,
|
140
|
+
"value": 5
|
141
|
+
}
|
142
|
+
]
|
143
|
+
```
|
data/doc/CALLBACK.md
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
## Callback
|
2
|
+
Callback used to retrieve an information for Uiza to your server, so you can have a trigger notice about an entity is upload completed and .
|
3
|
+
|
4
|
+
See details [here](https://docs.uiza.io/#callback).
|
5
|
+
|
6
|
+
## Create a callback
|
7
|
+
This API will allow you setup a callback to your server when an entity is completed for upload or public
|
8
|
+
|
9
|
+
See details [here](https://docs.uiza.io/#create-a-callback).
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require "uiza"
|
13
|
+
|
14
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
15
|
+
Uiza.authorization = "your-authorization"
|
16
|
+
|
17
|
+
params = {
|
18
|
+
url: "https://callback-url.uiza.co",
|
19
|
+
method: "POST"
|
20
|
+
}
|
21
|
+
|
22
|
+
begin
|
23
|
+
callback = Uiza::Callback.create params
|
24
|
+
puts callback.id
|
25
|
+
puts callback.url
|
26
|
+
rescue Uiza::Error::UizaError => e
|
27
|
+
puts "description_link: #{e.description_link}"
|
28
|
+
puts "code: #{e.code}"
|
29
|
+
puts "message: #{e.message}"
|
30
|
+
rescue StandardError => e
|
31
|
+
puts "message: #{e.message}"
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
Example Response
|
36
|
+
```ruby
|
37
|
+
{
|
38
|
+
"id": "0a6bf245-1cce-494f-a193-b5a44aa05558",
|
39
|
+
"url": "https://callback-url.uiza.co",
|
40
|
+
"headersData": null,
|
41
|
+
"jsonData": null,
|
42
|
+
"method": "POST",
|
43
|
+
"status": 1,
|
44
|
+
"createdAt": "2018-06-23T01:27:08.000Z",
|
45
|
+
"updatedAt": "2018-06-23T01:27:08.000Z"
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
## Retrieve a callback
|
50
|
+
Retrieves the details of an existing callback.
|
51
|
+
|
52
|
+
See details [here](https://docs.uiza.io/#retrieve-a-callback).
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
require "uiza"
|
56
|
+
|
57
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
58
|
+
Uiza.authorization = "your-authorization"
|
59
|
+
|
60
|
+
begin
|
61
|
+
callback = Uiza::Callback.retrieve "your-callback-id"
|
62
|
+
puts callback.id
|
63
|
+
puts callback.url
|
64
|
+
rescue Uiza::Error::UizaError => e
|
65
|
+
puts "description_link: #{e.description_link}"
|
66
|
+
puts "code: #{e.code}"
|
67
|
+
puts "message: #{e.message}"
|
68
|
+
rescue StandardError => e
|
69
|
+
puts "message: #{e.message}"
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
Example Response
|
74
|
+
```ruby
|
75
|
+
{
|
76
|
+
"id": "0a6bf245-1cce-494f-a193-b5a44aa05558",
|
77
|
+
"url": "https://callback-url.uiza.co",
|
78
|
+
"headersData": null,
|
79
|
+
"jsonData": {
|
80
|
+
"text": "example callback"
|
81
|
+
},
|
82
|
+
"method": "POST",
|
83
|
+
"status": 1,
|
84
|
+
"createdAt": "2018-06-23T01:27:08.000Z",
|
85
|
+
"updatedAt": "2018-06-23T01:27:08.000Z"
|
86
|
+
}
|
87
|
+
```
|
88
|
+
|
89
|
+
## Update a callback
|
90
|
+
This API will allow you setup a callback to your server when an entity is completed for upload or public
|
91
|
+
|
92
|
+
See details [here](https://docs.uiza.io/#update-a-callback).
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
require "uiza"
|
96
|
+
|
97
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
98
|
+
Uiza.authorization = "your-authorization"
|
99
|
+
|
100
|
+
params = {
|
101
|
+
id: "your-callback-id",
|
102
|
+
url: "https://callback-url.uiza.co",
|
103
|
+
method: "GET"
|
104
|
+
}
|
105
|
+
|
106
|
+
begin
|
107
|
+
callback = Uiza::Callback.update params
|
108
|
+
puts callback.id
|
109
|
+
puts callback.url
|
110
|
+
rescue Uiza::Error::UizaError => e
|
111
|
+
puts "description_link: #{e.description_link}"
|
112
|
+
puts "code: #{e.code}"
|
113
|
+
puts "message: #{e.message}"
|
114
|
+
rescue StandardError => e
|
115
|
+
puts "message: #{e.message}"
|
116
|
+
end
|
117
|
+
```
|
118
|
+
|
119
|
+
Example Response
|
120
|
+
```ruby
|
121
|
+
{
|
122
|
+
"id": "your-callback-id",
|
123
|
+
"url": "https://callback-url.uiza.co",
|
124
|
+
"headersData": null,
|
125
|
+
"jsonData": null,
|
126
|
+
"method": "GET",
|
127
|
+
"status": 1,
|
128
|
+
"createdAt": "2018-06-23T01:27:08.000Z",
|
129
|
+
"updatedAt": "2018-06-23T01:27:08.000Z"
|
130
|
+
}
|
131
|
+
```
|
132
|
+
|
133
|
+
## Delete a callback
|
134
|
+
Delete an existing callback.
|
135
|
+
|
136
|
+
See details [here](https://docs.uiza.io/#delete-a-callback).
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
require "uiza"
|
140
|
+
|
141
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
142
|
+
Uiza.authorization = "your-authorization"
|
143
|
+
|
144
|
+
begin
|
145
|
+
callback = Uiza::Callback.delete "your-callback-id"
|
146
|
+
puts callback.id
|
147
|
+
rescue Uiza::Error::UizaError => e
|
148
|
+
puts "description_link: #{e.description_link}"
|
149
|
+
puts "code: #{e.code}"
|
150
|
+
puts "message: #{e.message}"
|
151
|
+
rescue StandardError => e
|
152
|
+
puts "message: #{e.message}"
|
153
|
+
end
|
154
|
+
```
|
155
|
+
|
156
|
+
Example Response
|
157
|
+
```ruby
|
158
|
+
{
|
159
|
+
"id": "your-callback-id"
|
160
|
+
}
|
161
|
+
```
|
data/doc/CATEGORY.md
ADDED
@@ -0,0 +1,312 @@
|
|
1
|
+
## Category
|
2
|
+
Category has been splits into 3 types: folder, playlist and tag.
|
3
|
+
These will make the management of entity more easier.
|
4
|
+
|
5
|
+
See details [here](https://docs.uiza.io/#category).
|
6
|
+
|
7
|
+
## Create category
|
8
|
+
Create category for entity for easier management.
|
9
|
+
Category use to group all the same entities into a group (like `Folder`/`playlist` or `tag`).
|
10
|
+
|
11
|
+
See details [here](https://docs.uiza.io/#create-category).
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require "uiza"
|
15
|
+
|
16
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
17
|
+
Uiza.authorization = "your-authorization"
|
18
|
+
|
19
|
+
params = {
|
20
|
+
name: "Folder sample",
|
21
|
+
type: "folder",
|
22
|
+
description: "Folder description"
|
23
|
+
}
|
24
|
+
|
25
|
+
begin
|
26
|
+
category = Uiza::Category.create params
|
27
|
+
puts category.id
|
28
|
+
puts category.name
|
29
|
+
rescue Uiza::Error::UizaError => e
|
30
|
+
puts "description_link: #{e.description_link}"
|
31
|
+
puts "code: #{e.code}"
|
32
|
+
puts "message: #{e.message}"
|
33
|
+
rescue StandardError => e
|
34
|
+
puts "message: #{e.message}"
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
Example Response
|
39
|
+
```ruby
|
40
|
+
{
|
41
|
+
"id": "f932aa79-852a-41f7-9adc-19935034f944",
|
42
|
+
"name": "Playlist sample",
|
43
|
+
"description": "Playlist description",
|
44
|
+
"slug": "playlist-sample",
|
45
|
+
"type": "playlist",
|
46
|
+
"orderNumber": 3,
|
47
|
+
"icon": "https:///example.com/image002.png",
|
48
|
+
"status": 1,
|
49
|
+
"createdAt": "2018-06-18T04:29:05.000Z",
|
50
|
+
"updatedAt": "2018-06-18T04:29:05.000Z"
|
51
|
+
}
|
52
|
+
```
|
53
|
+
|
54
|
+
## Retrieve category
|
55
|
+
Get detail of category.
|
56
|
+
|
57
|
+
See details [here](https://docs.uiza.io/?shell#retrieve-category).
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
require "uiza"
|
61
|
+
|
62
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
63
|
+
Uiza.authorization = "your-authorization"
|
64
|
+
|
65
|
+
begin
|
66
|
+
category = Uiza::Category.retrieve "your-category-id"
|
67
|
+
puts category.id
|
68
|
+
puts category.name
|
69
|
+
rescue Uiza::Error::UizaError => e
|
70
|
+
puts "description_link: #{e.description_link}"
|
71
|
+
puts "code: #{e.code}"
|
72
|
+
puts "message: #{e.message}"
|
73
|
+
rescue StandardError => e
|
74
|
+
puts "message: #{e.message}"
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
Example Response
|
79
|
+
```ruby
|
80
|
+
{
|
81
|
+
"id": "f932aa79-852a-41f7-9adc-19935034f944",
|
82
|
+
"name": "Playlist sample",
|
83
|
+
"description": "Playlist description",
|
84
|
+
"slug": "playlist-sample",
|
85
|
+
"type": "playlist",
|
86
|
+
"orderNumber": 3,
|
87
|
+
"icon": "https:///example.com/image002.png",
|
88
|
+
"status": 1,
|
89
|
+
"createdAt": "2018-06-18T04:29:05.000Z",
|
90
|
+
"updatedAt": "2018-06-18T04:29:05.000Z"
|
91
|
+
}
|
92
|
+
```
|
93
|
+
|
94
|
+
## Retrieve category list
|
95
|
+
Get all category.
|
96
|
+
|
97
|
+
See details [here](https://docs.uiza.io/#retrieve-category-list).
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
require "uiza"
|
101
|
+
|
102
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
103
|
+
Uiza.authorization = "your-authorization"
|
104
|
+
|
105
|
+
begin
|
106
|
+
categories = Uiza::Category.list
|
107
|
+
puts categories.first.id
|
108
|
+
puts categories.first.name
|
109
|
+
rescue Uiza::Error::UizaError => e
|
110
|
+
puts "description_link: #{e.description_link}"
|
111
|
+
puts "code: #{e.code}"
|
112
|
+
puts "message: #{e.message}"
|
113
|
+
rescue StandardError => e
|
114
|
+
puts "message: #{e.message}"
|
115
|
+
end
|
116
|
+
```
|
117
|
+
|
118
|
+
Example Response
|
119
|
+
```ruby
|
120
|
+
[
|
121
|
+
{
|
122
|
+
"id": "f932aa79-852a-41f7-9adc-19935034f944",
|
123
|
+
"name": "Playlist sample",
|
124
|
+
"description": "Playlist desciption",
|
125
|
+
"slug": "playlist-sample",
|
126
|
+
"type": "playlist",
|
127
|
+
"orderNumber": 3,
|
128
|
+
"icon": "/example.com/image002.png",
|
129
|
+
"status": 1,
|
130
|
+
"createdAt": "2018-06-18T04:29:05.000Z",
|
131
|
+
"updatedAt": "2018-06-18T04:29:05.000Z"
|
132
|
+
},
|
133
|
+
{
|
134
|
+
"id": "ab54db88-0c8c-4928-b1be-1e7120ad2c39",
|
135
|
+
"name": "Folder sample",
|
136
|
+
"description": "Folder's description",
|
137
|
+
"slug": "folder-sample",
|
138
|
+
"type": "folder",
|
139
|
+
"orderNumber": 1,
|
140
|
+
"icon": "/example.com/icon.png",
|
141
|
+
"status": 1,
|
142
|
+
"createdAt": "2018-06-18T03:17:07.000Z",
|
143
|
+
"updatedAt": "2018-06-18T03:17:07.000Z"
|
144
|
+
}
|
145
|
+
]
|
146
|
+
```
|
147
|
+
|
148
|
+
## Update category
|
149
|
+
Update information of category.
|
150
|
+
|
151
|
+
See details [here](https://docs.uiza.io/#update-category).
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
require "uiza"
|
155
|
+
|
156
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
157
|
+
Uiza.authorization = "your-authorization"
|
158
|
+
|
159
|
+
params = {
|
160
|
+
id: "your-category-id",
|
161
|
+
name: "Folder edited",
|
162
|
+
type: "folder"
|
163
|
+
}
|
164
|
+
|
165
|
+
begin
|
166
|
+
category = Uiza::Category.update params
|
167
|
+
puts category.id
|
168
|
+
puts category.name
|
169
|
+
rescue Uiza::Error::UizaError => e
|
170
|
+
puts "description_link: #{e.description_link}"
|
171
|
+
puts "code: #{e.code}"
|
172
|
+
puts "message: #{e.message}"
|
173
|
+
rescue StandardError => e
|
174
|
+
puts "message: #{e.message}"
|
175
|
+
end
|
176
|
+
```
|
177
|
+
|
178
|
+
Example Response
|
179
|
+
```ruby
|
180
|
+
{
|
181
|
+
"id": "f932aa79-852a-41f7-9adc-19935034f944",
|
182
|
+
"name": "Folder edited",
|
183
|
+
"description": "Playlist description",
|
184
|
+
"slug": "playlist-sample",
|
185
|
+
"type": "folder",
|
186
|
+
"orderNumber": 3,
|
187
|
+
"icon": "https:///example.com/image002.png",
|
188
|
+
"status": 1,
|
189
|
+
"createdAt": "2018-06-18T04:29:05.000Z",
|
190
|
+
"updatedAt": "2018-06-18T04:29:05.000Z"
|
191
|
+
}
|
192
|
+
```
|
193
|
+
|
194
|
+
## Delete category
|
195
|
+
Delete category.
|
196
|
+
|
197
|
+
See details [here](https://docs.uiza.io/#delete-category).
|
198
|
+
|
199
|
+
```ruby
|
200
|
+
require "uiza"
|
201
|
+
|
202
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
203
|
+
Uiza.authorization = "your-authorization"
|
204
|
+
|
205
|
+
begin
|
206
|
+
category = Uiza::Category.delete "your-category-id"
|
207
|
+
puts category.id
|
208
|
+
rescue Uiza::Error::UizaError => e
|
209
|
+
puts "description_link: #{e.description_link}"
|
210
|
+
puts "code: #{e.code}"
|
211
|
+
puts "message: #{e.message}"
|
212
|
+
rescue StandardError => e
|
213
|
+
puts "message: #{e.message}"
|
214
|
+
end
|
215
|
+
```
|
216
|
+
|
217
|
+
Example Response
|
218
|
+
```ruby
|
219
|
+
{
|
220
|
+
"id": "f932aa79-852a-41f7-9adc-19935034f944"
|
221
|
+
}
|
222
|
+
```
|
223
|
+
|
224
|
+
## Create category relation
|
225
|
+
Add relation for entity and category.
|
226
|
+
|
227
|
+
See details [here](https://docs.uiza.io/#create-category-relation).
|
228
|
+
|
229
|
+
```ruby
|
230
|
+
require "uiza"
|
231
|
+
|
232
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
233
|
+
Uiza.authorization = "your-authorization"
|
234
|
+
|
235
|
+
params = {
|
236
|
+
entityId: "your-entity-id",
|
237
|
+
metadataIds: ["your-category-id-1", "your-category-id-2"]
|
238
|
+
}
|
239
|
+
|
240
|
+
begin
|
241
|
+
relations = Uiza::Category.create_relation params
|
242
|
+
puts relations.first.id
|
243
|
+
puts relations.first.entityId
|
244
|
+
rescue Uiza::Error::UizaError => e
|
245
|
+
puts "description_link: #{e.description_link}"
|
246
|
+
puts "code: #{e.code}"
|
247
|
+
puts "message: #{e.message}"
|
248
|
+
rescue StandardError => e
|
249
|
+
puts "message: #{e.message}"
|
250
|
+
end
|
251
|
+
```
|
252
|
+
|
253
|
+
Example Response
|
254
|
+
```ruby
|
255
|
+
[
|
256
|
+
{
|
257
|
+
"id": "5620ed3c-b725-4a9a-8ec1-ecc9df3e5aa6",
|
258
|
+
"entityId": "16ab25d3-fd0f-4568-8aa0-0339bbfd674f",
|
259
|
+
"metadataId": "095778fa-7e42-45cc-8a0e-6118e540b61d"
|
260
|
+
},
|
261
|
+
{
|
262
|
+
"id": "47209e60-a99f-4c96-99fb-be4f858481b4",
|
263
|
+
"entityId": "16ab25d3-fd0f-4568-8aa0-0339bbfd674f",
|
264
|
+
"metadataId": "e00586b9-032a-46a3-af71-d275f01b03cf"
|
265
|
+
}
|
266
|
+
]
|
267
|
+
```
|
268
|
+
|
269
|
+
## Delete category relation
|
270
|
+
Delete relation for entity and category.
|
271
|
+
|
272
|
+
See details [here](https://docs.uiza.io/#delete-category-relation).
|
273
|
+
|
274
|
+
```ruby
|
275
|
+
require "uiza"
|
276
|
+
|
277
|
+
Uiza.workspace_api_domain = "your-workspace-api-domain.uiza.co"
|
278
|
+
Uiza.authorization = "your-authorization"
|
279
|
+
|
280
|
+
params = {
|
281
|
+
entityId: "your-entity-id",
|
282
|
+
metadataIds: ["your-category-id-1", "your-category-id-2"]
|
283
|
+
}
|
284
|
+
|
285
|
+
begin
|
286
|
+
relations = Uiza::Category.delete_relation params
|
287
|
+
puts relations.first.id
|
288
|
+
puts relations.first.entityId
|
289
|
+
rescue Uiza::Error::UizaError => e
|
290
|
+
puts "description_link: #{e.description_link}"
|
291
|
+
puts "code: #{e.code}"
|
292
|
+
puts "message: #{e.message}"
|
293
|
+
rescue StandardError => e
|
294
|
+
puts "message: #{e.message}"
|
295
|
+
end
|
296
|
+
```
|
297
|
+
|
298
|
+
Example Response
|
299
|
+
```ruby
|
300
|
+
[
|
301
|
+
{
|
302
|
+
"id": "5620ed3c-b725-4a9a-8ec1-ecc9df3e5aa6",
|
303
|
+
"entityId": "16ab25d3-fd0f-4568-8aa0-0339bbfd674f",
|
304
|
+
"metadataId": "095778fa-7e42-45cc-8a0e-6118e540b61d"
|
305
|
+
},
|
306
|
+
{
|
307
|
+
"id": "47209e60-a99f-4c96-99fb-be4f858481b4",
|
308
|
+
"entityId": "16ab25d3-fd0f-4568-8aa0-0339bbfd674f",
|
309
|
+
"metadataId": "e00586b9-032a-46a3-af71-d275f01b03cf"
|
310
|
+
}
|
311
|
+
]
|
312
|
+
```
|