class Nsidc::ConfigInjectorClient
Public Class Methods
new(service_endpoint, environment = 'production')
click to toggle source
# File lib/nsidc/config_injector_client.rb, line 8 def initialize(service_endpoint, environment = 'production') environment = 'integration' if environment == 'development' if environment == 'production' @service_endpoint = service_endpoint else service_uri = URI.parse(service_endpoint) service_uri.host.prepend("#{environment}.") @service_endpoint = service_uri.to_s end end
Public Instance Methods
get(config_key)
click to toggle source
Server returns json response of key value pair, value is null if not found.
# File lib/nsidc/config_injector_client.rb, line 21 def get config_key response = RestClient.get config_route(config_key), { :accept => 'application/json' } JSON.parse(response)[config_key] end
put(config_key, new_val)
click to toggle source
# File lib/nsidc/config_injector_client.rb, line 26 def put config_key, new_val RestClient.put config_route(config_key), { :val => new_val }, { :accept => 'application/json' } end
Private Instance Methods
config_route(config_key)
click to toggle source
# File lib/nsidc/config_injector_client.rb, line 33 def config_route config_key RestClient::Resource.new('').concat_urls @service_endpoint, config_key end