A
Alex Gd
Hi there,
just getting to know the language by writing console twitter client, I'm
getting this error:
ArgumentError: wrong number of arguments (1 for 0)
from ./twitter_client.rb:7:in `initialize'
from ./twitter_client.rb:7:in `new'
from ./twitter_client.rb:7
from (irb):1:in `require'
from (irb):1
When trying to load the code below.
class TwitterMethod
Statuses = TwitterMethod.new("statuses/show")
attr_reader :credentials
attr_writer :credentials
TwitterHome = "http://www.twitter.com/"
def initialize(methodLocation)
@methodUrlString = methodLocation
end
public
def call()
response
Net::HTTP.start(TwitterHome).start{|http|
request = Net::HTTP::Get.new(@methodUrlString)
@credentials.sign(request)
response = http.request(request)
}
return JSON.parse(response)
end
end
I can't work out what is going wrong here, I am guessing that its
something to do with the class not being initialized by the time I call
TwitterMethod.new to set the class constant. I also don't know if this
is a particularly rubyish way to do this, please let me know if theres a
better way.
Cheers
Alex
just getting to know the language by writing console twitter client, I'm
getting this error:
ArgumentError: wrong number of arguments (1 for 0)
from ./twitter_client.rb:7:in `initialize'
from ./twitter_client.rb:7:in `new'
from ./twitter_client.rb:7
from (irb):1:in `require'
from (irb):1
When trying to load the code below.
class TwitterMethod
Statuses = TwitterMethod.new("statuses/show")
attr_reader :credentials
attr_writer :credentials
TwitterHome = "http://www.twitter.com/"
def initialize(methodLocation)
@methodUrlString = methodLocation
end
public
def call()
response
Net::HTTP.start(TwitterHome).start{|http|
request = Net::HTTP::Get.new(@methodUrlString)
@credentials.sign(request)
response = http.request(request)
}
return JSON.parse(response)
end
end
I can't work out what is going wrong here, I am guessing that its
something to do with the class not being initialized by the time I call
TwitterMethod.new to set the class constant. I also don't know if this
is a particularly rubyish way to do this, please let me know if theres a
better way.
Cheers
Alex