Module: Giraffi::Client::Triggers
- Included in:
- Giraffi::Client
- Defined in:
- lib/giraffi/client/triggers.rb
Overview
Defines methods related to the triggers
Instance Method Summary collapse
-
#destroy_trigger(id) ⇒ HTTParty::Response
Deletes the trigger.
-
#execute_axions_by_trigger(id) ⇒ HTTParty::Response
Executes all axions related to the desired trigger.
-
#find_axions_by_trigger(*args) ⇒ HTTParty::Response
Returns all axions related to the desired trigger.
-
#find_trigger(id) ⇒ HTTParty::Response
Returns the desired trigger.
-
#find_triggers(options = {}) ⇒ HTTParty::Response
Returns the desired trigger.
-
#remove_axion_from_trigger(*args) ⇒ HTTParty::Response
Removes an axion from the trigger.
-
#update_axion_of_trigger(*args) ⇒ HTTParty::Response
Updates the axion related to the desired trigger.
-
#update_trigger(id, options = {}) ⇒ HTTParty::Response
Updates the desired trigger.
Instance Method Details
#destroy_trigger(id) ⇒ HTTParty::Response
Deletes the trigger
77 78 79 |
# File 'lib/giraffi/client/triggers.rb', line 77 def destroy_trigger(id) self.class.delete("/triggers/#{id}.json?apikey=#{apikey}") end |
#execute_axions_by_trigger(id) ⇒ HTTParty::Response
Executes all axions related to the desired trigger
45 46 47 |
# File 'lib/giraffi/client/triggers.rb', line 45 def execute_axions_by_trigger(id) self.class.post("/triggers/#{id}/axions/execute.json?apikey=#{apikey}") end |
#find_axions_by_trigger(*args) ⇒ HTTParty::Response
Returns all axions related to the desired trigger
31 32 33 34 35 36 37 38 |
# File 'lib/giraffi/client/triggers.rb', line 31 def find_axions_by_trigger(*args) raise ArgumentError.new('The method `find_axions_by_trigger` requires at least a trigger id.') if args.size.zero? if args.size == 1 self.class.get("/triggers/#{args[0]}/axions.json?apikey=#{apikey}") else self.class.get("/triggers/#{args[0]}/axions.json?apikey=#{apikey}", :query => {:axionkind => args[-1]}) end end |
#find_trigger(id) ⇒ HTTParty::Response
Returns the desired trigger
20 21 22 |
# File 'lib/giraffi/client/triggers.rb', line 20 def find_trigger(id) self.class.get("/triggers/#{id}.json?apikey=#{apikey}") end |
#find_triggers(options = {}) ⇒ HTTParty::Response
Returns the desired trigger
11 12 13 |
# File 'lib/giraffi/client/triggers.rb', line 11 def find_triggers(={}) self.class.get("/triggers.json?apikey=#{apikey}", :query => ) end |
#remove_axion_from_trigger(*args) ⇒ HTTParty::Response
Removes an axion from the trigger
88 89 90 91 |
# File 'lib/giraffi/client/triggers.rb', line 88 def remove_axion_from_trigger(*args) raise ArgumentError.new('The method `remove_axion_from_trigger` requires 2 arguments (trigger-id and axion-id)') if args.size != 2 self.class.delete("/triggers/#{args[0]}/axions/#{args[-1]}.json?apikey=#{apikey}") end |
#update_axion_of_trigger(*args) ⇒ HTTParty::Response
Updates the axion related to the desired trigger
67 68 69 70 |
# File 'lib/giraffi/client/triggers.rb', line 67 def update_axion_of_trigger(*args) raise ArgumentError.new('The method `update_axion_by_trigger` requires 3 argments (trigger-id, axion-id and axion-kind)') if args.size != 3 self.class.put("/triggers/#{args[0]}/axions/#{args[1]}.json?apikey=#{apikey}", :query => { :axionkind => args[-1] }, :body => {}) end |
#update_trigger(id, options = {}) ⇒ HTTParty::Response
Updates the desired trigger
55 56 57 |
# File 'lib/giraffi/client/triggers.rb', line 55 def update_trigger(id, ={}) self.class.put("/triggers/#{id}.json?apikey=#{apikey}", :query => {:trigger => }, :body => {}) end |