k_sequencing 0.1.23 → 0.1.24

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8844c4dbddcc2f01026504bb564a2a7d5b5d5b7
4
- data.tar.gz: 342f4caadd802cc800612fc633be3a4f8085cad1
3
+ metadata.gz: 38a4a6e6b07c8700a78c5475ca785a5854aec409
4
+ data.tar.gz: 2d7b1cbbad039ec2771f9467040f504e26be02ed
5
5
  SHA512:
6
- metadata.gz: 93397e2351ecffc47cbeb60ea09d80c46f34d0401c34c3a992e27703cf7880a204593342c1718236cf6fe29bb5b64ac8d93407fe24594eff460bd7638fdaad42
7
- data.tar.gz: 99672fc17e7dc433335171a6dc0405a1173fc36ac399385e68123655c7e33f1c86e9a60c03eddd48e48eabcd56f978c0c50da04eae001b15d2514d3ded8cd257
6
+ metadata.gz: 6ef7c06f7f59f3488bd01c49fd4dab100c262fd5644e54d4b3aa0db9f94bf0920ae6ab2a8109b0cd77a86bcd9fa14553722856aa6f93b13038f8ed357fbcf68d
7
+ data.tar.gz: 58c41a4554893b88592200ec4bf804afe8f48bcf6dd622714b781bd9a6cebe0e115fd7a617c62c3b00cdb836b32983f5eb95d4c1e1f59bb845f4830fbf6a564c
data/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
  ## There are 5 avalable for API
5
- * Closed questions - Answer can be only approved, declined or ban(kenta).
6
- * Choices - This model use to ask question with multiple choice. Anwser can be one or multiple.
7
- * Photo tags - This model use to create a selection area to find where answer is, by drag the area on image from webpage.
8
- * Messages - This model allow moderator type the anwser on what they see.
9
- * Predictions - Use AI to prediction the result
5
+ * Closed questions(Standard Criteria (5 mins response time)) - Answer can be only approved, declined or ban(kenta).
6
+ * Choices(Yes or No Question from Image (30 mins response time)) - This model use to ask question with multiple choice. Anwser can be one or multiple.
7
+ * Photo tags(Tag an object in the image (60 mins response time)) - This model use to create a selection area to find where answer is, by drag the area on image from webpage.
8
+ * Messages(Message Question from Image (30 mins response time)) - This model allow moderator type the anwser on what they see.
9
+ * Predictions(Images (AI Beta / 95% accuracy)) - Use AI to prediction the result
10
10
 
11
11
  ##### Please see more usage [documentation](docs/documentation.md) for details on our guideline.
12
12
 
@@ -14,9 +14,9 @@
14
14
 
15
15
  ## Getting Started
16
16
 
17
- KSequencing 0.1.23 works with Rails 4.1 onwards. You can add it to your Gemfile with:
17
+ KSequencing 0.1.24 works with Rails 4.1 onwards. You can add it to your Gemfile with:
18
18
  ```ruby
19
- gem 'k_sequencing', '~> 0.1.23'
19
+ gem 'k_sequencing', '~> 0.1.24'
20
20
  ```
21
21
  Then run bundle install
22
22
 
@@ -35,81 +35,69 @@ There are 3 oparations of each model as the same name see example below
35
35
 
36
36
  #### Get image
37
37
  ```ruby
38
- KSequencing.[model].find_by()
38
+ KSequencing.client.find_image(id)
39
39
  ```
40
40
 
41
41
  | Field | Type | Required | Description |
42
42
  | ------------- |:-------------:| :----:| :-----|
43
- |token | string | Yes | Project token |
44
- | id | string | No | Image id|
45
- |custom_id | string | No | Client's image id |\
43
+ | token | string | Yes | Project token |
44
+ | id | string | Yes | Image id or Client's image id|
46
45
 
47
- Note: You must choose id or custom_id for search. Not both.
46
+ Note:
47
+ - You must choose id or custom_id for search. Not both.
48
+ - Image data dynamic by project token.
48
49
 
49
50
  ###### Sample request
50
51
 
51
52
  ```ruby
52
- KSequencing.[model].find_by({
53
- token: "[you_token]",
54
- id: "59311194e99991b2ca8979f1"
55
- })
53
+ KSequencing.client.find_image("5a40be59fb9d7f27354c5efa")
56
54
  ```
57
55
 
58
56
  or
59
57
 
60
58
  ```ruby
61
- KSequencing.[model].find_by({
62
- token: "[you_token]",
63
- custom_id: "59311194e99991b2ca8979f1"
64
- })
59
+ KSequencing.client.find_image("your custom id")
65
60
  ```
66
61
 
67
- ###### Sample results
62
+ or
63
+
64
+ ```ruby
65
+ KSequencing.client.find_image("5a40be59fb9d7f27354c5efa", { token: "[you_token]" })
66
+ ```
67
+
68
+ ###### Sample response
69
+ <KSequencing::Response @success=true, @status=200, @message="success" @meta={"code"=>200, "message"=>"success"}, @value={}, />
70
+
68
71
  ```json
69
72
  {
70
- "data": {
73
+ "value": {
71
74
  "image": {
72
- "id": "59311194e99991b2ca8979f1",
73
- "answer": null,
74
- "credit_charged": 0,
75
- "custom_id": null,
75
+ "id": "5a40be59fb9d7f27354c5efa",
76
+ "answer": "approved",
77
+ "credit_charged": 1,
78
+ "custom_id": "custom_id",
76
79
  "data": "image_url",
77
- "postback_url": "www.example.com",
78
- "processed_at": null,
79
- "project_id": 3,
80
- "status": "unprocess",
81
- "created_at": "2017-06-02T07:19:48.574Z"
80
+ "postback_url": "postback_url",
81
+ "processed_at": "2017-12-25T16:02:00.599+07:00",
82
+ "project_id": "project_id",
83
+ "status": "processed"
82
84
  }
83
85
  },
86
+ "success": true,
87
+ "status": 200,
88
+ "message": "success",
84
89
  "meta": {
85
90
  "code": 200,
86
91
  "message": "success"
87
92
  }
88
93
  }
89
94
  ```
90
- <Enter>
91
- #### Get image by id
92
- ```ruby
93
- KSequencing.client.find_image(id)
94
- ```
95
-
96
- | Field | Type | Required | Description |
97
- | ------------- |:-------------:| :----:| :-----|
98
- | token | string | Yes | Project token |
99
- | id | string | Yes | Image id or Client's image id|
100
-
101
- ###### Sample request
102
-
103
- ```ruby
104
- KSequencing.client.find_image("59311194e99991b2ca8979f1")
105
- KSequencing.client.find_image("your custom id")
106
- KSequencing.client.find_image("59311194e99991b2ca8979f1", { token: "[you_token]" })
107
- ```
108
95
  ---
109
- #### Create images
96
+ #### Create Image Standard Criteria (5 mins response time)
97
+ Closed questions - Answer can be only approved, declined or ban(kenta).
110
98
 
111
99
  ```ruby
112
- KSequencing.[model].create()
100
+ KSequencing.image_closed_question.create()
113
101
  ```
114
102
 
115
103
  | Field | Type | Required | Description |
@@ -121,42 +109,57 @@ KSequencing.[model].create()
121
109
  | custom_id | string | No |Custom's id|
122
110
 
123
111
  ###### Sample request
112
+ ```ruby
113
+ KSequencing.image_closed_question.create({ data: "image_url" })
114
+ ```
115
+
116
+ or
124
117
 
118
+ Override data [:token, :postback_url, :postback_method]
125
119
  ```ruby
126
- KSequencing.[model].create({
120
+ KSequencing.image_closed_question.create({
121
+ custom_id: "custom_id",
122
+ data: "image_url",
123
+ postback_method: "POST",
124
+ postback_url: "https://example.com/callbacks",
127
125
  token: "[you_token]"
128
- data: "image_url"
129
- ....
130
126
  })
131
127
  ```
132
128
 
133
- ###### Sample results
129
+ ###### Sample response
134
130
  ```json
135
131
  {
136
- "data": {
137
- "id": "58c8c3ef12c09f1c0fa78392",
138
- "answer": null,
132
+ "value": {
133
+ "id": "5a40c77ffb9d7f27354c60c2",
134
+ "answer": nil,
139
135
  "credit_charged": 0,
140
- "custom_id": null,
136
+ "custom_id": "custom_id",
141
137
  "data": "image_url",
142
- "postback_url": "www.example.com",
143
- "process": false,
144
- "processed_at": null,
145
- "project_id": null,
146
- "created_at": "2017-03-14T08:29:40.696Z"
138
+ "postback_url": "https://example.com/callbacks",
139
+ "processed_at": nil,
140
+ "project_id": "project_id",
141
+ "status": "unprocess"
147
142
  },
148
- "meta": {
149
- "code": 200,
150
- "message": "success"
143
+ "success": true,
144
+ "status": 200,
145
+ "message": "success",
146
+ "meta": {
147
+ "code": 200,
148
+ "message": "success"
151
149
  }
152
150
  }
153
151
  ```
