Class: NinjaBlocks::Rule

Inherits:
Base
  • Object
show all
Defined in:
lib/ninja_blocks/rule.rb

Instance Method Summary collapse

Methods inherited from Base

#connection, #delete, #execute, #get, #post, #put, #put_json, #token

Instance Method Details

#create(rule, json) ⇒ Object



8
9
10
11
# File 'lib/ninja_blocks/rule.rb', line 8

def create(rule, json)
  # create rule
  post("https://api.ninja.is/rest/v0/rule", json)
end

#destroy(rid) ⇒ Object



22
23
24
25
# File 'lib/ninja_blocks/rule.rb', line 22

def destroy(rid)
  # delete a rule
  delete("https://api.ninja.is/rest/v0/rule/#{rid}")
end

#fetch(rid) ⇒ Object



13
14
15
# File 'lib/ninja_blocks/rule.rb', line 13

def fetch(rid)
  get("https://api.ninja.is/rest/v0/rule/#{rid}")
end

#listObject



4
5
6
# File 'lib/ninja_blocks/rule.rb', line 4

def list
  get('https://api.ninja.is/rest/v0/rule')
end

#suspend(rid) ⇒ Object



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

def suspend(rid)
  # suspend a rule
  post("https://api.ninja.is/rest/v0/rule/#{rid}/suspend")
  
end

#unsuspend(rid) ⇒ Object



33
34
35
36
# File 'lib/ninja_blocks/rule.rb', line 33

def unsuspend(rid)
  # unsuspend a rule
  delete("https://api.ninja.is/rest/v0/rule/#{rid}/suspend")
end

#update(rid, json) ⇒ Object



17
18
19
20
# File 'lib/ninja_blocks/rule.rb', line 17

def update(rid, json)
  # update a rule
  put("https://api.ninja.is/rest/v0/rule/#{rid}")
end