Sha256: eac8b13b7af3b3eed74e8da66706ded1b1572ea09677e1beef51e76b484e9707

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

shapewear [![Build Status](https://secure.travis-ci.org/elementar/shapewear.png)](http://travis-ci.org/elementar/shapewear)
=========

Make your fat service look skinny.

Work in Progress
----------------

This gem is still in early development, and it's not yet yet ready for use. Any contribution and feedback is welcome.

Installation
------------

Shapewear is available through [Rubygems](http://rubygems.org/gems/shapewear) and can be installed via:

```
$ gem install shapewear
```

Introduction
------------

First, describe your SOAP service:

``` ruby
require "shapewear"

class MyFirstService
  include Shapewear

  wsdl_namespace 'http://services.example.com/v1'
  schema_namespace 'http://schemas.example.com/v1'

  endpoint_url 'http://localhost:3000/my_first_service'

  operation :hello, :parameters => [[:name, String]], :returns => String
  def hello(name)
    "hello, #{name}"
  end

  operation :sum, :parameters => [[:x, Fixnum], [:y, Fixnum]], :returns => Fixnum
  def sum(x, y)
    x + y
  end

  operation :get_user_info, :parameters => [[:email, String]], :returns => { :name => String, :birthday => DateTime }
  def get_user_info(email)
    User.find_by_email(email)
  end
end
```

Then bind to your web application in a non-intrusive way.

Rails example:

``` ruby
# don't forget to write the appropriate routes
class MyFirstServiceController < ApplicationController
  def wsdl
    render :xml => MyHelloService.to_wsdl
  end

  def serve
    render :xml => MyHelloService.serve(params)
  end
end
```

Sinatra example:

``` ruby
class MySinatraApp < Sinatra::App
  get "my_first_service/wsdl" do
    content_type "application/xml"
    MyHelloService.to_wsdl
  end

  post "my_first_service" do
    content_type "application/xml"
    MyHelloService.serve(params)
  end
end
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shapewear-0.0.3 README.md