diff --git a/CHANGELOG.md b/CHANGELOG.md index a73f00b8..6c82d08c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # 2.5.0 (2014-05-03) +* Feature: [#573](https://github.com/savonrb/savon/pull/573) Add an `all_operations` method to `Savon::Model` that automatically adds all available operations to the model. + * Feature: [#566](https://github.com/savonrb/savon/pull/566) Allow specifying HTTPI adapter per client. ```ruby diff --git a/lib/savon/model.rb b/lib/savon/model.rb index eb1d9301..e39b0db1 100644 --- a/lib/savon/model.rb +++ b/lib/savon/model.rb @@ -19,6 +19,10 @@ def operations(*operations) end end + def all_operations + operations(*client.operations) + end + private # Defines a class-level SOAP operation. diff --git a/spec/savon/model_spec.rb b/spec/savon/model_spec.rb index 8b29e062..963cc413 100644 --- a/spec/savon/model_spec.rb +++ b/spec/savon/model_spec.rb @@ -151,4 +151,32 @@ def supermodel.authenticate(lcoals = {}) supermodel.authenticate(:message => { :username => "luke", :password => "secret" }) end + describe ".all_operations" do + it "should call operations with all available client operations" do + model = Class.new { + extend Savon::Model + + client :wsdl => Fixture.wsdl(:taxcloud) + all_operations + } + + [:verify_address, + :lookup_for_date, + :lookup, + :authorized, + :authorized_with_capture, + :captured, + :returned, + :get_tic_groups, + :get_ti_cs, + :get_ti_cs_by_group, + :add_exempt_certificate, + :delete_exempt_certificate, + :get_exempt_certificates].each do |method| + expect(model).to respond_to(method) + end + end + + end + end