Represents an API method and its associated metadata, and provides functionality to assist in commonly performed API method tasks.

Methods
Attributes
[R] expects
[R] name
[R] public_name
[R] returns
Public Class methods
new(name, public_name, expects, returns)
     # File vendor/rails/actionwebservice/lib/action_web_service/api.rb, line 164
164:       def initialize(name, public_name, expects, returns)
165:         @name = name
166:         @public_name = public_name
167:         @expects = expects
168:         @returns = returns
169:         @caster = ActionWebService::Casting::BaseCaster.new(self)
170:       end
Public Instance methods
[](sig_type)

Backwards compatibility with previous API

     # File vendor/rails/actionwebservice/lib/action_web_service/api.rb, line 208
208:       def [](sig_type)
209:         case sig_type
210:         when :expects
211:           @expects.map{|x| compat_signature_entry(x)}
212:         when :returns
213:           @returns.map{|x| compat_signature_entry(x)}
214:         end
215:       end
cast_expects(params)

Casts a set of Ruby values into the expected Ruby values

     # File vendor/rails/actionwebservice/lib/action_web_service/api.rb, line 179
179:       def cast_expects(params)
180:         @caster.cast_expects(params)
181:       end
cast_returns(return_value)

Cast a Ruby return value into the expected Ruby value

     # File vendor/rails/actionwebservice/lib/action_web_service/api.rb, line 184
184:       def cast_returns(return_value)
185:         @caster.cast_returns(return_value)
186:       end
expects_index_of(param_name)

Returns the index of the first expected parameter with the given name

     # File vendor/rails/actionwebservice/lib/action_web_service/api.rb, line 190
190:       def expects_index_of(param_name)
191:         return -1 if @expects.nil?
192:         (0..(@expects.length-1)).each do |i|
193:           return i if @expects[i].name.to_s == param_name.to_s
194:         end
195:         -1
196:       end
expects_to_hash(params)

Returns a hash keyed by parameter name for the given parameter list

     # File vendor/rails/actionwebservice/lib/action_web_service/api.rb, line 200
200:       def expects_to_hash(params)
201:         return {} if @expects.nil?
202:         h = {}
203:         @expects.zip(params){ |type, param| h[type.name] = param }
204:         h
205:       end
param_names()

The list of parameter names for this method

     # File vendor/rails/actionwebservice/lib/action_web_service/api.rb, line 173
173:       def param_names
174:         return [] unless @expects
175:         @expects.map{ |type| type.name }
176:       end
to_s()

String representation of this method

     # File vendor/rails/actionwebservice/lib/action_web_service/api.rb, line 218
218:       def to_s
219:         fqn = ""
220:         fqn << (@returns ? (friendly_param(@returns[0], false) + " ") : "void ")
221:         fqn << "#{@public_name}("
222:         fqn << @expects.map{ |p| friendly_param(p) }.join(", ") if @expects
223:         fqn << ")"
224:         fqn
225:       end