Exact Target integration with Ruby examples? - ruby

Anyone used Ruby or Rails to integrate with Exact Target's API or have a good example of using WSSE with SOAP4r?

http://github.com/sbraford/rbet

I've recently released an open source Ruby on Rails web service library that ties into the ExactTarget SOAP API. It covers most of the major objects and methods, with less used usages being rolled out in subsequent releases.
I hope this helps:
http://bit.ly/a6uOZy

Related

What gem should I use to work with AWS

I'm currently writing an application in ruby on rails that uses AWS. I see two options for gems, aws-sdk and fog. Fog seems to support almost all of the AWS services except for sns(which I wanted to use :/) and has mock services for testing not to mention you can change out for rackspace or a different provider rather easily. Is there any big reason why I should use AWS's sdk? It supports sns, but not rds and does not come with mocking.
If I'm missing something please let me know as I am new to this.
Thanks in advance.
You may also want to checkout rightaws though unfortunately it doesn't have support for sns either. It was one of the first libraries available and provides support for most of the functionalities. However, fog is releasing new versions more often and is catching up quickly and is a bit more high level. The aws_sdk was only released recently and the main reason to go with it is that it comes from Amazon itself and will likely become the standard. This is why we included it in rubystack. We expect that people will provide higher level libraries that will build on top of it.
aws-sdk supports SNS but does not mock the services. It does hoever provide basic stubbing:
AWS.stub!
This causes all service requests to "do nothing" and return "empty responses". It is used extensively inside the specs provided with the gem. This is is not the same as mocking a service but it can be a useful testing aid.

A website using Ruby alone

I want to write a web application and want to use Ruby. I have no knowledge of Ruby as of now and I want to write this app. to learn Ruby.
Is Ruby alone sufficient to write a web application or Rails need to be included?
You sound like you're interested in writing something in a barebones fashion.
For that then the Sinatra framework might be more approachable.
You could also use Heroku's service to make the deployment and hosting of your web application simple. I can't overstate how slick Heroku is - it's a masterclass in design and user experience!
The only thing you need to made a simplest web application with Ruby is rack. It's used by all Framework in Ruby. And all server like Passenger/Thin/unicorn/mongrel are rack compatible.
So you can put the must simplest ruby web application like that :
class HelloWorld
def call(env)
[200, {"Content-Type" => "text/plain"}, ["Hello world!"]]
end
end
But the dynamic system are more difficult. So a framework is really helpful.
Yes, you can, depending on your development environment. The most common approach that doesn't use any framework, such as Rails, is to use Apache with modruby/eruby. See http://www.modruby.net/en/ for more information (also wikipedias eruby entry: http://en.wikipedia.org/wiki/ERuby)
And, technically speaking, Rails is just a framework written in Ruby, so it's technically still "just ruby" :)
Here is a list of other frameworks than Rails.
You might want to start with Sinatra : it's really small and lets you focus more on the Ruby-learning than on the framework-learning.
Ruby is sufficient but you would have to wire the http server (like webrick/apache/mongrel) with the application you are writing by yourself.
I'd recommend, as to avoid this wireing, to use a simple basic framework like sinatrarb http://www.sinatrarb.com/
Ruby is sufficient, but I wouldn't recommend it. I would recommend working with a framework until you're comfortable with Ruby.
You may want to start even smaller though.
I would definitely use Rails if I were you. Although you can build a website using only Ruby, it's a bit overkill, and you sure can get a lot more using Rails.
A great start for learning Rails (that's where I started) is:
http://headfirstlabs.com/books/hfrails/
There's a few chapters in there you can read. It's really good, and will give you a nice and solid introduction.
Edit
Also, you can use Mongrel, Webrick, lighttpd, Apache etc with it with no problems
You can start off by checking out Chapter 18 (and the rest) of the "Pickaxe Book" titled Ruby and the Web. You can find the online version here to see the nitty gritty of writing Ruby only scripts for a website. There are many options to choose from, most of which have been already suggested here, that will get your website running much quicker and easier.

Tools for development SOAP-service on Ruby 1.9

Which set of libraries and tools would you recommend to use for development SOAP-service on Ruby 1.9 - soap-tools, web-servers, or maybe a web-framework?
I have researched this myself. As far as I can tell, there is just one current implementation:
wash_out
It is a very nice to do SOAP in Rails. It does the most basic stuff but it isn't a complete SOAP implementation. I think you are in for a world of hurt if you are building a SOAP service on Rails.
Soap Ui is a pretty good way to test/debug/etc.
Good luck!
Take a look at http://aws.rubyonrails.org/, when it's explained how to create web services within RubyOnRails.
SOAP doesn't seem to be popular in Ruby land. The only library for creating services I know of is SOAP4R (which comes bundled with Ruby), and the documentation for it isn't very detailed.

Ruby Web Services

I'm contemplating creating a web application using a Ruby on Rails/MySQL stack and I am wondering what capabilities are available around web services and SOAP. Is there a capability within the framework or does it require an extension and if so what?
Rails opted for REST over SOAP:
It’ll probably come as no surprise
that Rails has picked a side in the
SOAP vs REST debate. Unless you
absolutely have to use SOAP for
integration purposes, we strongly
discourage you from doing so. As a
naturally extension of that, we’ve
pulled ActionWebService from the
default bundle. It’s only a gem
install actionwebservice away, but it
sends an important message none the
less.
Still, if you must use SOAP, there's always soap4r, but it only supports SOAP 1.1. A better option might be WSF/Ruby. Mark Thomas has an example controller to help you get up and running.
Rails has opted for REST over SOAP in the default framework. It's not hard to go the SOAP route if you want to, though.
I don't recommend soap4r - as of a few months ago, anyway, it wasn't production quality. The updated version of ActionWebService has worked much better for me.
The old way in Rails was to use the Action Web Service framework. The preferred way now is to use the ActiveResource framework for RESTful web services.

Ruby support for XML namespaces

I work at a small company and our production system uses a hand-rolled RESTful API, implemented in Java with JAXB. We now find that we're taking on customers who use Ruby on Rails, and I have to come up with a reference implementation to show customers how to use our API in Ruby. I'd love to be able to just tell them to use ActiveResource, but the XML required by our API uses (and absolutely requires) namespaces. Unfortunately, we've already got a number of other customers who've already integrated this API, so removing the usage of namespaces is out of the question. What's the best way to generate XML with namespaces in Ruby ?
"Best" obviously depends on your needs.
The fastest way to generate any XML in ruby is to use libxml-ruby - link to rdoc.
If your server gets any kind of load at all, this will be the way to go.
The easiest way to generate any XML in ruby is to use REXML as it's part of the standard library and therefore it "just works". If your XML generation is something that hardly ever gets used, it's probably easier to just go with rexml.
Both support XML namespaces - check the rdocs to find out how to set and get namespaces
I find myself in almost an identical situation as yours (RESTful API done with JAXB w/ namespaces).
I think the most promising project for working with XML in Ruby is HappyMapper. It is a kind of XML binding library (along the lines of an early JAXB-type implementation). It has been gaining a lot of traction recently, and a few of us have been working on providing good namespace support.
The project resides here:
http://happymapper.rubyforge.org/
with the source here:
http://github.com/jnunemaker/happymapper/tree/master
The project currently doesn't support creation of XML from Ruby Objects, and the original author has expressed no desire to provide that support, but I'll be committing some functionality for that in my fork:
http://github.com/jimmyz/happymapper/tree/master
Hope this helps.
--
Jimmy Zimmerman

Resources