154
- <Enter>
152
+
153
+ ###### Sample postback data
154
+ ```
155
+ POST "https://example.com/callbacks?answer=declined&custom_id=custom_id&image_id=5a40cfc2fb9d7f27354c62b5&task_id=5a40cfc2fb9d7f27354c62b5"
156
+ ```
157
+
155
158
  ---
156
159
 
157
160
  #### Get list of images
158
161
  ```ruby
159
- KSequencing.[model].all()
162
+ KSequencing.image_closed_question.all({ token: "[you_token]" })
160
163
  ```
161
164
 
162
165
  | Field | Type | Required | Description |
@@ -168,51 +171,70 @@ KSequencing.[model].all()
168
171
  Note: You must choose id or custom_id for search. Not both.
169
172
 
170
173
  ###### Sample request
174
+ ```ruby
175
+ KSequencing.image_closed_question.all
176
+ ```
177
+
178
+ or
171
179
 
172
180
  ```ruby
173
- KSequencing.[model].all({
181
+ KSequencing.image_closed_question.all({
182
+ page: 1,
183
+ per_page: 20,
174
184
  token: "[you_token]"
175
185
  })
176
186
  ```
177
187
 
178
-
179
188
  ###### Sample results
180
189
  ```json
181
190
  {
182
- "data": {
191
+ "value": {
183
192
  "images": [
184
193
  {
185
- "id": "5a0d5a0c0deb540ab9c56e4e",
186
- "allow_empty": false,
187
- "answer": [],
188
- "categories": ["face", "eye"],
189
- "credit_charged": 0,
190
- "custom_id": null,
194
+ "answer": "approved",
195
+ "credit_charged": 1,
196
+ "custom_id": "custom_id",
191
197
  "data": "image_url",
192
- "instruction": "face",
193
- "multiple": false,
194
- "postback_url": "www.example.com",
195
- "processed_at": null,
196
- "project_id": 94,
197
- "status": "unprocess"
198
- }
198
+ "id": "5a40c77ffb9d7f27354c60c2",
199
+ "postback_url": "https://example.com/callbacks",
200
+ "processed_at": "2017-12-25T16:40:19.699+07:00",
201
+ "project_id": "project_id",
202
+ "status": "processed"
203
+ },
204
+ {
205
+ "answer": "approved",
206
+ "credit_charged": 1,
207
+ "custom_id": "custom_id",
208
+ "data": "image_url",
209
+ "id": "5a40be59fb9d7f27354c5efa",
210
+ "postback_url": "https://example.com/callbacks",
211
+ "processed_at": "2017-12-25T16:02:00.599+07:00",
212
+ "project_id": "project_id",
213
+ "status": "processed"
214
+ },
215
+ ...
199
216
  ]
200
217
  },
218
+ "success": true,
219
+ "status": 200,
220
+ "message": "success",
221
+ "total": 3,
201
222
  "meta": {
202
223
  "code": 200,
203
- "message": "success",
204
224
  "current_page": 1,
225
+ "message": "success",
205
226
  "next_page": 2,
206
227
  "prev_page": -1,
207
- "total_pages": 13,
208
- "total_count": 13
228
+ "total_count": 3,
229
+ "total_pages": 2
209
230
  }
210
231
  }
211
232
  ```
212
- <Enter>
213
233
 
214
234
  However `token: "[you_token]"` you can config in configuration file is not necessary to send to method every time you request, if you have one project token we recommeded this approach
215
235
 
236
+ ##### Please see more usage [documentation](docs/documentation.md) for details on our guideline.
237
+
216
238
  ## License
217
239
 
218
240
  This project is licensed under datawowio
@@ -1,50 +1,65 @@
1
1
  ## Usage
2
2
  ### Operations about Images
