Class: SFRest::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/sfrest/variable.rb

Overview

Perform actions against variables in the Factory

Instance Method Summary collapse

Constructor Details

#initialize(conn) ⇒ Variable

Returns a new instance of Variable.

Parameters:



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_listObject

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