Class: PredicsisMlSdk::Variable
- Inherits:
-
Object
- Object
- PredicsisMlSdk::Variable
show all
- Includes:
- Util
- Defined in:
- lib/predicsis_ml_sdk/variable.rb
Instance Attribute Summary collapse
Attributes included from Util
#token
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Util
#bearer_token, #define_attributes, included, #with_captured_console
Constructor Details
#initialize(dictionary_id, id, token = bearer_token) ⇒ Variable
Returns a new instance of Variable.
23
24
25
26
27
|
# File 'lib/predicsis_ml_sdk/variable.rb', line 23
def initialize(dictionary_id, id, token = bearer_token)
@dictionary_id = dictionary_id
@id = id
@token = token
end
|
Instance Attribute Details
#dictionary_id ⇒ Object
Returns the value of attribute dictionary_id.
4
5
6
|
# File 'lib/predicsis_ml_sdk/variable.rb', line 4
def dictionary_id
@dictionary_id
end
|
#id ⇒ Object
Returns the value of attribute id.
4
5
6
|
# File 'lib/predicsis_ml_sdk/variable.rb', line 4
def id
@id
end
|
Class Method Details
.all(dictionary_id, token = bearer_token) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/predicsis_ml_sdk/variable.rb', line 14
def self.all(dictionary_id, token = bearer_token)
data = Requests.get_variables(token, dictionary_id)
data.each_with_object([]) do |e, a|
a << new(dictionary_id, e['id'], token).tap do |variable|
variable.send(:define_attributes, e)
end
end
end
|
.get(dictionary_id, id, token = bearer_token) ⇒ Object
6
7
8
|
# File 'lib/predicsis_ml_sdk/variable.rb', line 6
def self.get(dictionary_id, id, token = bearer_token)
new(dictionary_id, id, token).get
end
|
.update(dictionary_id, id, params = {}, token = bearer_token) ⇒ Object
10
11
12
|
# File 'lib/predicsis_ml_sdk/variable.rb', line 10
def self.update(dictionary_id, id, params = {}, token = bearer_token)
new(dictionary_id, id, token).update(params)
end
|
Instance Method Details
#get ⇒ Object
29
30
31
32
33
|
# File 'lib/predicsis_ml_sdk/variable.rb', line 29
def get
data = Requests.get_variable(token, id, dictionary_id)
define_attributes(data)
self
end
|
#update(params = {}) ⇒ Object
35
36
37
38
39
|
# File 'lib/predicsis_ml_sdk/variable.rb', line 35
def update(params = {})
data = Requests.patch_variable(token, id, dictionary_id, params)
define_attributes(data)
self
end
|