3
- #### Image moderation can set 4 kinds of answer
4
- * [Closed questions](#closed-questions) - Answer can be only approved, declined or ban(kenta).
5
- * [Choices](#choices) - This model use to ask question with multiple choice. Anwser can be one or multiple.
6
- * [Photo tags](#photo-tags) - This model use to create a selection area to find where answer is by drag the area on image from web page.
7
- * [Messages](#messages) - This model allow moderator type the anwser on what they see.
8
- * [Prediction](#messages) - Use AI to prediction the result
3
+ #### Image moderation can set 5 kinds of answer
4
+ * [Closed questions](#closed-questions)(Standard Criteria (5 mins response time)) - Answer can be only approved, declined or ban(kenta).
5
+ * [Choices](#choices)(Yes or No Question from Image (30 mins response time)) - This model use to ask question with multiple choice. Anwser can be one or multiple.
6
+ * [Photo tags](#photo-tags)(Tag an object in the image (60 mins response time)) - This model use to create a selection area to find where answer is by drag the area on image from web page.
7
+ * [Messages](#messages)(Message Question from Image (30 mins response time)) - This model allow moderator type the anwser on what they see.
8
+ * [Prediction](#prediction)(Images (AI Beta / 95% accuracy)) - Use AI to prediction the result
9
9
  ---
10
10
  ### Closed questions
11
- Get image
11
+ [Standard Criteria (5 mins response time)]
12
+
13
+ #### Create Image Standard Criteria (5 mins response time)
14
+ Closed questions - Answer can be only approved, declined or ban(kenta).
15
+
12
16
  ```ruby
13
- KSequencing.image_closed_question.find_by()
17
+ KSequencing.image_closed_question.create()
14
18
  ```
15
19
 
16
20
  | Field | Type | Required | Description |
17
- | ------------- |:-------------:| :----:| :-----|
18
- | id | string | No | Image id|
19
- | custom_id | string | No | Client's image id |
21
+ | ------------- |:-------------:| :-----:| :-----|
22
+ | token | string | Yes | Project token |
23
+ | data | string | Yes |Data for moderate|
24
+ | postback_url | string | No | Image postback url|
25
+ | postback_method | string | No |Postback method|
26
+ | custom_id | string | No |Custom's id|
20
27
 
21
- Note: You must choose id or custom_id for search. Not both.
28
+ ###### Sample request
29
+ ```ruby
30
+ KSequencing.image_closed_question.create({ data: "image_url" })
31
+ ```
32
+
33
+ or
22
34
 
23
- --- Sample request
35
+ Override data [:token, :postback_url, :postback_method]
24
36
  ```ruby
25
- KSequencing.image_closed_question.find_by({
26
- token: "[you_token]",
27
- id: "59311194e99991b2ca8979f1"
37
+ KSequencing.image_closed_question.create({
38
+ custom_id: "custom_id",
39
+ data: "image_url",
40
+ postback_method: "POST",
41
+ postback_url: "https://example.com/callbacks",
42
+ token: "[you_token]"
28
43
  })
29
44
  ```
30
45
 
31
- Sample results
46
+ ###### Sample response
32
47
  ```json
33
48
  {
34
- "data": {
35
- "image": {
36
- "id": "59311194e99991b2ca8979f1",
37
- "answer": null,
38
- "credit_charged": 0,
39
- "custom_id": null,
40
- "data": "image_url",
41
- "postback_url": "www.example.com",
42
- "processed_at": null,
43
- "project_id": 3,
44
- "status": "unprocess",
45
- "created_at": "2017-06-02T07:19:48.574Z"
46
- }
49
+ "value": {
50
+ "id": "5a40c77ffb9d7f27354c60c2",
51
+ "answer": nil,
52
+ "credit_charged": 0,
53
+ "custom_id": "custom_id",
54
+ "data": "image_url",
55
+ "postback_url": "https://example.com/callbacks",
56
+ "processed_at": nil,
57
+ "project_id": "project_id",
58
+ "status": "unprocess"
47
59
  },
60
+ "success": true,
61
+ "status": 200,
62
+ "message": "success",
48
63
  "meta": {
49
64
  "code": 200,
50
65
  "message": "success"
@@ -52,40 +67,119 @@ Sample results
52
67
  }
53
68
  ```
54
69
 
55
- Create images
70
+ ###### Sample postback data
71
+ ```
72
+ POST "https://example.com/callbacks?answer=declined&custom_id=custom_id&image_id=5a40cfc2fb9d7f27354c62b5&task_id=5a40cfc2fb9d7f27354c62b5"
73
+ ```
74
+
75
+ ---
76
+ #### Get image
56
77
  ```ruby
57
- KSequencing.image_closed_questions.create()
78
+ KSequencing.client.find_image(id)
58
79
  ```
80
+
59
81
  | Field | Type | Required | Description |
60
- | ------------- |:-------------:| :-----:| :-----|
61
- | data | string | Yes |Data for moderate|
62
- | postback_url | string | No | Image postback url|
63
- | postback_method | string | No |Postback method|
64
- | custom_id | string | No |Custom's id|
82
+ | ------------- |:-------------:| :----:| :-----|
83
+ | token | string | Yes | Project token |
84
+ | id | string | Yes | Image id or Client's image id|
85
+
86
+ Note:
87
+ - You must choose id or custom_id for search. Not both.
88
+ - Image data dynamic by project token.
89
+
90
+ ###### Sample request
65
91
 
66
- Sample request
67
92
  ```ruby
68
- KSequencing.image_closed_questions.create({
69
- token: "[you_token]",
70
- data: "image_url"
71
- })
93
+ KSequencing.client.find_image("5a40be59fb9d7f27354c5efa")
72
94
  ```
73
95
 
74
- Sample results
96
+ or
97
+
98
+ ```ruby
99
+ KSequencing.client.find_image("your custom id")
100
+ ```
101
+
102
+ or
103
+
104
+ ```ruby
105
+ KSequencing.client.find_image("5a40be59fb9d7f27354c5efa", { token: "[you_token]" })
106
+ ```
107
+
108
+ ###### Sample response
109
+ <KSequencing::Response @success=true, @status=200, @message="success" @meta={"code"=>200, "message"=>"success"}, @value={}, />
110
+
111
+ - approved
75
112
  ```json
76
113
  {
77
- "data": {
78
- "id": "58c8c3ef12c09f1c0fa78392",
79
- "answer": null,
80
- "credit_charged": 0,
81
- "custom_id": null,
82
- "data": "image_url",
83
- "postback_url": "www.example.com",
84
- "process": false,
85
- "processed_at": null,
86
- "project_id": 1,
87
- "created_at": "2017-03-14T08:29:40.696Z"
114
+ "value": {
115
+ "image": {
116
+ "id": "5a40be59fb9d7f27354c5efa",
117
+ "answer": "approved",
118
+ "credit_charged": 1,
119
+ "custom_id": "custom_id",
120
+ "data": "image_url",
121
+ "postback_url": "postback_url",
122
+ "processed_at": "2017-12-25T16:02:00.599+07:00",
123
+ "project_id": "project_id",
124
+ "status": "processed"
125
+ }
126
+ },
127
+ "success": true,
128
+ "status": 200,
129
+ "message": "success",
130
+ "total": nil,
131
+ "meta": {
132
+ "code": 200,
133
+ "message": "success"
134
+ }
135
+ }
136
+ ```
137
+ - declined
138
+ ```json
139
+ {
140
+ "value": {
141
+ "image": {
142
+ "id": "5a40be59fb9d7f27354c5efa",
143
+ "answer": "declined",
144
+ "credit_charged": 1,
145
+ "custom_id": "custom_id",
146
+ "data": "image_url",
147
+ "postback_url": "postback_url",
148
+ "processed_at": "2017-12-25T16:02:00.599+07:00",
149
+ "project_id": "project_id",
150
+ "status": "processed"
151
+ }
152
+ },
153
+ "success": true,
154
+ "status": 200,
155
+ "message": "success",
156
+ "total": nil,
157
+ "meta": {
158
+ "code": 200,
159
+ "message": "success"
160
+ }
161
+ }
162
+ ```
163
+ - kenta
164
+ ```json
165
+ {
166
+ "value": {
167
+ "image": {
168
+ "id": "5a40be59fb9d7f27354c5efa",
169
+ "answer": "kenta",
170
+ "credit_charged": 1,
171
+ "custom_id": "custom_id",
172
+ "data": "image_url",
173
+ "postback_url": "postback_url",
174
+ "processed_at": "2017-12-25T16:02:00.599+07:00",
175
+ "project_id": "project_id",
176
+ "status": "processed"
177
+ }
88
178
  },
179
+ "success": true,
180
+ "status": 200,
181
+ "message": "success",
182
+ "total": nil,
89
183
  "meta": {
90
184
  "code": 200,
91
185
  "message": "success"
@@ -93,62 +187,87 @@ Sample results
93
187
  }
94
188
  ```
95
189
  ---
96
- #### Choices
97
- Get image
190
+
191
+ #### Get list of images
98
192
  ```ruby
99
- KSequencing.image_choice.find_by()
193
+ KSequencing.image_closed_question.all({ token: "[you_token]" })
100
194
  ```
101
195
 
102
196
  | Field | Type | Required | Description |
103
197
  | ------------- |:-------------:| :----:| :-----|
104
- | id | string | No | Image id|
105
- |custom_id | string | No | Client's image id |
198
+ |token | string | Yes | Project token |
199
+ | page | integer | No | Image id|
200
+ |per_page | integer | No | Client's image id |\
106
201
 
107
202
  Note: You must choose id or custom_id for search. Not both.
108
203
 
109
- Sample request
204
+ ###### Sample request
110
205
  ```ruby
111
- KSequencing.image_choice.find_by({
112
- token: "[you_token]",
113
- id: "59311194e99991b2ca8979f1"
206
+ KSequencing.image_closed_question.all
207
+ ```
208
+
209
+ or
210
+
211
+ ```ruby
212
+ KSequencing.image_closed_question.all({
213
+ page: 1,
214
+ per_page: 20,
215
+ token: "[you_token]"
114
216
  })
115
217
  ```
116
218
 
117
- Sample results
219
+ ###### Sample results
118
220
  ```json
119
221
  {
120
- "data": {
121
- "image": {
122
- "id": "59311194e99991b2ca8979f1",
123
- "answer": [
124
- "approved"
125
- ],
126
- "credit_charged": 0,
127
- "custom_id": null,
128
- "data": "image_url",
129
- "postback_url": "www.example.com",
130
- "instruction": "TEST instruction",
131
- "categories": [
132
- "approved",
133
- "reject"
134
- ],
135
- "project_id": 190,
136
- "multiple": false,
137
- "processed_at": "2017-06-01T07:23:17.494+00:00",
138
- "status": "unprocess",
139
- "created_at": "2017-06-01T07:18:02.350Z"
140
- }
222
+ "value": {
223
+ "images": [
224
+ {
225
+ "answer": "approved",
226
+ "credit_charged": 1,
227
+ "custom_id": "custom_id",
228
+ "data": "image_url",
229
+ "id": "5a40c77ffb9d7f27354c60c2",
230
+ "postback_url": "https://example.com/callbacks",
231
+ "processed_at": "2017-12-25T16:40:19.699+07:00",
232
+ "project_id": "project_id",
233
+ "status": "processed"
234
+ },
235
+ {
236
+ "answer": "approved",
237
+ "credit_charged": 1,
238
+ "custom_id": "custom_id",
239
+ "data": "image_url",
240
+ "id": "5a40be59fb9d7f27354c5efa",
241
+ "postback_url": "https://example.com/callbacks",
242
+ "processed_at": "2017-12-25T16:02:00.599+07:00",
243
+ "project_id": "project_id",
244
+ "status": "processed"
245
+ },
246
+ ...
247
+ ]
141
248
  },
249
+ "success": true,
250
+ "status": 200,
251
+ "message": "success",
252
+ "total": 3,
142
253
  "meta": {
143
254
  "code": 200,
144
- "message": "success"
255
+ "current_page": 1,
256
+ "message": "success",
257
+ "next_page": 2,
258
+ "prev_page": -1,
259
+ "total_count": 3,
260
+ "total_pages": 2
145
261
  }
146
262
  }
147
263
  ```
264
+ ---
265
+ ### Choices
266
+ [Yes or No Question from Image (30 mins response time)]
148
267
 
149
- Create new choices
268
+ #### Create new choices
150
269
  ```ruby
151
- KSequencing.image_choices.create()
270
+ KSequencing.image_choice.create()
152
271
  ```
153
272
  | Field | Type | Required | Description |
154
273
  | ------------- |:-------------:| :-----:| :-----|
@@ -164,20 +283,53 @@ KSequencing.image_choices.create()
164
283
 
165
284
  Note: Answer can choose only one is default. If you want answer to be multiple, you need to set multiple to true.
166
285
 
167
- Sample request
168
-
169
286
  For one answer
287
+ ###### Sample request
170
288
  ```ruby
171
- KSequencing.image_choices.create({
289
+ KSequencing.image_choice.create({
172
290
  token: "[you_token]",
173
291
  instruction: "question",
174
292
  categories: "options1 options2 options3",
175
293
  data: "image_url"
176
294
  })
177
295
  ```
296
+
297
+ ###### Sample response
298
+ ```json
299
+ {
300
+ "value": {
301
+ "id": "5a40d924eecee03cb247f0dd",
302
+ "allow_empty": false,
303
+ "answer": [],
304
+ "categories": [
305
+ "options1",
306
+ "options2",
307
+ "options3"
308
+ ],
309
+ "credit_charged": 0,
310
+ "custom_id": "custom_id",
311
+ "data": "image_url",
312
+ "instruction": "question",
313
+ "multiple": false,
314
+ "postback_url": "https://example.com/callbacks",
315
+ "processed_at": nil,
316
+ "project_id": "project_id",
317
+ "status": "unprocess"
318
+ },
319
+ "success": true,
320
+ "status": 200,
321
+ "message": "success",
322
+ "meta": {
323
+ "code": 200,
324
+ "message": "success"
325
+ }
326
+ }
327
+ ```
328
+
178
329
  For multiple answer
330
+ ###### Sample request
179
331
  ```ruby
180
- KSequencing.image_choices.create({
332
+ KSequencing.image_choice.create({
181
333
  token: "[you_token]",
182
334
  instruction: "question",
183
335
  categories: "options1 options2 options3",
@@ -186,75 +338,150 @@ KSequencing.image_choices.create({
186
338
  })
187
339
  ```
188
340
 
189
- Sample results
341
+ ###### Sample response
190
342
  ```json
191
343
  {
192
- "data": {
193
- "id": "58c8c3ef12c09f1c0fa78392",
194
- "answer": null,
344
+ "value": {
345
+ "id": "5a40d924eecee03cb247f0dd",
346
+ "allow_empty": false,
347
+ "answer": [],
348
+ "categories": [
349
+ "options1",
350
+ "options2",
351
+ "options3"
352
+ ],
195
353
  "credit_charged": 0,
196
- "custom_id": null,
354
+ "custom_id": "custom_id",
197
355
  "data": "image_url",
198
- "postback_url": "www.example.com",
199
- "process": false,
200
356
  "instruction": "question",
357
+ "multiple": true,
358
+ "postback_url": "https://example.com/callbacks",
359
+ "processed_at": nil,
360
+ "project_id": "project_id",
361
+ "status": "unprocess"
362
+ },
363
+ "success": true,
364
+ "status": 200,
365
+ "message": "success",
366
+ "meta": {
367
+ "code": 200,
368
+ "message": "success"
369
+ }
370
+ }
371
+ ```
372
+
373
+ For allow empty answer
374
+ ```ruby
375
+ KSequencing.image_choice.create({
376
+ token: "[you_token]",
377
+ instruction: "question",
378
+ categories: "options1 options2 options3",
379
+ data: "image_url",
380
+ allow_empty: true
381
+ })
382
+ ```
383
+
384
+ ###### Sample response
385
+ ```json
386
+ {
387
+ "value": {
388
+ "id": "5a40d924eecee03cb247f0dd",
389
+ "allow_empty": true,
390
+ "answer": [],
201
391
  "categories": [
202
- "option1",
203
- "option2",
204
- "option3"
392
+ "options1",
393
+ "options2",
394
+ "options3"
205
395
  ],
206
- "project_id": 1,
396
+ "credit_charged": 0,
397
+ "custom_id": "custom_id",
398
+ "data": "image_url",
399
+ "instruction": "question",
207
400
  "multiple": false,
208
- "processed_at": null,
209
- "created_at": "2017-03-15T04:31:12.600Z"
401
+ "postback_url": "https://example.com/callbacks",
402
+ "processed_at": nil,
403
+ "project_id": "project_id",
404
+ "status": "unprocess"
210
405
  },
406
+ "success": true,
407
+ "status": 200,
408
+ "message": "success",
211
409
  "meta": {
212
410
  "code": 200,
213
411
  "message": "success"
214
412
  }
215
413
  }
216
-
217
414
  ```
218
415
  ---
219
- #### Messages
220
- Get image
416
+ ###### Sample postback data
417
+ ```
418
+ POST "https://example.com/callbacks?answer[]=options3&custom_id=custom_id&image_id=5a41b2a8fb9d7f27354c83d8&task_id=5a41b2a8fb9d7f27354c83d8"
419
+ ```
420
+
421
+ ---
422
+
423
+ #### Get image choice
221
424
  ```ruby
222
- KSequencing.image_message.find_by()
425
+ KSequencing.client.find_image(id)
223
426
  ```
224
427
 
225
428
  | Field | Type | Required | Description |
226
429
  | ------------- |:-------------:| :----:| :-----|
227
- | id | string | No | Image id|
228
- |custom_id | string | No | Client's image id |
430
+ | token | string | Yes | Project token |
431
+ | id | string | Yes | Image id or Client's image id|
229
432
 
230
- Note: You must choose id or custom_id for search. Not both.
433
+ Note:
434
+ - You must choose id or custom_id for search. Not both.
435
+ - Image data dynamic by project token.
436
+
437
+ ###### Sample request
231
438
 
232
- Sample request
233
439
  ```ruby
234
- KSequencing.image_message.find_by({
235
- token: "[you_token]",
236
- id: "592fbfce1b9d8f69e4178688"
237
- })
440
+ KSequencing.client.find_image("5a40be59fb9d7f27354c5efa")
441
+ ```
442
+
443
+ or
444
+
445
+ ```ruby
446
+ KSequencing.client.find_image("your custom id")
238
447
  ```
239
448
 
240
- Sample results
449
+ or
450
+
451
+ ```ruby
452
+ KSequencing.client.find_image("5a40be59fb9d7f27354c5efa", { token: "[you_token]" })
453
+ ```
454
+
455
+ ###### Sample response
456
+ <KSequencing::Response @success=true, @status=200, @message="success" @meta={"code"=>200, "message"=>"success"}, @value={}, />
457
+
458
+ For one answer
241
459
  ```json
242
460
  {
243
- "data": {
461
+ "value": {
244
462
  "image": {
245
- "id": "592fbfce1b9d8f69e4178688",
246
- "answer": null,
247
- "credit_charged": 0,
248
- "custom_id": null,
463
+ "id": "5a40de95aa05617baebfb01f",
464
+ "allow_empty": false,
465
+ "answer": ["options2"],
466
+ "categories": [
467
+ "options1",
468
+ "options2",
469
+ "options3"
470
+ ],
471
+ "credit_charged": 1,
472
+ "custom_id": nil,
249
473
  "data": "image_url",
250
- "postback_url": "www.example.com",
251
- "instruction": "Test",
252
- "project_id": 190,
253
- "processed_at": null,
254
- "status": "unprocess",
255
- "created_at": "2017-06-01T07:18:38.786Z"
474
+ "instruction": "question",
475
+ "multiple": false,
476
+ "postback_url": "https://example.com/callbacks",
477
+ "processed_at": "2017-12-25T18:20:11.450+07:00",
478
+ "project_id": "project_id",
479
+ "status": "processed"
256
480
  }
257
481
  },
482
+ "success": true,
483
+ "status": 200,
484
+ "message": "success",
258
485
  "meta": {
259
486
  "code": 200,
260
487
  "message": "success"
@@ -262,195 +489,676 @@ Sample results
262
489
  }
263
490
  ```
264
491
 
265
- Create new message
492
+ For multiple answer
493
+ ```json
494
+ {
495
+ "value": {
496
+ "image": {
497
+ "id": "5a40de95aa05617baebfb01f",
498
+ "allow_empty": false,
499
+ "answer": ["options2", "options3"],
500
+ "categories": [
501
+ "options1",
502
+ "options2",
503
+ "options3"
504
+ ],
505
+ "credit_charged": 1,
506
+ "custom_id": nil,
507
+ "data": "image_url",
508
+ "instruction": "question",
509
+ "multiple": true,
510
+ "postback_url": "https://example.com/callbacks",
511
+ "processed_at": "2017-12-25T18:20:11.450+07:00",
512
+ "project_id": "project_id",
513
+ "status": "processed"
514
+ }
515
+ },
516
+ "success": true,
517
+ "status": 200,
518
+ "message": "success",
519
+ "meta": {
520
+ "code": 200,
521
+ "message": "success"
522
+ }
523
+ }
524
+ ```
525
+
526
+ For allow empty answer
527
+ ```json
528
+ {
529
+ "value": {
530
+ "image": {
531
+ "id": "5a40de95aa05617baebfb01f",
532
+ "allow_empty": true,
533
+ "answer": [],
534
+ "categories": [
535
+ "options1",
536
+ "options2",
537
+ "options3"
538
+ ],
539
+ "credit_charged": 1,
540
+ "custom_id": nil,
541
+ "data": "image_url",
542
+ "instruction": "question",
543
+ "multiple": false,
544
+ "postback_url": "https://example.com/callbacks",
545
+ "processed_at": "2017-12-25T18:20:11.450+07:00",
546
+ "project_id": "project_id",
547
+ "status": "processed"
548
+ }
549
+ },
550
+ "success": true,
551
+ "status": 200,
552
+ "message": "success",
553
+ "meta": {
554
+ "code": 200,
555
+ "message": "success"
556
+ }
557
+ }
558
+ ```
559
+
560
+ #### Get all choices
266
561
  ```ruby
267
- KSequencing.image_messages.create()
562
+ KSequencing.image_choice.all({ token: "[you_token]" })
268
563
  ```
564
+
269
565
  | Field | Type | Required | Description |
270
- | ------------- |:-------------:| :-----:| :-----|
271
- | instruction | string | Yes | Image instruction|
272
- | data | string | Yes |Data for attachment|
273
- | postback_url | string | No | Image postback url|
274
- | postback_method | string | No |Postback method|
275
- | custom_id | string | No |Custom's id|
566
+ | ------------- |:-------------:| :----:| :-----|
567
+ |token | string | Yes | Project token |
568
+ | page | integer | No | Image id|
569
+ |per_page | integer | No | Client's image id |\
570
+
571
+ Note: You must choose id or custom_id for search. Not both.
572
+
573
+ ###### Sample request
574
+ ```ruby
575
+ KSequencing.image_choice.all
576
+ ```
577
+
578
+ or
579
+
580
+ ```ruby
581
+ KSequencing.image_choice.all({
582
+ page: 1,
583
+ per_page: 20,
584
+ token: "[you_token]"
585
+ })
586
+ ```
587
+
588
+ ###### Sample results
589
+ ```json
590
+ {
591
+ "value": {
592
+ "images": [
593
+ {
594
+ "id": "5a40de95aa05617baebfb01f",
595
+ "allow_empty": false,
596
+ "answer": ["options2"],
597
+ "categories": [
598
+ "options1",
599
+ "options2",
600
+ "options3"
601
+ ],
602
+ "credit_charged": 1,
603
+ "custom_id": "custom_id",
604
+ "data": "image_url",
605
+ "instruction": "question",
606
+ "multiple": false,
607
+ "postback_url": "https://example.com/callbacks",
608
+ "processed_at": "2017-12-25T18:20:11.450+07:00",
609
+ "project_id": "project_id",
610
+ "status": "processed"
611
+ },
612
+ {
613
+ "id": "5a40da6faa05617baebfaf3f",
614
+ "allow_empty": false,
615
+ "answer": ["options2"],
616
+ "categories": [
617
+ "options1",
618
+ "options2",
619
+ "options3"
620
+ ],
621
+ "credit_charged": 1,
622
+ "custom_id": "custom_id",
623
+ "data": "image_url",
624
+ "instruction": "question",
625
+ "multiple": false,
626
+ "postback_url": "https://example.com/callbacks",
627
+ "processed_at": "2017-12-25T18:20:08.853+07:00",
628
+ "project_id": "project_id",
629
+ "status": "processed"
630
+ }
631
+ ]
632
+ },
633
+ "success": true,
634
+ "status": 200,
635
+ "message": "success",
636
+ "total": 8,
637
+ "meta": {
638
+ "code": 200,
639
+ "message": "success",
640
+ "current_page": 1,
641
+ "next_page": 2,
642
+ "prev_page": -1,
643
+ "total_pages": 4,
644
+ "total_count": 8
645
+ }
646
+ }
647
+ ```
648
+
649
+ ---
650
+ ### Messages
651
+ [Message Question from Image (30 mins response time)]
652
+
653
+ #### Create Message Question from Image (30 mins response time)
654
+ Messages - This model allow moderator type the anwser on what they see.
655
+
656
+ ```ruby
657
+ KSequencing.image_message.create()
658
+ ```
659
+ | Field | Type | Required | Description |
660
+ | ------------- |:-----------:| :-----:| :-----|
661
+ | instruction | string | Yes | Image instruction|
662
+ | data | string | Yes | Data for attachment|
663
+ | postback_url | string | No | Image postback url|
664
+ | postback_method | string | No | Postback method|
665
+ | custom_id | string | No | Custom's id|
276
666
 
277
- Sample request
667
+ ###### Sample request
278
668
  ```ruby
279
- KSequencing.image_messages.create({
669
+ KSequencing.image_message.create({
280
670
  instruction: "question",
281
671
  data: "image_url"
282
672
  })
283
673
  ```
284
674
 
285
- Sample results
675
+ ###### Sample response
286
676
  ```json
287
677
  {
288
- "data": {
289
- "id": "58c8c3ef12c09f1c0fa78392",
290
- "answer": null,
678
+ "value": {
679
+ "id": "5a41b2a8fb9d7f27354c83d8",
680
+ "allow_empty": false,
681
+ "answer": [],
682
+ "categories": [
683
+ "options1",
684
+ "options2",
685
+ "options3"
686
+ ],
291
687
  "credit_charged": 0,
292
- "custom_id": null,
688
+ "custom_id": "custom_id",
293
689
  "data": "image_url",
294
- "postback_url": "www.example.com",
295
- "process": false,
296
- "instruction": "question",
297
- "project_id": 1,
298
- "processed_at": null,
299
- "created_at": "2017-03-15T04:32:47.762Z"
690
+ "instruction": "Your question?",
691
+ "multiple": false,
692
+ "postback_url": "https://example.com/callbacks",
693
+ "processed_at": nil,
694
+ "project_id": "project_id",
695
+ "status": "unprocess"
300
696
  },
697
+ "success": true,
698
+ "status": 200,
699
+ "message": "success",
301
700
  "meta": {
302
701
  "code": 200,
303
702
  "message": "success"
304
703
  }
305
704
  }
306
705
  ```
706
+
707
+ ###### Sample postback data
708
+ ```
709
+ POST "https://example.com/callbacks?answer=sky%20blue&custom_id=custom_id&image_id=5a41b2a8fb9d7f27354c83d8&task_id=5a41b2a8fb9d7f27354c83d8"
710
+ ```
307
711
  ---
308
- #### Photo tags
309
- Get image
712
+
713
+ #### Get image
310
714
  ```ruby
311
- KSequencing.image_photo_tag.find_by()
715
+ KSequencing.client.find_image(id)
312
716
  ```
313
717
 
314
718
  | Field | Type | Required | Description |
315
719
  | ------------- |:-------------:| :----:| :-----|
316
- | id | string | No | Image id|
317
- |custom_id | string | No | Client's image id |
720
+ | token | string | Yes | Project token |
721
+ | id | string | Yes | Image id or Client's image id|
318
722
 
319
- Note: You must choose id or custom_id for search. Not both.
723
+ Note:
724
+ - You must choose id or custom_id for search. Not both.
725
+ - Image data dynamic by project token.
726
+
727
+ ###### Sample request
320
728
 
321
- Sample request
322
729
  ```ruby
323
- KSequencing.image_photo_tag.find_by({
324
- id: "592fbfec1b9d8f69e4178689"
325
- })
730
+ KSequencing.client.find_image("5a40be59fb9d7f27354c5efa")
731
+ ```
732
+
733
+ or
734
+
735
+ ```ruby
736
+ KSequencing.client.find_image("your custom id")
326
737
  ```
327
738
 
328
- Sample results
739
+ or
740
+
741
+ ```ruby
742
+ KSequencing.client.find_image("5a41b7b2fb9d7f27354c84d4", { token: "[you_token]" })
743
+ ```
744
+
745
+ ###### Sample response
746
+ <KSequencing::Response @success=true, @status=200, @message="success" @meta={"code"=>200, "message"=>"success"}, @value={}, />
747
+
329
748
  ```json
330
749
  {
331
- "data": {
750
+ "value": {
332
751
  "image": {
333
- "id": "592fbfec1b9d8f69e4178689",
334
- "answer": [],
335
- "credit_charged": 0,
336
- "custom_id": null,
752
+ "id": "5a41b7b2fb9d7f27354c84d4",
753
+ "answer": "sky blue",
754
+ "credit_charged": 1,
755
+ "custom_id": "custom_id",
337
756
  "data": "image_url",
338
- "postback_url": "www.example.com",
339
- "instruction": "TEST",
340
- "project_id": 190,
341
- "processed_at": null,
342
- "status": "unprocess",
343
- "created_at": "2017-06-01T07:19:08.587Z"
757
+ "instruction": "Your question?",
758
+ "postback_url": "https://example.com/callbacks",
759
+ "processed_at": "2017-12-26T09:45:29.328+07:00",
760
+ "project_id": "project_id",
761
+ "status": "processed"
344
762
  }
345
763
  },
764
+ "success": true,
765
+ "status": 200,
766
+ "message": "success",
346
767
  "meta": {
347
768
  "code": 200,
348
769
  "message": "success"
349
770
  }
350
771
  }
351
772
  ```
352
-
353
- Create new photo tag
773
+ ---
774
+ #### Get list of image messages
354
775
  ```ruby
355
- KSequencing.client.image_photo_tags.create()
776
+ KSequencing.image_message.all({ token: "[you_token]" })
356
777
  ```
778
+
357
779
  | Field | Type | Required | Description |
358
- | ------------- |:-------------:| :-----:| :-----|
359
- | instruction | string | Yes | Image instruction|
360
- | data | string | Yes |Data for attachment|
361
- | postback_url | string | No | Image postback url|
362
- | postback_method | string | No |Postback method|
363
- | custom_id | string | No |Custom's id|
780
+ | ------------- |:-------------:| :----:| :-----|
781
+ |token | string | Yes | Project token |
782
+ | page | integer | No | Image id|
783
+ |per_page | integer | No | Client's image id |\
784
+
785
+ Note: You must choose id or custom_id for search. Not both.
786
+
787
+ ###### Sample request
788
+ ```ruby
789
+ KSequencing.image_message.all
790
+ ```
791
+
792
+ or
364
793
 
365
- Sample request
366
794
  ```ruby
367
- KSequencing.client.image_photo_tags.create(
795
+ KSequencing.image_message.all({
796
+ page: 1,
797
+ per_page: 20,
798
+ token: "[you_token]"
799
+ })
800
+ ```
801
+
802
+ ###### Sample results
803
+ ```json
804
+ {
805
+ "value": {
806
+ "images": [
807
+ {
808
+ "answer": "sky blue",
809
+ "credit_charged": 1,
810
+ "custom_id": "custom_id",
811
+ "data": "image_url",
812
+ "instruction": "Your question?",
813
+ "id": "5a41b7b2fb9d7f27354c84d4",
814
+ "postback_url": "https://example.com/callbacks",
815
+ "processed_at": "2017-12-25T16:40:19.699+07:00",
816
+ "project_id": "project_id",
817
+ "status": "processed"
818
+ },
819
+ {
820
+ "answer": "yes",
821
+ "credit_charged": 1,
822
+ "custom_id": "custom_id",
823
+ "data": "image_url",
824
+ "instruction": "Your question?",
825
+ "id": "5a40be59fb9d7f27354c5efa",
826
+ "postback_url": "https://example.com/callbacks",
827
+ "processed_at": "2017-12-25T16:02:00.599+07:00",
828
+ "project_id": "project_id",
829
+ "status": "processed"
830
+ },
831
+ ...
832
+ ]
833
+ },
834
+ "success": true,
835
+ "status": 200,
836
+ "message": "success",
837
+ "total": 3,
838
+ "meta": {
839
+ "code": 200,
840
+ "current_page": 1,
841
+ "message": "success",
842
+ "next_page": 2,
843
+ "prev_page": -1,
844
+ "total_count": 3,
845
+ "total_pages": 2
846
+ }
847
+ }
848
+ ```
849
+ ---
850
+
851
+ ### Photo tags
852
+ [Tag an object in the image (60 mins response time)]
853
+
854
+ #### Create new photo tag
855
+ ```ruby
856
+ KSequencing.image_photo_tag.create()
857
+ ```
858
+ | Field | Type | Required | Description |
859
+ | ------------- |:------:| :-----:| :-----|
860
+ | instruction | string | Yes | Image instruction|
861
+ | data | string | Yes | Data for attachment|
862
+ | postback_url | string | No | Image postback url|
863
+ | postback_method | string | No | Postback method|
864
+ | custom_id | string | No | Custom's id|
865
+
866
+ ###### Sample request
867
+ ```ruby
868
+ KSequencing.image_photo_tag.create(
368
869
  instruction: "question",
369
870
  data: "image_url"
370
871
  )
371
872
  ```
372
873
 
874
+ or
373
875
 
374
- Sample results
876
+ Override data [:token, :postback_url, :postback_method]
877
+ ```ruby
878
+ KSequencing.image_photo_tag.create({
879
+ custom_id: "custom_id",
880
+ data: "image_url",
881
+ postback_method: "POST",
882
+ postback_url: "https://example.com/callbacks",
883
+ token: "[you_token]"
884
+ })
885
+ ```
886
+
887
+ ###### Sample response
375
888
  ```json
376
889
  {
377
- "data": {
378
- "id": "58c8c3ef12c09f1c0fa78392",
379
- "answer": null,
890
+ "value": {
891
+ "id": "5a41bc09aa05617baa2832f8",
892
+ "answer": [],
380
893
  "credit_charged": 0,
381
- "custom_id": null,
894
+ "custom_id": "custom_id",
382
895
  "data": "image_url",
383
- "postback_url": "www.example.com",
384
- "process": false,
385
- "instruction": "question",
386
- "project_id": 1,
387
- "processed_at": null,
388
- "created_at": "2017-03-15T04:34:36.230Z"
896
+ "instruction": "Your question?",
897
+ "postback_url": "https://example.com/callbacks",
898
+ "processed_at": nil,
899
+ "project_id": "project_id",
900
+ "status": "unprocess"
389
901
  },
902
+ "success": true,
903
+ "status": 200,
904
+ "message": "success",
390
905
  "meta": {
391
906
  "code": 200,
392
907
  "message": "success"
393
908
  }
394
909
  }
395
910
  ```
396
- ---
397
911
 
912
+ ###### Sample postback data
398
913
 
399
- #### Prediction
400
- Get prediction
914
+ Case one answer
915
+ ```
916
+ POST "https://example.com/callbacks?answer[0][id]=0&answer[0][x]=331&answer[0][y]=435&answer[0][z]=100&answer[0][width]=167&answer[0][height]=60&custom_id=custom_id&image_id=5a41bd55aa05617baa283338&task_id=5a41bd55aa05617baa283338"
917
+ ```
918
+
919
+ Case multi answers
920
+ ```
921
+ POST "https://example.com/callbacks?answer[0][id]=0&answer[0][x]=104&answer[0][y]=294&answer[0][z]=0&answer[0][width]=240&answer[0][height]=131&answer[1][id]=1&answer[1][x]=85&answer[1][y]=64&answer[1][z]=100&answer[1][width]=234&answer[1][height]=180&custom_id=&image_id=5a41bc09aa05617baa2832f8&task_id=5a41bc09aa05617baa2832f8"
922
+ ```
923
+ ---
924
+ #### Get image
401
925
  ```ruby
402
- KSequencing.prediction.find_by()
926
+ KSequencing.client.find_image(id)
403
927
  ```
404
928
 
405
929
  | Field | Type | Required | Description |
406
930
  | ------------- |:-------------:| :----:| :-----|
407
- | id | string | No | Image id|
408
- |custom_id | string | No | Client's image id |
931
+ | token | string | Yes | Project token |
932
+ | id | string | Yes | Image id or Client's image id|
409
933
 
410
- Note: You must choose id or custom_id for search. Not both.
934
+ Note:
935
+ - You must choose id or custom_id for search. Not both.
936
+ - Image data dynamic by project token.
937
+
938
+ ###### Sample request
411
939
 
412
- Sample request
413
940
  ```ruby
414
- KSequencing.prediction.find_by({
415
- id: "592fbfec1b9d8f69e4178689"
416
- })
941
+ KSequencing.client.find_image("5a41bd55aa05617baa283338")
942
+ ```
943
+
944
+ or
945
+
946
+ ```ruby
947
+ KSequencing.client.find_image("your custom id")
948
+ ```
949
+
950
+ or
951
+
952
+ ```ruby
953
+ KSequencing.client.find_image("5a41bc09aa05617baa2832f8", { token: "[you_token]" })
954
+ ```
955
+
956
+ ###### Sample response
957
+ <KSequencing::Response @success=true, @status=200, @message="success" @meta={"code"=>200, "message"=>"success"}, @value={}, />
958
+
959
+ - one answer
960
+ ```json
961
+ {
962
+ "value": {
963
+ "image": {
964
+ "id": "5a41bd55aa05617baa283338",
965
+ "answer": [
966
+ {
967
+ "height": "60",
968
+ "id": "0",
969
+ "width": "167",
970
+ "x": "331",
971
+ "y": "435",
972
+ "z": "100"
973
+ }
974
+ ],
975
+ "credit_charged": 0,
976
+ "custom_id": "custom_id",
977
+ "data": "image_url",
978
+ "instruction": "Your question?",
979
+ "postback_url": "https://example.com/callbacks",
980
+ "processed_at": "2017-12-26T10:09:28.467+07:00",
981
+ "project_id": "project_id",
982
+ "status": "processed"
983
+ }
984
+ },
985
+ "success": true,
986
+ "status": 200,
987
+ "message": "success",
988
+ "meta": {
989
+ "code": 200,
990
+ "message": "success"
991
+ }
992
+ }
417
993
  ```
418
994
 
419
- Sample results
995
+ - two answer
420
996
  ```json
421
997
  {
422
- "data": {
998
+ "value": {
423
999
  "image": {
424
- "id": "5a0d3a8c0deb540ab9c56e33",
425
- "answer": null,
1000
+ "id": "5a41bc09aa05617baa2832f8",
1001
+ "answer": [
1002
+ {
1003
+ "height": "131",
1004
+ "id": "0",
1005
+ "width": "240",
1006
+ "x": "104",
1007
+ "y": "294",
1008
+ "z": "0"
1009
+ },
1010
+ {
1011
+ "height": "180",
1012
+ "id": "1",
1013
+ "width": "234",
1014
+ "x": "85",
1015
+ "y": "64",
1016
+ "z": "100"
1017
+ }
1018
+ ],
426
1019
  "credit_charged": 0,
427
- "custom_id": null,
428
- "data": "www.example.com",
429
- "postback_url": "www.example.com",
430
- "processed_at": null,
431
- "project_id": 96,
432
- "status": "processing"
1020
+ "custom_id": "custom_id",
1021
+ "data": "image_url",
1022
+ "instruction": "Your question?",
1023
+ "postback_url": "https://example.com/callbacks",
1024
+ "processed_at": "2017-12-26T10:05:53.633+07:00",
1025
+ "project_id": "project_id",
1026
+ "status": "processed"
433
1027
  }
434
1028
  },
1029
+ "success": true,
1030
+ "status": 200,
1031
+ "message": "success",
435
1032
  "meta": {
436
1033
  "code": 200,
437
1034
  "message": "success"
438
1035
  }
439
1036
  }
440
1037
  ```
1038
+ ---
1039
+ #### Get list of image photo tags
1040
+ ```ruby
1041
+ KSequencing.image_photo_tag.all({ token: "[you_token]" })
1042
+ ```
1043
+
1044
+ | Field | Type | Required | Description |
1045
+ | ------------- |:-------------:| :----:| :-----|
1046
+ |token | string | Yes | Project token |
1047
+ | page | integer | No | Image id|
1048
+ |per_page | integer | No | Client's image id |\
1049
+
1050
+ Note: You must choose id or custom_id for search. Not both.
1051
+
1052
+ ###### Sample request
1053
+ ```ruby
1054
+ KSequencing.image_photo_tag.all
1055
+ ```
1056
+
1057
+ or
1058
+
1059
+ ```ruby
1060
+ KSequencing.image_photo_tag.all({
1061
+ page: 1,
1062
+ per_page: 20,
1063
+ token: "[you_token]"
1064
+ })
1065
+ ```
1066
+
1067
+ ###### Sample results
1068
+ ```json
1069
+ {
1070
+ "value": {
1071
+ "images": [
1072
+ {
1073
+ "id": "5a41bd55aa05617baa283338",
1074
+ "answer": [
1075
+ {
1076
+ "height": "60",
1077
+ "id": "0",
1078
+ "width": "167",
1079
+ "x": "331",
1080
+ "y": "435",
1081
+ "z": "100"
1082
+ }
1083
+ ],
1084
+ "credit_charged": 0,
1085
+ "custom_id": "custom_id",
1086
+ "data": "image_url",
1087
+ "instruction": "Your question?",
1088
+ "postback_url": "https://example.com/callbacks",
1089
+ "processed_at": "2017-12-26T10:09:28.467+07:00",
1090
+ "project_id": "project_id",
1091
+ "status": "processed"
1092
+ },
1093
+ {
1094
+ "id": "5a41bc09aa05617baa2832f8",
1095
+ "answer": [
1096
+ {
1097
+ "height": "131",
1098
+ "id": "0",
1099
+ "width": "240",
1100
+ "x": "104",
1101
+ "y": "294",
1102
+ "z": "0"
1103
+ },
1104
+ {
1105
+ "height": "180",
1106
+ "id": "1",
1107
+ "width": "234",
1108
+ "x": "85",
1109
+ "y": "64",
1110
+ "z": "100"
1111
+ }
1112
+ ],
1113
+ "credit_charged": 0,
1114
+ "custom_id": "custom_id",
1115
+ "data": "image_url",
1116
+ "instruction": "Your question?",
1117
+ "postback_url": "https://example.com/callbacks",
1118
+ "processed_at": "2017-12-26T10:05:53.633+07:00",
1119
+ "project_id": "project_id",
1120
+ "status": "processed"
1121
+ }
1122
+ ]
1123
+ },
1124
+ "success": true,
1125
+ "status": 200,
1126
+ "message": "success",
1127
+ "total": 3,
1128
+ "meta": {
1129
+ "code": 200,
1130
+ "message": "success",
1131
+ "current_page": 1,
1132
+ "next_page": -1,
1133
+ "prev_page": -1,
1134
+ "total_pages": 1,
1135
+ "total_count": 3
1136
+ }
1137
+ }
1138
+ ```
1139
+ ---
1140
+
1141
+ ### Prediction
1142
+ Images (AI Beta / 95% accuracy)
1143
+ - [nanameue]Standard Criteria (~1 min)
1144
+ - [sexual]Nudity/Sexual (~1 min)
1145
+ - [demographic]Demographic (~3 mins)
1146
+ - [ai_human]Standard Criteria & Human
1147
+
1148
+ #### Create prediction
1149
+ Dynamic from your project key
441
1150
 
442
- Create prediction
443
1151
  ```ruby
444
1152
  KSequencing.prediction.create()
445
1153
  ```
446
1154
  | Field | Type | Required | Description |
447
1155
  | ------------- |:-------------:| :-----:| :-----|
448
- | data | string | Yes |Data for attachment|
449
- | postback_url | string | No | Image postback url|
450
- | postback_method | string | No |Postback method|
451
- | custom_id | string | No |Custom's id|
1156
+ | data | string | Yes | Data for attachment|
1157
+ | postback_url | string | No | Image postback url|
1158
+ | postback_method | string | No | Postback method|
1159
+ | custom_id | string | No | Custom's id|
452
1160
 
453
- Sample request
1161
+ ###### Sample request
454
1162
  ```ruby
455
1163
  KSequencing.prediction.create(
456
1164
  token: "[your_token]",
@@ -458,44 +1166,322 @@ KSequencing.prediction.create(
458
1166
  )
459
1167
  ```
460
1168
 
461
- Sample results
1169
+ - [nanameue]Standard Criteria (~1 min)
1170
+ ###### Sample response
462
1171
  ```json
463
1172
  {
464
- "data": {
465
- "id": "5a0e49d00deb540ab9c56e4f",
466
- "answer": null,
1173
+ "value": {
1174
+ "id": "5a41c388aa05617baa283457",
1175
+ "answer": nil,
467
1176
  "credit_charged": 0,
468
- "custom_id": null,
469
- "data": "www.example.com",
470
- "postback_url": "www.example.com",
471
- "processed_at": null,
472
- "project_id": 96,
1177
+ "custom_id": "custom_id",
1178
+ "data": "image_url",
1179
+ "postback_url": "https://example.com/callbacks",
1180
+ "processed_at": nil,
1181
+ "project_id": "project_id",
473
1182
  "status": "processing"
474
1183
  },
1184
+ "success": true,
1185
+ "status": 200,
1186
+ "message": "success",
475
1187
  "meta": {
476
1188
  "code": 200,
477
1189
  "message": "success"
478
1190
  }
479
1191
  }
480
1192
  ```
481
- <enter>
1193
+
1194
+ ###### Sample postback data
1195
+ ```
1196
+ POST "https://example.com/callbacks?answer=approved&custom_id=&image_id=5a41c388aa05617baa283457&task_id=5a41c388aa05617baa283457"
1197
+ ```
482
1198
  ---
1199
+ - [sexual]Nudity/Sexual (~1 min)
1200
+ ###### Sample response
1201
+ ```json
1202
+ {
1203
+ "value": {
1204
+ "id": "5a41ce6eaa05617baa2836aa",
1205
+ "answer": nil,
1206
+ "credit_charged": 0,
1207
+ "custom_id": "custom_id",
1208
+ "data": "image_url",
1209
+ "postback_url": "https://example.com/callbacks",
1210
+ "processed_at": nil,
1211
+ "project_id": "project_id",
1212
+ "status": "processing"
1213
+ },
1214
+ "success": true,
1215
+ "status": 200,
1216
+ "message": "success",
1217
+ "meta": {
1218
+ "code": 200,
1219
+ "message": "success"
1220
+ }
1221
+ }
1222
+ ```
483
1223
 
484
- As you see above all API have a same name just change model name and paramter, however if you would like to list all of your data just use all() see example below
1224
+ ###### Sample postback data
1225
+ ```
1226
+ POST "https://example.com/callbacks?answer[0][id]=0&answer[0][x]=331&answer[0][y]=435&answer[0][z]=100&answer[0][width]=167&answer[0][height]=60&custom_id=&image_id=5a41bd55aa05617baa283338&task_id=5a41bd55aa05617baa283338"
1227
+ ```
1228
+ ---
1229
+ - [demographic]Demographic (~3 mins)
1230
+ ###### Sample response
1231
+ ```json
1232
+ {
1233
+ "value": {
1234
+ "id": "5a41d011fb9d7f273a75a62d",
1235
+ "answer": nil,
1236
+ "credit_charged": 0,
1237
+ "custom_id": "custom_id",
1238
+ "data": "image_url",
1239
+ "postback_url": "https://example.com/callbacks",
1240
+ "processed_at": nil,
1241
+ "project_id": "project_id",
1242
+ "status": "processing"
1243
+ },
1244
+ "success": true,
1245
+ "status": 200,
1246
+ "message": "success",
1247
+ "meta": {
1248
+ "code": 200,
1249
+ "message": "success"
1250
+ }
1251
+ }
1252
+ ```
485
1253
 
486
- #### Get list of data
1254
+ ###### Sample postback data
1255
+ ```
1256
+ POST "https://example.com/callbacks?answer[result][][gender]=male&answer[result][][coordinates][x_max]=747.9999554157257&answer[result][][coordinates][x_min]=0.0&answer[result][][coordinates][y_max]=573.0054758787155&answer[result][][coordinates][y_min]=0.0&custom_id=custom_id&image_id=5a41d011fb9d7f273a75a62d&task_id=5a41d011fb9d7f273a75a62d"
1257
+ ```
1258
+ ---
1259
+ - [ai_human]Standard Criteria & Human
1260
+ ###### Sample response
1261
+ ```json
1262
+ {
1263
+ "value": {
1264
+ "id": "5a41d10efb9d7f27354c8963",
1265
+ "answer": nil,
1266
+ "credit_charged": 0,
1267
+ "custom_id": "custom_id",
1268
+ "data": "image_url",
1269
+ "postback_url": "https://example.com/callbacks",
1270
+ "processed_at": nil,
1271
+ "project_id": "project_id",
1272
+ "status": "processing"
1273
+ },
1274
+ "success": true,
1275
+ "status": 200,
1276
+ "message": "success",
1277
+ "meta": {
1278
+ "code": 200,
1279
+ "message": "success"
1280
+ }
1281
+ }
1282
+ ```
487
1283
 
1284
+ ###### Sample postback data
1285
+ ```
1286
+ POST "https://example.com/callbacks?answer=approved&custom_id=custom_id&image_id=5a41d110aa05617baebfd46f&task_id=5a41d110aa05617baebfd46f"
1287
+ ```
1288
+ ---
1289
+
1290
+ #### Get prediction
488
1291
  ```ruby
489
- KSequencing.[model].all()
1292
+ KSequencing.client.find_image(id)
490
1293
  ```
1294
+
491
1295
  | Field | Type | Required | Description |
492
- | ------------- |:-------------:| :-----:| :-----|
493
- | page | interger | No | default 0|
494
- | per_page | string | No | default 20 |
1296
+ | ------------- |:-------------:| :----:| :-----|
1297
+ | token | string | Yes | Project token |
1298
+ | id | string | Yes | Image id or Client's image id|
1299
+
1300
+ Note:
1301
+ - You must choose id or custom_id for search. Not both.
1302
+ - Image data dynamic by project token.
1303
+
1304
+ ###### Sample request
495
1305
 
496
- Sample request
497
1306
  ```ruby
498
- KSequencing.[model].all(
499
- token: "[your_token]"
500
- )
1307
+ KSequencing.client.find_image("5a40be59fb9d7f27354c5efa")
1308
+ ```
1309
+
1310
+ or
1311
+
1312
+ ```ruby
1313
+ KSequencing.client.find_image("your custom id")
1314
+ ```
1315
+
1316
+ or
1317
+
1318
+ ```ruby
1319
+ KSequencing.client.find_image("5a40be59fb9d7f27354c5efa", { token: "[you_token]" })
1320
+ ```
1321
+
1322
+ - [nanameue]Standard Criteria (~1 min)
1323
+ ###### Sample response
1324
+ ```json
1325
+ {
1326
+ "value": {
1327
+ "image": {
1328
+ "id": "5a40a134fb9d7f273a7574d1",
1329
+ "answer": "approved",
1330
+ "credit_charged": 1,
1331
+ "custom_id": "custom_id",
1332
+ "data": "image_url",
1333
+ "postback_url": "https://example.com/callbacks",
1334
+ "processed_at": "2017-12-25T13:56:54.651+07:00",
1335
+ "project_id": "project_id",
1336
+ "status": "processed"
1337
+ }
1338
+ },
1339
+ "success": true,
1340
+ "status": 200,
1341
+ "message": "success",
1342
+ "meta": {
1343
+ "code": 200,
1344
+ "message": "success"
1345
+ }
1346
+ }
1347
+ ```
1348
+ ---
1349
+ - [sexual]Nudity/Sexual (~1 min)
1350
+ ###### Sample response
1351
+ ```json
1352
+ {
1353
+ "value": {
1354
+ "image": {
1355
+ "id": "5a40a2a6aa05617baa2805c0",
1356
+ "answer": {
1357
+ "sexual": 0.030112840235233307
1358
+ },
1359
+ "credit_charged": 0,
1360
+ "custom_id": "custom_id",
1361
+ "data": "image_url",
1362
+ "postback_url": "https://example.com/callbacks",
1363
+ "processed_at": "2017-12-25T14:03:05.750+07:00",
1364
+ "project_id": "project_id",
1365
+ "status": "processed"
1366
+ }
1367
+ },
1368
+ "success": true,
1369
+ "status": 200,
1370
+ "message": "success",
1371
+ "meta": {
1372
+ "code": 200,
1373
+ "message": "success"
1374
+ }
1375
+ }
1376
+ ```
1377
+ ---
1378
+ - [demographic]Demographic (~3 mins)
1379
+ ###### Sample response
1380
+ ```json
1381
+ {
1382
+ "value": {
1383
+ "image": {
1384
+ "id": "5a41d011fb9d7f273a75a62d",
1385
+ "answer": {
1386
+ "result": [
1387
+ {
1388
+ "coordinates": {
1389
+ "x_max": 747.9999554157257,
1390
+ "x_min": 0.0,
1391
+ "y_max": 573.0054758787155,
1392
+ "y_min": 0.0
1393
+ },
1394
+ "gender": "male"
1395
+ }
1396
+ ]
1397
+ },
1398
+ "credit_charged": 0,
1399
+ "custom_id": "custom_id",
1400
+ "data": "image_url",
1401
+ "postback_url": "https://example.com/callbacks",
1402
+ "processed_at": "2017-12-26T11:29:20.212+07:00",
1403
+ "project_id": "project_id",
1404
+ "status": "processed"
1405
+ }
1406
+ },
1407
+ "success": true,
1408
+ "status": 200,
1409
+ "message": "success",
1410
+ "meta": {
1411
+ "code": 200,
1412
+ "message": "success"
1413
+ }
1414
+ }
1415
+ ```
1416
+ ---
1417
+ - [ai_human]Standard Criteria & Human
1418
+ ###### Sample response
1419
+ ```json
1420
+ {
1421
+ "value": {
1422
+ "image": {
1423
+ "id": "5a41d110aa05617baebfd46f",
1424
+ "answer": "approved",
1425
+ "credit_charged": 1,
1426
+ "custom_id": "custom_id",
1427
+ "data": "image_url",
1428
+ "postback_url": "https://example.com/callbacks",
1429
+ "processed_at": "2017-12-26T11:34:55.786+07:00",
1430
+ "project_id": "project_id",
1431
+ "status": "processed"
1432
+ }
1433
+ },
1434
+ "success": true,
1435
+ "status": 200,
1436
+ "message": "success",
1437
+ "meta": {
1438
+ "code": 200,
1439
+ "message": "success"
1440
+ }
1441
+ }
1442
+ ```
1443
+ if prediction [ai_human] processed by human you will find answer human from Get list of predictions
1444
+ ###### example
1445
+ ```json
1446
+ {
1447
+ "value": {
1448
+ "images": [
1449
+ {
1450
+ "id": "5a41d10efb9d7f27354c8963",
1451
+ "answer": "human",
1452
+ "credit_charged": 0,
1453
+ "custom_id": nil,
1454
+ "data": "image_url",
1455
+ "postback_url": "https://example.com/callbacks",
1456
+ "processed_at": "2017-12-26T11:33:20.009+07:00",
1457
+ "project_id": "project_id",
1458
+ "status": "processed"
1459
+ },
1460
+ {
1461
+ "id": "5a40a178fb9d7f27354c58bc",
1462
+ "answer": "approved",
1463
+ "credit_charged": 0,
1464
+ "custom_id": nil,
1465
+ "data": "image_url",
1466
+ "postback_url": "https://example.com/callbacks",
1467
+ "processed_at": "2017-12-25T13:58:03.022+07:00",
1468
+ "project_id": "project_id",
1469
+ "status": "processed"
1470
+ }
1471
+ ]
1472
+ },
1473
+ "success": true,
1474
+ "status": 200,
1475
+ "message": "success",
1476
+ "total": 2,
1477
+ "meta": {
1478
+ "code": 200,
1479
+ "message": "success",
1480
+ "current_page": 1,
1481
+ "next_page": -1,
1482
+ "prev_page": -1,
1483
+ "total_pages": 1,
1484
+ "total_count": 2
1485
+ }
1486
+ }
501
1487
  ```