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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50b2d5b17e20cfa4c508355318a6cf08dcf2f3e0
4
- data.tar.gz: 310360fa275dea689d86a46b8ddb1f88f4fdc9dc
3
+ metadata.gz: e5bb069bb982d494b3e56b4d624e267e68722ac9
4
+ data.tar.gz: 644741c1f4758eaa7794a656477de0d05944ff8a
5
5
  SHA512:
6
- metadata.gz: 4dc4c7abf0d7d07315af6586d963f65c551f2c26eb9c6e101c4dfad2f5bd004517cee94fc5761ef014f3eaa6a7ce766b6f14d26e23e778230cff561d4ce4b2fe
7
- data.tar.gz: 6783eb1b622f2b4ad8e4f32b767519e7443d6bc69d19701a8bb045438193c700a96fe377ddb93e95c6df5441b84958fbbf989d9d60ca56b35a271854ad732f37
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 must be a `String` with a valid field name, if you want inverse/descending order of the field prepend a `-` (dash) character. If you want to specify more than one field send an array of such `Strings`. Some valid examples: `is_public`, `'-name'` or `['-is_public', 'name']`. |
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: 1, per_page: 5, order_by: '-name')
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
- |marks | An optional *Array* of *String*. Each one represents a mark that will be associated with the text. New marks will be created if they don't already exist.|
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(options = {})
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 must be a `String` with a valid field name, if you want inverse/descending order of the field prepend a `-` (dash) character. If you want to specify more than one field send an array of such `Strings`. Some valid examples: `is_public`, `'-name'` or `['-is_public', 'name']`. |
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: 1, order_by: '-name')
635
+ response = Monkeylearn.extractors.list(page: 2, per_page: 5, order_by: ['-is_public', 'name'])
636
636
  ```
@@ -2,6 +2,7 @@ require 'monkeylearn/configurable'
2
2
  require 'monkeylearn/exceptions'
3
3
  require 'monkeylearn/classifiers'
4
4
  require 'monkeylearn/extractors'
5
+ require 'monkeylearn/workflows'
5
6
 
6
7
 
7
8
  module Monkeylearn
@@ -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
@@ -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.2.0'
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.2.0
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: 2018-07-30 00:00:00.000000000 Z
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: