Module: Assistly::Client::Macro
- Included in:
- Assistly::Client
- Defined in:
- lib/assistly/client/macro.rb
Overview
Defines methods related to macros
Instance Method Summary collapse
-
#create_macro(name, *args) ⇒ Object
Creates a new macro.
-
#delete_macro(id) ⇒ Object
Deletes a single macro.
-
#macro(id) ⇒ Object
Returns extended information on a single macro.
-
#macro_action(id, slug) ⇒ Object
Returns extended information on a single macro.
-
#macro_actions(id, *args) ⇒ Object
Returns extended information of macros.
-
#macros(*args) ⇒ Object
Returns extended information of macros.
-
#update_macro(id, *args) ⇒ Object
Updates a single macro.
-
#update_macro_action(id, slug, *args) ⇒ Object
Updates a single macro action.
Instance Method Details
#create_macro(name, *args) ⇒ Object
Creates a new macro
@param name [String] A macro name @option options [Hash] @example Creates a new macro Assistly.create_macro("name") Assistly.create_macro("name")
45 46 47 48 49 50 51 52 53 |
# File 'lib/assistly/client/macro.rb', line 45 def create_macro(name, *args) = args.last.is_a?(Hash) ? args.pop : {} response = post("macros",) if response['success'] return response['results']['macro'] else return response end end |
#delete_macro(id) ⇒ Object
Deletes a single macro
@param id [Integer] a macro ID @example Deletes macro 12345 Assistly.update_macro(12345, :subject => "New Subject")
82 83 84 85 |
# File 'lib/assistly/client/macro.rb', line 82 def delete_macro(id) response = delete("macros/#{id}") response end |
#macro(id) ⇒ Object
Returns extended information on a single macro
@param id [Integer] a macro ID @option options [Hash] @example Return extended information for 12345 Assistly.macro(12345)
30 31 32 33 |
# File 'lib/assistly/client/macro.rb', line 30 def macro(id) response = get("macros/#{id}") response.macro end |
#macro_action(id, slug) ⇒ Object
Returns extended information on a single macro
@param id [Integer] a macro ID @option options [Hash] @example Return extended information for 12345 Assistly.macro_action(12345, "set-case-description")
116 117 118 119 |
# File 'lib/assistly/client/macro.rb', line 116 def macro_action(id, slug) response = get("macros/#{id}/actions/#{slug}") response['action'] end |
#macro_actions(id, *args) ⇒ Object
Returns extended information of macros
@option options [Boolean, String, Integer] @example Return extended information for 12345 Assistly.macro_actions(1) Assistly.macro_actions(1, :count => 5) Assistly.macro_actions(1, :count => 5, :page => 3)
101 102 103 104 105 |
# File 'lib/assistly/client/macro.rb', line 101 def macro_actions(id, *args) = args.last.is_a?(Hash) ? args.pop : {} response = get("macros/#{id}/actions",) response['results'] end |
#macros(*args) ⇒ Object
Returns extended information of macros
@option options [Boolean, String, Integer] @example Return extended information for 12345 Assistly.macros Assistly.macros(:count => 5) Assistly.macros(:count => 5, :page => 3)
15 16 17 18 19 |
# File 'lib/assistly/client/macro.rb', line 15 def macros(*args) = args.last.is_a?(Hash) ? args.pop : {} response = get("macros",) response end |
#update_macro(id, *args) ⇒ Object
Updates a single macro
@param id [Integer] a macro ID @option options [String] @example Updates information for macro 12345 Assistly.update_macro(12345, :subject => "New Subject")
64 65 66 67 68 69 70 71 72 |
# File 'lib/assistly/client/macro.rb', line 64 def update_macro(id, *args) = args.last.is_a?(Hash) ? args.pop : {} response = put("macros/#{id}",) if response['success'] return response['results']['macro'] else return response end end |
#update_macro_action(id, slug, *args) ⇒ Object
Updates a single macro action
@param id [Integer] a macro ID @option options [String] @example Updates information for macro 12345 Assistly.update_macro_action(12345, "set-case-description", :value => "New Subject")
130 131 132 133 134 135 136 137 138 |
# File 'lib/assistly/client/macro.rb', line 130 def update_macro_action(id, slug, *args) = args.last.is_a?(Hash) ? args.pop : {} response = put("macros/#{id}/actions/#{slug}",) if response['success'] return response['results']['action'] else return response end end |