libcurl-4.dll not found when running rspec spec/client_spec.rb

164 views
Skip to first unread message

adp

unread,
Mar 25, 2011, 7:08:18 PM3/25/11
to Service Oriented Design With Ruby
Hi,

When I ran the rspec spec/client_spec.rb, i got a pop-up window
"ruby.exe - Unable to Locate Component" with a message "This
application has failed to start because libcul-4.dll was not found".

Would someone please give me an advice on how to fix this problem?

Thanks.

Paul Dix

unread,
Mar 28, 2011, 10:18:22 AM3/28/11
to service-oriented...@googlegroups.com
That's because the client is using the Typhoeus library (which depends
on libcurl) for making requests. Not sure how that installs on
Windows. You can either email that list and ask
(http://groups.google.com/group/typhoeus) or you can update the code
to use regular Net::HTTP. If you're still having trouble with it I can
probably whip up an example real quick.

Best,
Paul

> --
> You received this message because you are subscribed to the Google Groups "Service Oriented Design With Ruby" group.
> To post to this group, send email to service-oriented...@googlegroups.com.
> To unsubscribe from this group, send email to service-oriented-desig...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/service-oriented-design-with-ruby?hl=en.
>
>

adp

unread,
Mar 29, 2011, 2:31:48 PM3/29/11
to Service Oriented Design With Ruby
Hi Paul,

Thanks for your quick reply. I am sorry to bother you since ruby and
rails are very new to me.

Since Typhoeus does not work on my windows :-(, I need help on
Net::HTTP.

If you have time, would you please write examples using Net::HTTP to
replace the Typhoeus::Request for POST and GET user (Your book: page
20 User.find and page 22 User.create)?

Thanks so much.

Trotter Cashion

unread,
Mar 29, 2011, 2:37:48 PM3/29/11
to service-oriented...@googlegroups.com, adp
Apparently Yehuda Katz (@wycats) is working on a version of Net::HTTP that makes it easier to execute requests in parallel. So if you're stuck w/ Net::HTTP, it may be worth pinging him to figure out how to play with that version.

- Trotter

adp

unread,
Mar 29, 2011, 7:53:20 PM3/29/11
to Service Oriented Design With Ruby
Hi Paul & Trotter,

I just want to let you know that I was able to run the client_spec.rb
using Net::HTTP.

I just want to share the client_spec.rb code with others. Thank you
both for your help. I am looking forward to next few chapters of the
book.

-Catherine

### client_spec.rb
require 'rubygems'
require 'bundler/setup'
require 'net/http'
require 'json'

class User
class << self; attr_accessor :base_uri end

def self.find_by_name(name)

url = URI.parse("#{base_uri}/api/v1/users/#{name}")
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
if res.code.to_i == 200
JSON.parse(res.body)["user"]
elsif res.code.to_i == 404
nil
else
raise res.body
end
end

def self.create(attributes = {})
url = URI.parse("#{base_uri}/api/v1/users")
req = Net::HTTP::Post.new(url.path)
req.body = attributes.to_json
res = Net::HTTP.new(url.host, url.port).start {|http|
http.request(req) }
case res
when Net::HTTPSuccess, Net::HTTPRedirection
JSON.parse(res.body)["user"]
else
raise res.body
end
end
end
Reply all
Reply to author
Forward
0 new messages