Forum: Ruby on Rails activewebservice::struct

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ce5d17870f73dba7d01ad9c045d6a920?d=identicon&s=25 dizave (Guest)
on 2006-01-12 22:12
So I'm playing with AWS.  I've got a thing called a gallery.  I'd like
to return a list of them.  I can do this fine if I want to return my
ActiveRecord objects:

class WxApiApi < ActionWebService::API::Base
  api_method :list_galleries,
             :expects=>[{:login=>:string}],
             :returns => [[Gallery]]
end

But the ActiveRecord object exposes a lot more than I really want to
return via the web service.  So I'm told I should dervice something from
ActiveWebService::Struct, which I did:

class awsGallery < ActionWebService::Struct
   member :id, :int
end

I can't for the life of me get this to work.  I've called it
awsGallery.rb and stuck it in app/models.  I've changed the web service
accordingly:

class WxApiApi < ActionWebService::API::Base
  api_method :list_galleries,
             :expects=>[{:login=>:string}],
             :returns => [[awsGallery]]
end

I get various errors:

awsGallery is not a valid base type

Any idea what I'm doing wrong?

TIA,

dizave
2ccb2f7699267d258faaafce4ee997df?d=identicon&s=25 Cody Fauser (Guest)
on 2006-01-27 18:09
(Received via mailing list)
Dizave,

Class names in Ruby need to be constants (capitalized).  Also try
naming your file aws_gallery.rb.


class AwsGallery < ActionWebService::Struct
  member :id, :int
end

class WxApiApi < ActionWebService::API::Base
 api_method :list_galleries,
            :expects=>[{:login=>:string}],
            :returns => [[AwsGallery]]
end


On 1/12/06, dizave <dave@ferrance.com> wrote:
> But the ActiveRecord object exposes a lot more than I really want to
>
> Any idea what I'm doing wrong?
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Cody Fauser
http://www.codyfauser.com
This topic is locked and can not be replied to.