Hi All,

I am using AWS to implement web service APIs in rails and i am using
Layered dispatching mode for implementation.

Here i am not getting how can i use controller's instance methods
(both user defined and built in) inside my API service.

As an example below take below things in consideration.

this is API signature.

class ProductApi < ActionWebService::API::Base

     api_method :find_all_products,
     :returns => [[:int]]

    api_method :find_product_by_id,
    :expects => [:int],
     :returns => [Product]
end

this is layered_backend controller.

class LayeredBackendController < ApplicationController

      dispatching_web_service_mode :layered
      web_service_scaffold :invoke
      web_service(:order) { OrderService.new }

      def test_method
         # some code
      end
end

this is order_service.rb file.

class OrderService< ActionWebService::Base
     web_service_api ProductApi

     def find_all_products
         Product.find(:all).map{ |product| product.id }
     end

     def find_product_by_id(id)
         Product.find(id)
     end
end


Now if i want to use my controller instance method named test_method
inside OrderServie then how can i use it ?

and also how to use controller built in instance methods (like
session, log_error etc )inside OrderService ?


Thanks in Advance.

Piyush.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to