lib/rocketfuel_api/service.rb in rocketfuel_api-0.1.2 vs lib/rocketfuel_api/service.rb in rocketfuel_api-0.1.3
- old
+ new
@@ -18,12 +18,14 @@
str.gsub(/(.)([A-Z])/, '\1_\2').downcase
end
end
def uri_suffix
- file_path = RocketfuelApi.root.join('lib', 'config', 'endpoints_for_services.yaml')
- endpoints = YAML.load_file(file_path)
- endpoint = endpoints['service'][name]
+ @endpoints ||= YAML.load_file(
+ RocketfuelApi.root.join('lib', 'config', 'endpoints_for_services.yaml')
+ )
+
+ endpoint = @endpoints['service'][name]
endpoint || raise(RocketfuelApi::NotImplemented,
format('No endpoint for service %s available.', name))
end