Sha256: 5a12782efe95d69f56b76cd9854affc5654a06f5d8dfed976081cf5c34b6761c
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
# encoding: UTF-8 # This class represents a fully customized service. # It is used to test the extensiveness of the Shapewear DSL. class CompleteService include Shapewear wsdl_namespace 'http://services.example.com/v1' endpoint_url 'http://services.example.com/complete/soap' operation :echo_in_uppercase, :documentation => 'Echoes back the parameter, in uppercase', :parameters => [[:text, String]], :returns => String operation :sum, :documentation => 'Adds two numbers', :parameters => [[:x, Fixnum], [:y, Fixnum]], :returns => Fixnum operation :get_structured_data, :documentation => 'Returns structured data. 0 uses a Hash, 1 uses a struct, any other value raises a fault', :parameters => [['ID', Fixnum]], :returns => { :text => String, :random_value => Fixnum, :created_at => DateTime, 'XYZ' => String } def echo_in_uppercase(text) text.upcase unless text.nil? end def sum(x, y) x + y end def get_structured_data(id) case id when 0 then Structured.new('text from the struct') when 1 then { :text => 'text from a hash', :random_value => rand(999), :created_at => DateTime.now } else raise "ID must be 0 or 1" end end class Structured attr_reader :text, :random_value, :created_at, :xyz def initialize(text) @text = text @random_value = rand(999) @created_at = DateTime.now @xyz = 'xyz' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shapewear-0.1.7 | spec/shapewear/service_definitions/complete_service.rb |
shapewear-0.1.5 | spec/shapewear/service_definitions/complete_service.rb |