Class: Clarinet::Inputs
- Inherits:
-
Object
- Object
- Clarinet::Inputs
- Extended by:
- Forwardable
- Defined in:
- lib/clarinet/inputs.rb
Instance Method Summary collapse
- #[] ⇒ Clarinet::Model
-
#create(inputs) ⇒ Clarinet::Inputs
Adds an input or multiple inputs.
-
#delete(id) ⇒ Hash
Delete an input or a list of inputs by id.
-
#delete_all ⇒ Hash
Delete all inputs.
- #delete_concepts(inputs) ⇒ Object
- #each ⇒ Object
- #find ⇒ Object
-
#get(id) ⇒ Clarinet::Input
Get input by id.
-
#list(options = { page: 1, per_page: 20 }) ⇒ Clarinet::Inputs
Get all inputs in app.
- #map ⇒ Object
- #merge_concepts(inputs) ⇒ Object
- #overwrite_concepts(inputs) ⇒ Object
- #select ⇒ Object
-
#status ⇒ Hash
Get inputs status (number of uploaded, in process or failed inputs).
Instance Method Details
#[] ⇒ Clarinet::Model
20 |
# File 'lib/clarinet/inputs.rb', line 20 delegate [:[], :each, :map, :find, :select, :reject] => :@inputs |
#create(inputs) ⇒ Clarinet::Inputs
Adds an input or multiple inputs
35 36 37 38 39 40 41 |
# File 'lib/clarinet/inputs.rb', line 35 def create(inputs) inputs = [inputs] unless inputs.is_a? Array inputs = inputs.map { |input| Clarinet::Utils.format_input(input) } data = @app.client.inputs_create inputs Clarinet::Inputs.new data[:inputs] end |
#delete(id) ⇒ Hash
Delete an input or a list of inputs by id
45 46 47 48 |
# File 'lib/clarinet/inputs.rb', line 45 def delete(id) @app.client.input_delete id if id.is_a? String @app.client.inputs_delete id if id.is_a? Array end |
#delete_all ⇒ Hash
Delete all inputs
52 53 54 |
# File 'lib/clarinet/inputs.rb', line 52 def delete_all @app.client.inputs_delete_all end |
#delete_concepts(inputs) ⇒ Object
88 89 90 |
# File 'lib/clarinet/inputs.rb', line 88 def delete_concepts(inputs) update 'remove', inputs end |
#each ⇒ Object
20 |
# File 'lib/clarinet/inputs.rb', line 20 delegate [:[], :each, :map, :find, :select, :reject] => :@inputs |
#find ⇒ Object
20 |
# File 'lib/clarinet/inputs.rb', line 20 delegate [:[], :each, :map, :find, :select, :reject] => :@inputs |
#get(id) ⇒ Clarinet::Input
Get input by id
69 70 71 72 |
# File 'lib/clarinet/inputs.rb', line 69 def get(id) data = @app.client.input id Clarinet::Input.new @app, data[:input] end |
#list(options = { page: 1, per_page: 20 }) ⇒ Clarinet::Inputs
Get all inputs in app
61 62 63 64 |
# File 'lib/clarinet/inputs.rb', line 61 def list( = { page: 1, per_page: 20 }) data = @app.client.inputs Clarinet::Inputs.new @app, data[:inputs] end |
#map ⇒ Object
20 |
# File 'lib/clarinet/inputs.rb', line 20 delegate [:[], :each, :map, :find, :select, :reject] => :@inputs |
#merge_concepts(inputs) ⇒ Object
80 81 82 |
# File 'lib/clarinet/inputs.rb', line 80 def merge_concepts(inputs) update 'merge', inputs end |
#overwrite_concepts(inputs) ⇒ Object
84 85 86 |
# File 'lib/clarinet/inputs.rb', line 84 def overwrite_concepts(inputs) update 'overwrite', inputs end |
#select ⇒ Object
20 |
# File 'lib/clarinet/inputs.rb', line 20 delegate [:[], :each, :map, :find, :select, :reject] => :@inputs |
#status ⇒ Hash
Get inputs status (number of uploaded, in process or failed inputs)
76 77 78 |
# File 'lib/clarinet/inputs.rb', line 76 def status @app.client.inputs_status end |