class Hoverfly
Attributes
admin_port[R]
proxy_port[R]
Public Class Methods
import(file_list, meta = {})
click to toggle source
# File lib/client.rb, line 19 def import(file_list, meta = {}) update_simulations(to_simulation(file_list, meta)) end
middleware(middleware_location)
click to toggle source
# File lib/client.rb, line 15 def middleware(middleware_location) update_middleware({ binary: '', script: '', remote: '' }.merge(middleware_location)) end
set_ports(admin:, proxy:, ip: 'localhost')
click to toggle source
# File lib/client.rb, line 7 def set_ports(admin:, proxy:, ip: 'localhost') @admin_port = admin @proxy_port = proxy HoverflyAPI.default_options.update(verify: false) HoverflyAPI.format :json HoverflyAPI.base_uri "http://#{ip}:#{@admin_port}" end
Private Class Methods
erb(template)
click to toggle source
# File lib/client.rb, line 31 def erb(template) ERB.new(template).result(binding) end
to_simulation(file_list, meta)
click to toggle source
# File lib/client.rb, line 25 def to_simulation(file_list, meta) schema_path = meta[:schema] || File.expand_path('schema_metadata/schema.json.erb', __dir__) all_simulations = file_list.map { |filename| File.read(filename) } erb(File.read(schema_path)) { all_simulations.join(',') } end