Class: MachineShop::Rule

Inherits:
APIResource show all
Includes:
APIOperations::Create, APIOperations::Delete, APIOperations::List
Defined in:
lib/machineshop/rule.rb

Instance Attribute Summary

Attributes inherited from MachineShopObject

#auth_token

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Delete

#delete

Methods included from APIOperations::Create

included

Methods included from APIOperations::List

included

Methods inherited from APIResource

class_name, #refresh, retrieve, url, #url

Methods inherited from MachineShopObject

#[], #[]=, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from MachineShop::MachineShopObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MachineShop::MachineShopObject

Class Method Details

.get_by_device_instance(auth_token, id) ⇒ Object



42
43
44
45
# File 'lib/machineshop/rule.rb', line 42

def self.get_by_device_instance(auth_token,id)
  url = platform_url + "/rule/device_instance/#{id}"
  MachineShop.get(url, auth_token)
end

.get_comparison_rule_conditions(auth_token) ⇒ Object



32
33
34
35
# File 'lib/machineshop/rule.rb', line 32

def self.get_comparison_rule_conditions(auth_token)
  url = platform_url + "/rule/comparison_rule_conditions"
  MachineShop.get(url, auth_token)
end

.get_deleted(auth_token) ⇒ Object



37
38
39
40
# File 'lib/machineshop/rule.rb', line 37

def self.get_deleted(auth_token)
  url = platform_url + "/rules/deleted"
  MachineShop.get(url, auth_token)
end

.get_join_rule_conditions(auth_token) ⇒ Object

def get_rule(auth_token, id)

  url = platform_url + "/rule/#{id}"
  MachineShop.get(url, auth_token)
end


27
28
29
30
# File 'lib/machineshop/rule.rb', line 27

def self.get_join_rule_conditions(auth_token)
  url = platform_url + "/rule/join_rule_conditions"
  MachineShop.get(url, auth_token)
end

.platform_urlObject

# Specific API calls

def get_rules(auth_token)
  url = platform_url + "/rule"
  MachineShop.get(url,auth_token)
  #get url, auth_token
end


16
17
18
# File 'lib/machineshop/rule.rb', line 16

def self.platform_url
  '/platform'
end

Instance Method Details

#delete_rule(auth_token, id) ⇒ Object



52
53
54
55
# File 'lib/machineshop/rule.rb', line 52

def delete_rule(auth_token, id)
  url = platform_url + "/rule/#{id}"
  MachineShop.delete(url, auth_token)
end

#post_rule(auth_token, rule_hash) ⇒ Object



47
48
49
50
# File 'lib/machineshop/rule.rb', line 47

def post_rule(auth_token, rule_hash)
  url = platform_url + "/rule"
  MachineShop.post(url, auth_token, rule_hash)
end