Module: HoverflyAPI

Includes:
HTTParty
Included in:
Hoverfly
Defined in:
lib/endpoints.rb

Instance Method Summary collapse

Instance Method Details

#clear_cached_dataObject



60
61
62
# File 'lib/endpoints.rb', line 60

def clear_cached_data
  HoverflyAPI.delete('/api/v2/cache').response.body
end

#get_cached_dataObject



56
57
58
# File 'lib/endpoints.rb', line 56

def get_cached_data
  HoverflyAPI.get('/api/v2/cache').response.body
end

#get_config_infoObject



16
17
18
# File 'lib/endpoints.rb', line 16

def get_config_info
  HoverflyAPI.get('/api/v2/hoverfly').response.body
end

#get_current_destinationObject



20
21
22
# File 'lib/endpoints.rb', line 20

def get_current_destination
  HoverflyAPI.get('/api/v2/hoverfly/destination').response.body
end

#get_current_middlewareObject



28
29
30
# File 'lib/endpoints.rb', line 28

def get_current_middleware
  HoverflyAPI.get('/api/v2/hoverfly/middleware').response.body
end

#get_current_modeObject



36
37
38
# File 'lib/endpoints.rb', line 36

def get_current_mode
  HoverflyAPI.get('/api/v2/hoverfly/mode').response.body
end

#get_current_simulation_schemaObject



12
13
14
# File 'lib/endpoints.rb', line 12

def get_current_simulation_schema
  HoverflyAPI.get('/api/v2/simulation/schema').response.body
end

#get_current_simulationsObject



4
5
6
# File 'lib/endpoints.rb', line 4

def get_current_simulations
  HoverflyAPI.get('/api/v2/simulation').response.body
end

#get_logsObject



64
65
66
# File 'lib/endpoints.rb', line 64

def get_logs
  HoverflyAPI.get('/api/v2/logs').response.body
end

#get_upstream_proxyObject



52
53
54
# File 'lib/endpoints.rb', line 52

def get_upstream_proxy
  HoverflyAPI.get('/api/v2/hoverfly/upstream-proxy').response.body
end

#get_usageObject



44
45
46
# File 'lib/endpoints.rb', line 44

def get_usage
  HoverflyAPI.get('/api/v2/hoverfly/usage').response.body
end

#get_versionObject



48
49
50
# File 'lib/endpoints.rb', line 48

def get_version
  HoverflyAPI.get('/api/v2/hoverfly/version').response.body
end

#update_destination(destination) ⇒ Object



24
25
26
# File 'lib/endpoints.rb', line 24

def update_destination(destination)
  HoverflyAPI.put('/api/v2/hoverfly/destination', headers: { 'Content-Type' => 'application/json' }, body: { destination: destination }.to_json).response.body
end

#update_middleware(middleware_request) ⇒ Object



32
33
34
# File 'lib/endpoints.rb', line 32

def update_middleware(middleware_request)
  HoverflyAPI.put('/api/v2/hoverfly/middleware', headers: { 'Content-Type' => 'application/json' }, body: middleware_request.to_json).response.body
end

#update_mode(mode) ⇒ Object



40
41
42
# File 'lib/endpoints.rb', line 40

def update_mode(mode)
  HoverflyAPI.put('/api/v2/hoverfly/mode', headers: { 'Content-Type' => 'application/json' }, body: { mode: mode }.to_json).response.body
end

#update_simulations(simulation) ⇒ Object



8
9
10
# File 'lib/endpoints.rb', line 8

def update_simulations(simulation)
  HoverflyAPI.put('/api/v2/simulation', headers: { 'Content-Type' => 'application/json' }, body: simulation).response.body
end