M
Michael Boutros
Hello everyone, I'm working on an API for Google Reader, and I'm having
some trouble with classes and inheritance and the like. I've got my main
class, Reader, and then two children classes, Subscription < Reader and
Item < Reader. Now, in my instance of Reader, I have two class variables
set: @headers, which are the headers that are to always be included in
the Net::HTTP call, and @connection, the Net::HTTP instance that is
connected to the Google Reader API.
I then have a method called get_page in Reader, which takes a URL and
any custom headers, then does the call. All this works perfectly well,
when #get_page is called from Reader. However, I also want to call
get_page from Subscription and Item. However, understandably, when I
call it from Subscription, I get an error that @connection and @headers
are undefined. I don't know where to start or what to do.
Any ideas?
Thanks,
Michael Boutros
some trouble with classes and inheritance and the like. I've got my main
class, Reader, and then two children classes, Subscription < Reader and
Item < Reader. Now, in my instance of Reader, I have two class variables
set: @headers, which are the headers that are to always be included in
the Net::HTTP call, and @connection, the Net::HTTP instance that is
connected to the Google Reader API.
I then have a method called get_page in Reader, which takes a URL and
any custom headers, then does the call. All this works perfectly well,
when #get_page is called from Reader. However, I also want to call
get_page from Subscription and Item. However, understandably, when I
call it from Subscription, I get an error that @connection and @headers
are undefined. I don't know where to start or what to do.
Any ideas?
Thanks,
Michael Boutros