monkeylearn 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/monkeylearn.rb +1 -0
- data/lib/monkeylearn/workflows.rb +125 -0
- data/monkeylearn.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5bb069bb982d494b3e56b4d624e267e68722ac9
|
4
|
+
data.tar.gz: 644741c1f4758eaa7794a656477de0d05944ff8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bba1a5e091c5acbf3ffbe3b1386148a87b54c2d241028e68b19ad1a2a3e2d78572364b23fa26a56ae1b255df857bb73e464bbe98fecba66e2e5716d0222b3e7e
|
7
|
+
data.tar.gz: d5d70876460a891601ccedc8346cee1d159034356865184eb39ad730052969a40516bbb4af5e8a0a23944d92074b8afafbeda998385053102dbc4b2cfdcc721d
|
data/README.md
CHANGED
@@ -362,12 +362,12 @@ Optional parameters:
|
|
362
362
|
|--------------------|-------------------|-------------------|-------------|
|
363
363
|
|*page* |`Integer` | `1` | Specifies which page to get.|
|
364
364
|
|*per_page* |`Integer` | `20` | Specifies how many items per page will be returned. |
|
365
|
-
|*order_by* |`String or Array` |`'-created'` | Specifies the ordering criteria. It
|
365
|
+
|*order_by* |`String or Array` |`'-created'` | Specifies the ordering criteria. It can either be a `String` for single criteria ordering or an array of `Strings` for more than one. Each `String` must be a valid field name; if you want inverse/descending order of the field prepend a `-` (dash) character. Some valid examples are: `'is_public'`, `'-name'` or `['-is_public', 'name']`. |
|
366
366
|
|
367
367
|
Example:
|
368
368
|
|
369
369
|
```ruby
|
370
|
-
response = Monkeylearn.classifiers.list(page:
|
370
|
+
response = Monkeylearn.classifiers.list(page: 2, per_page: 5, order_by: ['-is_public', 'name'])
|
371
371
|
```
|
372
372
|
|
373
373
|
<br>
|
@@ -544,7 +544,7 @@ Parameters:
|
|
544
544
|
|--------- | ----------- |
|
545
545
|
|text | A *String* of the text to upload.|
|
546
546
|
|tags | An optional *Array* of tags that can be refered to by their numeric ID or their name. The text will be tagged with each tag in the *list* when created (in case it doesn't already exist on the model). Otherwise, its tags will be updated to the new ones. New tags will be created if they don't already exist.||
|
547
|
-
|
|
547
|
+
|markers | An optional *Array* of *String*. Each one represents a marker that will be associated with the text. New markers will be created if they don't already exist.|
|
548
548
|
|
549
549
|
|
550
550
|
Example:
|
@@ -618,7 +618,7 @@ response = Monkeylearn.extractors.detail("[MODEL_ID]")
|
|
618
618
|
|
619
619
|
|
620
620
|
```ruby
|
621
|
-
Monkeylearn.extractors.list(
|
621
|
+
Monkeylearn.extractors.list(page: 1, per_page: 20, order_by: '-created')
|
622
622
|
```
|
623
623
|
|
624
624
|
Parameters:
|
@@ -627,10 +627,10 @@ Parameters:
|
|
627
627
|
|--------------------|-------------------|-------------------|-------------|
|
628
628
|
|*page* |`Integer` | `1` | Specifies which page to get.|
|
629
629
|
|*per_page* |`Integer` | `20` | Specifies how many items per page will be returned. |
|
630
|
-
|*order_by* |`String or Array` |`'-created'` | Specifies the ordering criteria. It
|
630
|
+
|*order_by* |`String or Array` |`'-created'` | Specifies the ordering criteria. It can either be a `String` for single criteria ordering or an array of `Strings` for more than one. Each `String` must be a valid field name; if you want inverse/descending order of the field prepend a `-` (dash) character. Some valid examples are: `'is_public'`, `'-name'` or `['-is_public', 'name']`. |
|
631
631
|
|
632
632
|
Example:
|
633
633
|
|
634
634
|
```ruby
|
635
|
-
response = Monkeylearn.extractors.list(page:
|
635
|
+
response = Monkeylearn.extractors.list(page: 2, per_page: 5, order_by: ['-is_public', 'name'])
|
636
636
|
```
|
data/lib/monkeylearn.rb
CHANGED
@@ -0,0 +1,125 @@
|
|
1
|
+
require 'monkeylearn/requests'
|
2
|
+
require 'monkeylearn/param_validation'
|
3
|
+
|
4
|
+
module Monkeylearn
|
5
|
+
class << self
|
6
|
+
def workflows
|
7
|
+
return Workflows
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Workflows
|
12
|
+
class << self
|
13
|
+
include Monkeylearn::Requests
|
14
|
+
|
15
|
+
def steps
|
16
|
+
return WorkflowSteps
|
17
|
+
end
|
18
|
+
|
19
|
+
def data
|
20
|
+
return WorkflowData
|
21
|
+
end
|
22
|
+
|
23
|
+
def metadata
|
24
|
+
return WorkflowMetadata
|
25
|
+
end
|
26
|
+
|
27
|
+
def build_endpoint(*args)
|
28
|
+
File.join('workflows', *args) + '/'
|
29
|
+
end
|
30
|
+
|
31
|
+
def create(name, options = {})
|
32
|
+
data = {
|
33
|
+
name: name,
|
34
|
+
description: options[:description],
|
35
|
+
db_name: options[:db_name],
|
36
|
+
webhook_url: options[:webhook_url],
|
37
|
+
steps: options[:steps],
|
38
|
+
metadata: options[:metadata],
|
39
|
+
sources: options[:sources],
|
40
|
+
actions: options[:actions],
|
41
|
+
}.delete_if { |k,v| v.nil? }
|
42
|
+
request(:post, build_endpoint, data)
|
43
|
+
end
|
44
|
+
|
45
|
+
def detail(module_id)
|
46
|
+
request(:get, build_endpoint(module_id))
|
47
|
+
end
|
48
|
+
|
49
|
+
def delete(module_id)
|
50
|
+
request(:delete, build_endpoint(module_id))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
module WorkflowSteps
|
56
|
+
class << self
|
57
|
+
include Monkeylearn::Requests
|
58
|
+
|
59
|
+
def build_endpoint(module_id, *args)
|
60
|
+
File.join('workflows', module_id, 'steps', *args.collect { |x| x.to_s }) + '/'
|
61
|
+
end
|
62
|
+
|
63
|
+
def create(module_id, options = {})
|
64
|
+
data = {
|
65
|
+
name: options[:name],
|
66
|
+
model_id: options[:step_model_id],
|
67
|
+
input_step: options[:input_step],
|
68
|
+
conditions: options[:conditions],
|
69
|
+
}.delete_if { |k,v| v.nil? }
|
70
|
+
request(:post, build_endpoint(module_id), data)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
module WorkflowMetadata
|
76
|
+
class << self
|
77
|
+
include Monkeylearn::Requests
|
78
|
+
|
79
|
+
def build_endpoint(module_id, *args)
|
80
|
+
File.join('workflows', module_id, 'metadata', *args.collect { |x| x.to_s }) + '/'
|
81
|
+
end
|
82
|
+
|
83
|
+
def create(module_id, options = {})
|
84
|
+
data = {
|
85
|
+
name: options[:name],
|
86
|
+
type: options[:data_type],
|
87
|
+
}.delete_if { |k,v| v.nil? }
|
88
|
+
request(:post, build_endpoint(module_id), data)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
module WorkflowData
|
94
|
+
class << self
|
95
|
+
include Monkeylearn::Requests
|
96
|
+
|
97
|
+
def build_endpoint(module_id, *args)
|
98
|
+
File.join('workflows', module_id, 'data', *args.collect { |x| x.to_s }) + '/'
|
99
|
+
end
|
100
|
+
|
101
|
+
def create(module_id, options = {})
|
102
|
+
data = {
|
103
|
+
data: options[:data],
|
104
|
+
}.delete_if { |k,v| v.nil? }
|
105
|
+
request(:post, build_endpoint(module_id), data)
|
106
|
+
end
|
107
|
+
|
108
|
+
def list(module_id, options = {})
|
109
|
+
data = {
|
110
|
+
batch_id: options[:batch_id],
|
111
|
+
is_processed: options[:is_processed],
|
112
|
+
sent_to_process_date_from: options[:sent_to_process_date_from],
|
113
|
+
sent_to_process_date_to: options[:sent_to_process_date_to],
|
114
|
+
}.delete_if { |k,v| v.nil? }
|
115
|
+
|
116
|
+
query_params = {
|
117
|
+
page: options[:page],
|
118
|
+
per_page: options[:per_page],
|
119
|
+
}.delete_if { |k,v| v.nil? }
|
120
|
+
|
121
|
+
request(:get, build_endpoint(module_id), data, query_params)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
data/monkeylearn.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['hello@monkeylearn.com']
|
11
11
|
spec.homepage = 'https://github.com/monkeylearn/monkeylearn-ruby'
|
12
12
|
|
13
|
-
spec.version = '3.
|
13
|
+
spec.version = '3.3.0'
|
14
14
|
|
15
15
|
spec.add_dependency 'faraday', '>= 0.9.2', '<= 0.15.0'
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monkeylearn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Monkeylearn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- lib/monkeylearn/param_validation.rb
|
48
48
|
- lib/monkeylearn/requests.rb
|
49
49
|
- lib/monkeylearn/response.rb
|
50
|
+
- lib/monkeylearn/workflows.rb
|
50
51
|
- monkeylearn.gemspec
|
51
52
|
homepage: https://github.com/monkeylearn/monkeylearn-ruby
|
52
53
|
licenses:
|