Class: SFRest::Variable
- Inherits:
-
Object
- Object
- SFRest::Variable
- Defined in:
- lib/sfrest/variable.rb
Overview
Perform actions against variables in the Factory
Instance Method Summary collapse
-
#get_variable(name) ⇒ Object
Gets the value of a specific variable.
-
#initialize(conn) ⇒ Variable
constructor
A new instance of Variable.
-
#set_variable(name, value) ⇒ Object
Sets the key and value of a variable.
-
#variable_list ⇒ Object
Gets the list of variables.
Constructor Details
#initialize(conn) ⇒ Variable
Returns a new instance of Variable.
5 6 7 |
# File 'lib/sfrest/variable.rb', line 5 def initialize(conn) @conn = conn end |
Instance Method Details
#get_variable(name) ⇒ Object
Gets the value of a specific variable.
16 17 18 19 |
# File 'lib/sfrest/variable.rb', line 16 def get_variable(name) current_path = '/api/v1/variables?name=' << name @conn.get(current_path) end |
#set_variable(name, value) ⇒ Object
Sets the key and value of a variable.
22 23 24 25 26 |
# File 'lib/sfrest/variable.rb', line 22 def set_variable(name, value) current_path = '/api/v1/variables' payload = { 'name' => name, 'value' => value }.to_json @conn.put(current_path, payload) end |
#variable_list ⇒ Object
Gets the list of variables.
10 11 12 13 |
# File 'lib/sfrest/variable.rb', line 10 def variable_list current_path = '/api/v1/variables' @conn.get(current_path) end |