GithubHelp home page GithubHelp logo

shapewear's Introduction

shapewear Build Status

Shapewear make your fat service look skinny.

Most of the inspiration for this gem came from Savon and HTTParty, thanks Daniel Harrington (a.k.a. rubiii) and John Nunemaker!

Work in Progress

This gem is still in early development. It's only working for some very basic cases. Any contribution and feedback is welcome.

Roadmap

  • Add more tests;
  • Add support for SOAP 1.2;
  • Add cleaner integration on Rails and Sinatra (Rack middleware?).

Installation

Shapewear is available through Rubygems and can be installed via:

$ gem install shapewear

Introduction

First, describe your SOAP service:

require "shapewear"

class MyFirstService
  include Shapewear

  wsdl_namespace 'http://services.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:

# 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(request)
  end
end

Sinatra example:

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(request)
  end
end

shapewear's People

Contributors

fabiob avatar

Watchers

 avatar  avatar Ianek avatar Rodrigo N. avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.