class PredicsisMlSdk::Dictionary

Attributes

id[RW]

Public Class Methods

all(token = bearer_token) click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 15
def self.all(token = bearer_token)
  data = Requests.get_dictionaries(token)
  data.each_with_object([]) do |e, a|
    a << new(e['id'], token).tap do |resource|
      resource.send(:define_attributes, e)
    end
  end
end
create(params = {}, token = bearer_token) click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 8
def self.create(params = {}, token = bearer_token)
  data = Requests.post_dictionary(token, params)
  new(data['id'], token).tap do |dictionary|
    dictionary.define_attributes(data)
  end
end
delete(id, token = bearer_token) click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 32
def self.delete(id, token = bearer_token)
  new(id, token).delete
end
get(id, token = bearer_token) click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 24
def self.get(id, token = bearer_token)
  new(id, token).get
end
new(id, token = bearer_token) click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 36
def initialize(id, token = bearer_token)
  @token = token
  @id = id
end
update(id, params = {}, token = bearer_token) click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 28
def self.update(id, params = {}, token = bearer_token)
  new(id, token).update(params)
end

Public Instance Methods

delete() click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 53
def delete
  Requests.delete_dictionary(token, id)
  self
end
get() click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 41
def get
  data = Requests.get_dictionary(token, id)
  define_attributes(data)
  self
end
update(params = {}) click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 47
def update(params = {})
  data = Requests.patch_dictionary(token, id, params)
  define_attributes(data)
  self
end
variables() click to toggle source
# File lib/predicsis_ml_sdk/dictionary.rb, line 58
def variables
  Variable.all(id, token)
end