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:



7
8
9
# File 'lib/sfrest/variable.rb', line 7

def initialize(conn)
  @conn = conn
end

Instance Method Details

#get_variable(name) ⇒ Object

Gets the value of a specific variable.



18
19
20
21
# File 'lib/sfrest/variable.rb', line 18

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.



24
25
26
27
28
# File 'lib/sfrest/variable.rb', line 24

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.



12
13
14
15
# File 'lib/sfrest/variable.rb', line 12

def variable_list
  current_path = '/api/v1/variables'
  @conn.get(current_path)
end