Module: Restful

Defined in:
lib/restful.rb,
lib/restful/version.rb,
lib/restful/serializer.rb,
lib/restful/configuration.rb

Overview

This file is part of restful_serializer. Copyright 2011 Joshua Partlow. This is free software, see the LICENSE file for details.

Defined Under Namespace

Modules: Configuration, Extensions Classes: Association, DeepHash, Serializer, Url, UrlFactory

Constant Summary collapse

VERSION =
"0.1.5"

Class Method Summary collapse

Class Method Details

.clearObject



149
150
151
152
# File 'lib/restful.rb', line 149

def clear
  self.default_url_options = {}
  self.registered_web_services = {}
end

.register_web_service(name, options = {}, &block) ⇒ Object

Configured the specified web service.



130
131
132
133
# File 'lib/restful.rb', line 130

def register_web_service(name, options = {}, &block)
  @@registered_web_services[symbolized_web_service_name(name)] = new_ws = Restful::Configuration::WebService.register(name, options, &block)
  return new_ws
end

.symbolized_web_service_name(name) ⇒ Object



144
145
146
147
# File 'lib/restful.rb', line 144

def symbolized_web_service_name(name)
  return if name.nil?
  name.to_s.downcase.gsub(/[^\w]+/,'_').to_sym
end

.web_service_configuration(key) ⇒ Object

Retrieve configuration for the specified web service.



136
137
138
139
140
141
142
# File 'lib/restful.rb', line 136

def web_service_configuration(key)
  ws = @@registered_web_services[symbolized_web_service_name(key)]
  if ws.default_url_options.empty? && !default_url_options.empty?
    ws.default_url_options = default_url_options.dup
  end if ws
  return ws
end